Skip to content

Commit e776b79

Browse files
committed
Add release skill
1 parent 720a397 commit e776b79

1 file changed

Lines changed: 144 additions & 0 deletions

File tree

.agents/skills/release/SKILL.md

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
---
2+
name: release
3+
description: Guides Sourcegraph CLI patch, minor, and major releases. Use when preparing release branches, selecting patch commits, running Trivy checks, creating release tags, or managing local/pushed release artifacts.
4+
---
5+
6+
# Release
7+
8+
Use this skill when the user asks to prepare, cut, tag, or manage a release.
9+
10+
## Start by determining release intent
11+
12+
Gather only the information that is actually missing. Do not ask questions whose answers can be derived safely from tags, release branches, or the user's wording.
13+
14+
Proceed without clarification when the user has already provided enough intent, for example:
15+
16+
- "create a minor release `7.3.0`"
17+
- "cut the next major release from main"
18+
- "create a patch release" plus exact versions such as `7.2.2` and `7.1.3`
19+
- "next patch for current and one minor back"
20+
- "inspect main and decide what is patch-worthy"
21+
- "create everything locally first"
22+
23+
Ask a narrow question only when the missing answer would change the release artifacts or risk pushing/tagging the wrong thing:
24+
25+
1. Release type, if not clear from the request or version number.
26+
2. Exact version, if it cannot be inferred from existing tags.
27+
3. Source branch, if it is not the default branch.
28+
4. Commit selection, only if the user has not provided commits/PRs and has not asked you to inspect history and decide.
29+
5. Whether to push, only after local branches/tags are ready. Default to local-only unless the user explicitly asks to push.
30+
31+
For version inference:
32+
33+
- Inspect existing tags with `git tag --list --sort=-v:refname`.
34+
- Inspect release branches with `git branch -a --list '*release*'`.
35+
- For patch releases, increment the latest patch tag on the target release train. The current patch train is the highest release branch/tag line, for example `release/7.2.x` after `7.2.1` produces `7.2.2`.
36+
- For minor releases, increment the minor component from the latest released minor and set patch to `.0`, for example latest `7.2.1` produces `7.3.0`, unless the user specifies a different train.
37+
- For major releases, increment the major component and reset minor/patch to `.0.0`, for example latest `7.2.1` produces `8.0.0`, unless the user specifies a different train.
38+
- "One minor back" means the previous minor release branch, for example `release/7.1.x`; increment the latest patch tag on that line.
39+
- Confirm inferred versions in progress updates, but keep working unless the user asked for confirmation before mutation.
40+
41+
## Pre-flight checks
42+
43+
Before starting the release work:
44+
45+
1. Make sure the working tree is clean with `git status`.
46+
2. Fetch current refs and tags with `git fetch --all --tags --prune`.
47+
3. Run Trivy and ensure vulnerabilities are addressed before continuing.
48+
- For this repository, use `mise x trivy -- trivy fs --exit-code 1 --severity HIGH,CRITICAL`.
49+
- Use a different documented Trivy command only if the repository adds one.
50+
- Do not proceed to branch creation, cherry-picking, or tagging while unresolved Trivy vulnerabilities remain.
51+
- If running from a temporary worktree, `mise` may require trusting that worktree's `mise.toml`. Run `mise trust -y <worktree>/mise.toml` when needed, then remove or untrust temporary state during cleanup.
52+
53+
This repository is commonly used with `jj`, so `git status` may report `HEAD (no branch)`. Treat that as normal if the worktree is otherwise clean.
54+
55+
## Release workflow
56+
57+
Use the same workflow for patch, minor, and major releases. The release type mainly changes which commits from the source branch are included.
58+
59+
1. Confirm or infer the final version number and target release branch.
60+
2. Identify the source branch or commit, usually the current default branch unless the user says otherwise.
61+
3. Run pre-flight validation, including Trivy, on the source branch before creating or tagging release artifacts.
62+
4. Prepare the target release branch:
63+
- For a new release line, create the release branch from the source branch.
64+
- For an existing release line, use the existing release branch.
65+
- Never create a new branch for an existing patch train unless the target branch is missing and the user explicitly confirms creating it.
66+
- Prefer temporary git worktrees when working on multiple release trains, or when the user's current checkout is managed by `jj`, so each release branch can be mutated independently.
67+
5. Select commits from the source branch according to the release type.
68+
6. Port selected commits with `git cherry-pick -x <sha>` when the target branch does not already contain them.
69+
7. Resolve conflicts carefully and keep the release branch limited to selected commits and release-process changes.
70+
8. Run required validation, including Trivy, on every release branch after porting changes.
71+
9. Tag the release on the release branch, not on the default branch.
72+
10. Push the release branch and tag only when requested or required by the release process.
73+
74+
Use release branch names that match the current repository convention. Recent branches use the release train format:
75+
76+
- `release/7.1.x` for a `7.1.0` or `7.1.3` release
77+
- `release/7.2.x` for a `7.2.0` or `7.2.2` release
78+
- `release/8.0.x` for an `8.0.0` release
79+
80+
Older repositories may use release branch names without `.x`; prefer the convention shown by recent release branches.
81+
82+
## Commit selection by release type
83+
84+
For patch releases, include only patch-worthy commits. These are typically:
85+
86+
- Critical bug fixes
87+
- Security fixes
88+
- Data-loss or correctness fixes
89+
- Low-risk operational fixes required for the release line
90+
- Toolchain, runtime, base-image, or dependency updates that are part of fixing a vulnerability, even if the commit message is phrased as `chore`, `update Go`, `bump`, or similar
91+
92+
For patch releases, avoid including:
93+
94+
- New features
95+
- Broad refactors
96+
- Dependency bumps unrelated to the patch fix, unless needed for a vulnerability or confirmed by the user
97+
- Risky behavior changes
98+
- Command migrations, doc generation, dev-only tooling, or cleanup-only changes unless they directly fix the patch issue
99+
100+
For minor releases, include the normal release-train contents from the source branch unless the user asks to exclude something. Minor releases can include compatible features, fixes, dependency updates, migrations, and cleanup that are intended for the new minor train.
101+
102+
For major releases, include the normal release-train contents from the source branch and any intentionally breaking changes approved for the major train.
103+
104+
When the user asks you to inspect history and decide what to port, compare the target release branch to the source branch and inspect likely candidates:
105+
106+
- `git log --oneline --reverse origin/release/7.2.x..origin/main`
107+
- `git show --stat --patch <candidate>`
108+
- `git cherry -v origin/release/7.2.x <candidate>` to notice already-applied equivalent changes
109+
110+
Do not rely on commit messages alone. For security or vulnerability-driven releases, inspect the remediation sequence so prerequisite fixes are not missed:
111+
112+
- Review nearby commits, parent/child relationships, and file-level dependencies around the obvious fix.
113+
- Treat toolchain, runtime, base-image, dependency-manifest, lockfile, scanner-configuration, and build/release-definition changes as possible prerequisite remediation, even if their commit messages are generic.
114+
- If a later vulnerability fix was made on top of an adjacent prerequisite change, include the prerequisite unless it is clearly unrelated or too risky and the user confirms excluding it.
115+
- If a scanner or release validation is the driver, check whether all changes needed to make that validation pass on the source branch are represented on the release branch, not just commits whose messages mention the scanner, vulnerability, or CVE.
116+
- Before finalizing candidate selection, summarize any excluded adjacent prerequisite commits and why they are excluded.
117+
118+
## Tagging rules
119+
120+
- Always tag on the release branch.
121+
- Confirm the tag name before creating it.
122+
- Prefer the repository's existing tag format. Inspect existing tags if unsure.
123+
- Verify the checked-out branch before tagging with `git branch --show-current`.
124+
- After tagging, show the created tag and the commit it points to.
125+
- This repository uses signed annotated release tags with messages like `Release v7.2.2`: `git tag -s 7.2.2 -m "Release v7.2.2"`.
126+
- Create tags locally first unless the user explicitly asks to push as part of the release. Push only after explicit user approval or when the release process requires it and the user has confirmed.
127+
128+
## Safety rules
129+
130+
- Never force-push release branches or tags unless the user explicitly authorizes it.
131+
- Never tag with a dirty working tree.
132+
- Never continue after failed tests, failed Trivy checks, or unresolved cherry-pick conflicts without user confirmation.
133+
- Summarize every mutation: branch creation, cherry-picks, version changes, commits, pushes, and tags.
134+
135+
## Local-only release summary
136+
137+
When local release artifacts are ready, report:
138+
139+
- Versions created and target branches.
140+
- Cherry-picked source commits and resulting branch-tip commits.
141+
- Tag names, tag targets, and whether tags are annotated/signed.
142+
- Validation commands and outcomes.
143+
- Ahead counts versus origin, for example `git rev-list --left-right --count origin/release/7.2.x...release/7.2.x`.
144+
- That no pushes were performed, unless pushes were explicitly requested.

0 commit comments

Comments
 (0)