返回技能列表

apply-semantic-versioning

pjt222
更新于 2 days ago
7 次查看
17
2
17
在 GitHub 上查看
designdata

关于

This skill analyzes code changes to automatically 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 after merging changes to resolve version disagreements and ensure proper tagging.

快速安装

Claude Code

推荐
主要方式
npx skills add pjt222/agent-almanac -a claude-code
插件命令备选方式
/plugin add https://github.com/pjt222/agent-almanac
Git 克隆备选方式
git clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/apply-semantic-versioning

在 Claude Code 中复制并粘贴此命令以安装该技能

技能文档

Apply Semantic Versioning

Determine + apply correct ver bump via changes since last release. Read ver files, classify changes breaking (major)/feature (minor)/fix (patch), compute new ver, update files. SemVer 2.0.0.

Use When

  • Prepare new release → correct ver num
  • After merging, before tagging
  • Eval change = breaking?
  • Add pre-release (alpha, beta, rc)
  • Resolve disagreement about ver bump

In

  • Required: Project root w/ ver file (DESCRIPTION, package.json, Cargo.toml, pyproject.toml, VERSION)
  • Required: Git history since last release (tag or commit)
  • Optional: Commit convention (Conventional Commits, free-form)
  • Optional: Pre-release label (alpha, beta, rc)
  • Optional: Previous ver if not readable

Do

Step 1: Read Current Ver

Locate + read ver 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 → major.minor.patch. Pre-release suffix (e.g., 1.2.0-beta.1) → note separately.

Current ver = MAJOR.MINOR.PATCH[-PRERELEASE].

If err: No ver file → check VERSION file or git tags (git describe --tags --abbrev=0). No ver → start 0.1.0 initial dev or 1.0.0 if stable public API.

Step 2: Analyze Changes

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 → compare against initial commit or known baseline.

List of commits w/ msgs classifiable by change type.

If err: Git history unavail or tags missing → ask dev describe changes manually. Classify per desc.

Step 3: Classify Changes

Apply SemVer rules:

Change TypeBumpExamples
Breaking (incompatible API change)MAJORRenamed/removed public fn, changed return type, removed param, changed default behavior
Feature (new backwards-compat)MINORNew exported fn, new param w/ default, new file format support
Fix (backwards-compat bug fix)PATCHBug fix, doc correction, perf w/ same API

Rules:

  1. ANY breaking → MAJOR (resets minor + patch to 0)
  2. No breaking + ANY features → MINOR (resets patch to 0)
  3. Only fixes → PATCH

Special:

  • Pre-1.0.0: During initial dev (0.x.y), minor bumps may contain breaking changes. Doc clearly.
  • Deprecation: Deprecating a fn → MINOR (still works). Removing → MAJOR.
  • Internal changes: Refactoring no public API change → PATCH.

Each change classified breaking/feature/fix + overall bump level.

If err: Ambiguous → err on side of higher bump. Conservative major > minor breaking downstream.

Step 4: Compute New Ver

Apply bump to current:

CurrentBumpNew Version
1.2.3MAJOR2.0.0
1.2.3MINOR1.3.0
1.2.3PATCH1.2.4
0.9.5MINOR0.10.0
2.0.0-rc.1(release)2.0.0

Pre-release label requested:

  • 1.3.0-alpha.1 first alpha of upcoming 1.3.0
  • 1.3.0-beta.1 first beta
  • 1.3.0-rc.1 first release candidate

Pre-release precedence: alpha < beta < rc < (release).

New ver num per SemVer rules.

If err: Current ver malformed or non-SemVer → normalize first. 1.21.2.0.

Step 5: Update Ver Files

Write new ver to 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"

Multi files ref ver (_pkgdown.yml, CITATION, codemeta.json) → update all.

All ver files updated consistently → new ver.

If err: File update fails → revert all → maintain consistency. Never partially updated state.

Step 6: Create Ver Tag

After committing ver 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

Project's tag format:

Git tag matching new ver.

If err: Tag exists → ver not properly bumped. Check duplicate tags git tag -l "v1.3*" + resolve.

Check

  • Current ver read from correct file
  • All commits since last release analyzed
  • Each change classified breaking/feature/fix
  • Bump matches highest-severity (breaking > feature > fix)
  • New ver SemVer 2.0.0: MAJOR.MINOR.PATCH[-PRERELEASE][+BUILD]
  • All ver files updated consistently
  • No ver skipped (1.2.3 → 1.4.0 no 1.3.0 released)
  • Git tag matches new ver + project's format
  • Pre-release suffix follows correct precedence (alpha < beta < rc)

Traps

  • Skip minor versions: 1.2.3 directly → 1.4.0 because "2 features." Each release = 1 bump; num features no determine ver.
  • Treat deprecation as breaking: Deprecating (adding warn) = minor. Only removing = breaking.
  • Forget pre-1.0.0: Before 1.0.0 API unstable. Some projects bump minor for breaking during this phase, but doc.
  • Inconsistent ver files: Update package.json not package-lock.json, or DESCRIPTION not CITATION. All refs sync.
  • Build metadata confusion: Build metadata (+build.123) no affect ver precedence. 1.0.0+build.1 + 1.0.0+build.2 same precedence.
  • Not tagging releases: No git tags → future ver bumps can't determine baseline for change analysis.

  • manage-changelog — maintain changelog entries pair w/ ver bumps
  • plan-release-cycle — plan release milestones → ver bumps
  • release-package-version — R-specific release workflow includes ver bumping
  • commit-changes — commit ver bump w/ proper msg
  • create-github-release — create GitHub release from ver tag

GitHub 仓库

pjt222/agent-almanac
路径: i18n/caveman-ultra/skills/apply-semantic-versioning
0
agentsagentskillsai-assisted-developmentclaude-codeskillsteams

相关推荐技能

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是理想选择。

查看技能