Skip to content

Commit 263e717

Browse files
szegediclaude
andcommitted
add release skill for Claude Code
Automates the v5.x release proposal workflow: worktree creation, branch-diff to identify commits, cherry-picking, version bump, and PR creation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 203a976 commit 263e717

1 file changed

Lines changed: 105 additions & 0 deletions

File tree

.claude/skills/release/SKILL.md

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
---
2+
name: release
3+
description: Create a release proposal for the v5.x branch by cherry-picking commits from main
4+
disable-model-invocation: true
5+
argument-hint: "[version (optional, auto-determined from PR labels)]"
6+
---
7+
8+
Create a v5.x release proposal. If a version is provided as $ARGUMENTS, use it. Otherwise, determine it automatically (see step 2).
9+
10+
## Prerequisites
11+
12+
The `branch-diff` tool must be installed globally:
13+
14+
```
15+
npm install branch-diff -g
16+
```
17+
18+
## Steps
19+
20+
### 1. Identify commits to cherry-pick
21+
22+
Use the `branch-diff` tool to list commits on `main` not yet applied to `v5.x`:
23+
24+
```
25+
branch-diff v5.x main
26+
```
27+
28+
Review the output with the user. Skip:
29+
- Version bump commits (e.g. "Bump package version on to 6.0.0-pre")
30+
- Commits that would result in empty cherry-picks (already applied or superseded)
31+
32+
Confirm the list of commits with the user before proceeding.
33+
34+
### 2. Determine the version number
35+
36+
If the user didn't provide a version, determine it from PR labels. For each commit being cherry-picked, extract the PR number from the commit message (e.g. `(#305)`) and check its labels:
37+
38+
```
39+
gh pr view <number> --json labels --jq '.labels[].name'
40+
```
41+
42+
- If any PR has a `semver-minor` label, the release is a **minor** bump.
43+
- If all PRs have at most a `semver-patch` label, the release is a **patch** bump.
44+
45+
Get the current version from the tip of `v5.x` (the most recent version commit message), then compute the next version accordingly. Confirm the version with the user.
46+
47+
In the steps below, `$VERSION` refers to the determined version number.
48+
49+
### 3. Create a worktree
50+
51+
Create a git worktree from the current repo, checking out a new branch `v$VERSION-proposal` based on the `v5.x` branch:
52+
53+
```
54+
git worktree add ../pprof-nodejs-v5 -b v$VERSION-proposal v5.x
55+
```
56+
57+
All subsequent steps run in the worktree directory.
58+
59+
### 4. Cherry-pick commits
60+
61+
Cherry-pick the agreed-upon commits in chronological order (oldest first):
62+
63+
```
64+
git cherry-pick <hash1> <hash2> ...
65+
```
66+
67+
If a cherry-pick has conflicts, stop and resolve with the user.
68+
69+
### 5. Create the version bump commit
70+
71+
Bump the version in package.json and package-lock.json using npm, then commit:
72+
73+
```
74+
npm version $VERSION --no-git-tag-version
75+
git add package.json package-lock.json
76+
git commit -m "v$VERSION"
77+
```
78+
79+
### 6. Push and create a PR
80+
81+
Push the branch and create a PR targeting `v5.x`:
82+
83+
```
84+
git push -u origin v$VERSION-proposal
85+
```
86+
87+
Create the PR with `gh pr create --base v5.x`. The PR body should categorize the cherry-picked PRs by type, following this pattern:
88+
89+
```markdown
90+
# New features
91+
* #NNN
92+
93+
# Improvements
94+
* #NNN
95+
96+
# Bug fixes
97+
* #NNN
98+
99+
# Other (build, dev)
100+
* #NNN
101+
```
102+
103+
Only include sections that have entries. Reference PR numbers from the original commit messages.
104+
105+
See https://github.com/DataDog/pprof-nodejs/pull/295 for an example.

0 commit comments

Comments
 (0)