apply-semantic-versioning
关于
This skill analyzes code changes to determine the correct semantic version bump (major, minor, or patch) according to SemVer 2.0.0. It handles breaking change detection, pre-release identifiers, and build metadata for release preparation. Use it before tagging releases to objectively resolve version disagreements and classify changes.
快速安装
Claude Code
推荐npx skills add pjt222/agent-almanac -a claude-code/plugin add https://github.com/pjt222/agent-almanacgit clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/apply-semantic-versioning在 Claude Code 中复制并粘贴此命令以安装该技能
技能文档
Apply Semantic Versioning
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.
When Use
- Preparing new release and need to determine correct version number
- After merging set of changes and before tagging release
- Evaluating whether change constitutes breaking change
- Adding pre-release identifiers (alpha, beta, rc) to version
- Resolving disagreement about what version bump appropriate
Inputs
- Required: Project root directory containing version file (DESCRIPTION, package.json, Cargo.toml, pyproject.toml, or VERSION)
- Required: Git history since last release (tag or commit)
- Optional: Commit convention in use (Conventional Commits, free-form)
- Optional: Pre-release label to apply (alpha, beta, rc)
- Optional: Previous version if not readable from files
Steps
Step 1: Read Current Version
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.
Step 2: Analyze Changes Since Last Release
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.
Step 3: Classify Changes
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:
- ANY change is breaking? Bump is MAJOR (resets minor and patch to 0)
- No breaking changes but ANY new features? Bump is MINOR (resets patch to 0)
- Only fixes? Bump is PATCH
Special cases:
- Pre-1.0.0: During initial development (
0.x.y), minor bumps may contain breaking changes. Document clearly. - Deprecation: Deprecating function is MINOR change (it still works). Removing it is MAJOR.
- Internal changes: Refactoring that does not change public API is PATCH.
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.
Step 4: Compute New Version
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.1for first alpha of upcoming 1.3.01.3.0-beta.1for first beta1.3.0-rc.1for first release candidate
Pre-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.
Step 5: Update Version Files
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.
Step 6: Create Version Tag
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)[email protected](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.
Checks
- Current version read from correct version file
- All commits since last release analyzed
- Each change classified as breaking, feature, or fix
- Bump level matches highest-severity change (breaking > feature > fix)
- New version follows SemVer 2.0.0 format:
MAJOR.MINOR.PATCH[-PRERELEASE][+BUILD] - All version files in project updated consistently
- No version was skipped (e.g., 1.2.3 to 1.4.0 without 1.3.0 being released)
- Git tag matches new version and project's tag format convention
- Pre-release suffix, if used, follows correct precedence (alpha < beta < rc)
Pitfalls
- Skipping minor versions: Going from 1.2.3 directly to 1.4.0 because "we added two features." Each release gets one bump; number of features does not determine version.
- Treating deprecation as breaking: Deprecating function (adding warning) is minor change. Only removing it is breaking change.
- Forgetting pre-1.0.0 rules: Before 1.0.0, API considered unstable. Some projects bump minor for breaking changes during this phase, but should be documented.
- Inconsistent version files: Updating package.json but not package-lock.json, or updating DESCRIPTION but not CITATION. All version references must stay in sync.
- Build metadata confusion: Build metadata (
+build.123) does not affect version precedence.1.0.0+build.1and1.0.0+build.2have same precedence. - Not tagging releases: Without git tags, future version bumps cannot determine baseline for change analysis.
See Also
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
GitHub 仓库
相关推荐技能
content-collections
元Content Collections 是一个 TypeScript 优先的构建工具,可将本地 Markdown/MDX 文件转换为类型安全的数据集合。它专为构建博客、文档站和内容密集型 Vite+React 应用而设计,提供基于 Zod 的自动模式验证。该工具涵盖从 Vite 插件配置、MDX 编译到生产环境部署的完整工作流。
polymarket
元这个Claude Skill为开发者提供完整的Polymarket预测市场开发支持,涵盖API调用、交易执行和市场数据分析。关键特性包括实时WebSocket数据流,可监控实时交易、订单和市场动态。开发者可用它构建预测市场应用、实施交易策略并集成实时市场预测功能。
creating-opencode-plugins
元该Skill帮助开发者创建OpenCode插件,用于接入命令、文件、LSP等25+种事件。它提供了插件结构、事件API规范和JavaScript/TypeScript实现模式,适合需要拦截操作、扩展功能或自定义事件处理的场景。开发者可通过它快速构建响应式模块来增强OpenCode AI助手的能力。
sglang
元SGLang是一个专为LLM设计的高性能推理框架,特别适用于需要结构化输出的场景。它通过RadixAttention前缀缓存技术,在处理JSON、正则表达式、工具调用等具有重复前缀的复杂工作流时,能实现极速生成。如果你正在构建智能体或多轮对话系统,并追求远超vLLM的推理性能,SGLang是理想选择。
