技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
apply-semantic-versioning【数据与研究】Apply semantic versioning (SemVer 2.0.0) to determine the correct version bump based on change analysis. Covers major/minor/patch classification, pre-release identifiers, build metadata, and breaking change detection. Use when preparing a new release to determine the correct version number, after merging changes before tagging, evaluating whether a c…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Determine and apply correct semantic version bump by analyzing changes since last release. This skill reads version files, classifies changes as breaking (major), feature (minor), or fix (patch), computes new version number, updates appropriate files. Follows SemVer 2.0.0 specification.
Locate and read version file in project root.
# R packages
grep "^Version:" DESCRIPTION
# Node.js
grep '"version"' package.json
# Rust
grep '^version' Cargo.toml
# Python
grep 'version' pyproject.toml
# Plain file
cat VERSION
Parse current version into major.minor.patch components. Version contains pre-release suffix (e.g., 1.2.0-beta.1)? Note it separately.
Got: Current version identified as MAJOR.MINOR.PATCH[-PRERELEASE].
If fail: No version file found? Check for VERSION file or git tags (git describe --tags --abbrev=0). No version exists at all? Start at 0.1.0 for initial development or 1.0.0 if project has stable public API.
Retrieve list of changes since last tagged release.
# Find the last version tag
git describe --tags --abbrev=0
# List commits since that tag
git log --oneline v1.2.3..HEAD
# If using Conventional Commits, filter by type
git log --oneline v1.2.3..HEAD | grep -E "^[a-f0-9]+ (feat|fix|BREAKING)"
No tags exist? Compare against initial commit or known baseline.
Got: List of commits with messages that can be classified by change type.
If fail: Git history unavailable or tags missing? Ask developer to describe changes manually. Classify based on their description.
Apply SemVer classification rules:
| Change Type | Version Bump | Examples |
|---|---|---|
| Breaking (incompatible API change) | MAJOR | Renamed/removed public function, changed return type, removed parameter, changed default behavior |
| Feature (new backwards-compatible functionality) | MINOR | New exported function, new parameter with default, new file format support |
| Fix (backwards-compatible bug fix) | PATCH | Bug fix, documentation correction, performance improvement with same API |
Classification rules:
Special cases:
0.x.y), minor bumps may contain breaking changes. Document clearly.Got: Each change classified as breaking/feature/fix, overall bump level determined.
If fail: Changes ambiguous? Err on side of higher bump. Conservative major bump better than minor bump that breaks downstream code.
Apply bump to current version:
| Current | Bump | New Version |
|---|---|---|
| 1.2.3 | MAJOR | 2.0.0 |
| 1.2.3 | MINOR | 1.3.0 |
| 1.2.3 | PATCH | 1.2.4 |
| 0.9.5 | MINOR | 0.10.0 |
| 2.0.0-rc.1 | (release) | 2.0.0 |
Pre-release label requested?
1.3.0-alpha.1 for first alpha of upcoming 1.3.01.3.0-beta.1 for first beta1.3.0-rc.1 for first release candidatePre-release precedence: alpha < beta < rc < (release).
Got: New version number computed following SemVer rules.
If fail: Current version malformed or non-SemVer? Normalize first. Example: 1.2 becomes 1.2.0.
Write new version to appropriate file(s).
# R: Update DESCRIPTION
# Change "Version: 1.2.3" to "Version: 1.3.0"
// Node.js: Update package.json
// Change "version": "1.2.3" to "version": "1.3.0"
// Also update package-lock.json if present
# Rust: Update Cargo.toml
# Change version = "1.2.3" to version = "1.3.0"
Project has multiple files that reference version (e.g., _pkgdown.yml, CITATION, codemeta.json)? Update all of them.
Got: All version files updated consistently to new version number.
If fail: File update fails? Revert all changes to maintain consistency. Never leave version files in partially updated state.
After committing version bump, create git tag.
# Annotated tag (preferred)
git tag -a v1.3.0 -m "Release v1.3.0"
# Lightweight tag (acceptable)
git tag v1.3.0
Use project's established tag format:
v1.3.0 (most common)1.3.0 (no prefix)package-name@1.3.0 (monorepo)Got: Git tag created matching new version.
If fail: Tag already exists? Version was not properly bumped. Check for duplicate tags with git tag -l "v1.3*" and resolve before proceeding.
MAJOR.MINOR.PATCH[-PRERELEASE][+BUILD]+build.123) does not affect version precedence. 1.0.0+build.1 and 1.0.0+build.2 have same precedence.manage-changelog -- Maintain changelog entries that pair with version bumpsplan-release-cycle -- Plan release milestones that determine when version bumps occurrelease-package-version -- R-specific release workflow that includes version bumpingcommit-changes -- Commit version bump with proper messagecreate-github-release -- Create GitHub release from version tag