PR Version Bump
Analyze git changes since branching from main, recommend a semantic version bump, update version files, draft a changelog entry, and prepare the branch for PR creation.
Path Convention
{PLUGIN_ROOT} = Plugin root directory (where .claude-plugin/plugin.json lives)
When this skill references files like {PLUGIN_ROOT}/lib/patterns/version-discovery.md, read from the plugin root, not relative to this skill folder.
Scope
| Does | Does NOT |
|---|---|
| Analyze changes since main | Run release scripts |
| Detect version files and changelog | Push tags |
| Recommend semver bump with evidence | Merge branches |
| Update version files and changelog | Deploy or publish |
| Commit version bump changes | |
Push branch and create PR via gh pr create |
Modes
| Mode | Trigger | Purpose |
|---|---|---|
| Prepare (default) | prepare, bump, or no args | Bump version, draft changelog, commit, push, create PR |
| Finalize | finalize, verify, check | Verify version bump and changelog exist before merge |
Phase 1: CONTEXT
Establish the working context.
Steps
- •
Verify not on main branch:
bashgit branch --show-current
If on
mainormaster, STOP with: "Switch to a feature branch first. Version bumps should not be done directly on main." - •
Identify base branch:
bashgit merge-base main HEAD
This is the point where the current branch diverged from main.
- •
Detect mode from user input:
- •Empty / "prepare" / "bump" → Prepare mode
- •"finalize" / "verify" / "check" → Finalize mode
- •
Report context:
codeBranch: feature/my-feature Base: main (diverged at abc1234) Mode: Prepare
STOP: If on main branch
Phase 2: DISCOVER
Scan the repository for version infrastructure.
Steps
- •
Read pattern reference: Read
{PLUGIN_ROOT}/lib/patterns/version-discovery.mdfor the detection algorithm. - •
Scan for version files in priority order:
- •
package.yaml→ look forversion:field - •
package.json→ look for"version":field - •
pyproject.toml→ look forversion =field - •
.claude-plugin/plugin.json→ look for"version":field - •
Cargo.toml,setup.cfg,VERSION
- •
- •
Scan for changelog:
- •
CHANGELOG.md,CHANGES.md,HISTORY.md - •Detect format (Keep a Changelog, conventional, other)
- •
- •
Extract semver rules from:
- •
CLAUDE.md→ look for## Versioningsection - •
RELEASING.md→ look for semantic versioning guidance - •
CONTRIBUTING.md→ look for versioning section
- •
- •
Detect release automation:
- •
scripts/release.sh - •
.github/workflows/release.yaml - •
MakefileorJustfilerelease targets
- •
- •
Check for additional version files that should stay in sync:
- •If
package.yamlhas version, also check.claude-plugin/plugin.json - •Flag any mismatches
- •If
STOP: Present discovery summary for confirmation
## Version Infrastructure | Component | Found | Details | |-----------|-------|---------| | Version file | package.yaml | v3.0.0 | | Changelog | CHANGELOG.md | Keep a Changelog format | | Semver rules | CLAUDE.md | 5 rules extracted | | Release script | scripts/release.sh | Tag-based release | | Additional version files | .claude-plugin/plugin.json | v3.0.0 (in sync) |
Phase 3: ANALYZE
Examine all changes since branching from main.
Steps
- •
Read pattern reference: Read
{PLUGIN_ROOT}/lib/patterns/change-classification.mdfor the classification algorithm. - •
Collect commit history:
bashgit log main..HEAD --oneline --no-merges
- •
Collect diff summary:
bashgit diff main...HEAD --stat git diff main...HEAD --name-status
- •
Classify changes using the pipeline from
change-classification.md:- •Apply repository-specific rules (from Phase 2) first
- •Parse conventional commit prefixes
- •Apply file-level heuristics as fallback
- •Apply blueprint-lib-specific heuristics if type YAML files changed
- •
Build evidence table:
Evidence Source Bump Signal ... ... ...
STOP: Present change analysis summary
Phase 4: RECOMMEND
Map classified changes to a semver recommendation.
Steps
- •
Determine bump level:
- •Take the highest signal from the evidence table
- •MAJOR > MINOR > PATCH
- •
Calculate new version:
- •Current:
X.Y.Z(from Phase 2) - •MAJOR →
X+1.0.0 - •MINOR →
X.Y+1.0 - •PATCH →
X.Y.Z+1
- •Current:
- •
Present recommendation:
code## Recommendation: MINOR bump Current: 3.0.0 → Recommended: 3.1.0 ### Evidence | Evidence | Source | Signal | |----------|--------|--------| | New consequence type `foo` added | consequences.yaml diff | MINOR | | feat: Add foo consequence | commit abc1234 | MINOR | ### Reasoning New type added with no breaking changes. All existing types unchanged.
- •
Offer override:
- •"Accept MINOR (3.1.0)"
- •"Override to MAJOR (4.0.0)"
- •"Override to PATCH (3.0.1)"
- •"Skip version bump"
STOP: Wait for user to select bump level
Phase 5: EXECUTE
Apply the version bump and draft changelog.
Only runs in Prepare mode. In Finalize mode, skip to Phase 6.
Steps
- •
Update version file(s):
- •Update the primary version file (e.g.,
package.yaml) - •Update any additional version files found in Phase 2 (e.g.,
.claude-plugin/plugin.json)
- •Update the primary version file (e.g.,
- •
Draft changelog entry:
- •Use the format detected in Phase 2
- •Place new entry after the changelog header, before existing entries
- •Include today's date
- •Categorize changes using Keep a Changelog sections:
- •
### Added- New features - •
### Changed- Changes to existing functionality - •
### Fixed- Bug fixes - •
### Removed- Removed features - •
### BREAKING CHANGES- For MAJOR bumps
- •
- •
Present draft for review: Show the exact changes that will be made to each file.
- •
After user confirms, commit:
bashgit add <version-files> <changelog> git commit -m "chore: Prepare release vX.Y.Z"
- •
Push branch to remote:
bashgit push -u origin <branch-name>
- •
Create pull request: Reference
{SKILL_ROOT}/resources/pull-requests.mdforgh pr createsyntax.bashgh pr create --title "Release vX.Y.Z" --body "$(cat <<'EOF' ## Summary Version bump: A.B.C → X.Y.Z (MAJOR|MINOR|PATCH) ### Changelog <paste changelog entry from step 2> --- Prepared by `/pr-version-bump` EOF )"
Capture and store the PR URL from the output.
STOP: Confirm before making file mutations
Phase 6: REPORT
Summarize what was done and offer next steps.
Prepare Mode Report
## Version Bump Complete - Version: 3.0.0 → 3.1.0 - Files updated: package.yaml, .claude-plugin/plugin.json - Changelog: CHANGELOG.md updated with [3.1.0] entry - Commit: abc1234 "chore: Prepare release v3.1.0" - PR: https://github.com/hiivmind/hiivmind-blueprint-lib/pull/XX ### Next Steps 1. Review the PR and get approval 2. Merge the PR -- GitHub Actions will automatically create a tagged release
Finalize Mode Report
In Finalize mode, Phase 6 checks instead of executes:
- •
Check version bumped:
- •Compare version in HEAD vs main
- •PASS if version is higher, FAIL if unchanged
- •
Check changelog updated:
- •Look for an entry matching the new version number
- •PASS if found with content, FAIL if missing
- •
Report results:
code## Pre-Merge Verification | Check | Status | Details | |-------|--------|---------| | Version bumped | PASS | 3.0.0 → 3.1.0 | | Changelog entry | PASS | [3.1.0] - 2026-02-07 with 3 items | | Version files in sync | PASS | package.yaml and plugin.json both 3.1.0 | Ready to merge.
Or if checks fail:
code## Pre-Merge Verification | Check | Status | Details | |-------|--------|---------| | Version bumped | FAIL | Still 3.0.0 - no bump detected | | Changelog entry | FAIL | No [3.1.0] entry found | Run `/pr-version-bump prepare` to fix.
Error Handling
| Error | Action |
|---|---|
| Not a git repository | STOP: "This directory is not a git repository." |
No main branch | Try master, then STOP if neither exists |
| No commits since main | STOP: "No changes to version. Branch is up to date with main." |
| No version file found | STOP: "No version file detected. Create a package.yaml, package.json, or pyproject.toml first." |
| Uncommitted changes | Warn: "You have uncommitted changes. Commit or stash them before bumping version." |
| Version already bumped | In Prepare mode, warn and offer to re-bump or skip |