Skip to content

The snap-bench skill

snap-bench is a Claude Code skill for this repository, in .claude/skills/snap-bench/, with shortcuts for plan, run and report in .claude/commands/snap-bench/. How to set it up and run it is in Run benchmarks with Claude Code. This page covers how it works: what it learns about the repository, and what each command will and won't do. SKILL.md is the source of truth for the exact steps.

Command Steps in What it does
/snap-bench plan <what to measure>, or /snap-bench:plan plan.md Writes a new plan in resources/plans/ from your description, asks what it doesn't settle (targets, clips, pacing, concurrency levels), sizes it, and checks it with --dry-run. It never runs the plan.
/snap-bench run <plan> [<plan> ...], or /snap-bench:run run.md Checks each plan with --dry-run, stops if a file the run needs is untracked (make push-hosts sends tracked files only), pushes the code, runs the plans one after another on their hosts and waits for each. Then it analyses only those runs into a new folder and writes the report there.
/snap-bench report [folder] [run IDs], or /snap-bench:report report.md Writes a short Markdown report from an analysis, analysing run directories first if it's given those.
/snap-bench document [new \| all \| <paths>] SKILL.md Brings the docs in line with the code and with the documentation standards.
/snap-bench ship [notes] SKILL.md Takes the work in your checkout to the default branch: updates the docs, runs the checks, commits in logical groups, merges and pushes.

The skill runs only when you type a command; Claude won't start it on its own.

What it knows about the repository

Nothing is hardcoded. ship and document start by running .claude/skills/snap-bench/discover.sh, a read-only script that asks Git. It reports:

  • the default branch (the remote's HEAD) and the current branch,
  • how the remote is reached (plain SSH, a hosting service or a local path), with its host and path,
  • on an SSH remote: whether it's bare, which branch it has checked out, its receive.* rules, the group that owns it, and whether you're in that group,
  • Terraform state files tracked in Git,
  • the paths .gitattributes marks export-ignore, which a deliverable built with git archive leaves out,
  • every make target with its ## help text, read from the Makefile and any included *.mk, tagged shipped, or team-only when it comes from a file Git marks export-ignore,
  • every page in the docs nav with its section and label, read from mkdocs.yml, plus docs files that aren't in the nav.

The commands then act on what it found:

  • Pushing to a checked-out default branch: checks the host's copy has no uncommitted changes first.
  • receive.denyDeletes set on the remote: deletes merged branches on the host, not over Git.
  • Pushes fail because of the group: names the group you're missing.
  • The remote is GitHub or GitLab: stops after pushing the branch and suggests a pull-request workflow.
  • Checks: runs only make targets that exist, and says when one it expects is missing.
  • Docs: finds each kind of content's home by its nav label, so moving or renaming a page doesn't break it. document also cross-checks that every shipped make target is on the Make targets page and that no page is orphaned outside the nav.
  • Deliverable steps: run only where the repository has a dist target and a .dist-denylist file.

You can run the script yourself to see what the skill will see:

bash .claude/skills/snap-bench/discover.sh

ship

On a plain Git remote, with no pull requests, ship ends with your work merged into the default branch and pushed. In order, it:

  1. Lists every changed file and says whose it is. It asks about anything you made yourself, anything of unclear origin, and always about possible secrets, *.local.env files, terraform/terraform.tfstate and tool folders.
  2. Runs /snap-bench document on the session's changes.
  3. Runs make lint, make test and make docs-build, and fixes what the session caused. Failures in files the session didn't touch are reported as pre-existing, not fixed.
  4. Shows a commit plan and commits on a feature branch, never on the default branch.
  5. Where the repository has a dist target and a .dist-denylist, builds the deliverable as a leak check: the deny-list scan and the docs build inside it must pass. It deletes the tarball afterwards.
  6. Fetches, merges the default branch into the feature branch if it has moved, and pushes the branch.
  7. Asks before touching the default branch, unless you said to merge when you ran it. If the remote has that branch checked out, it first checks the host's copy is clean, because pushing updates the files there. It then fast-forwards the branch, pushes it, and confirms the new commit landed locally and on the remote.
  8. Reports what was merged, the check results, and anything waiting on you.

On GitHub or GitLab it stops after step 6, for a pull request.

It won't:

  • force-push,
  • delete branches, unless you ask; where the remote refuses deletions over Git, it deletes them on the host,
  • change permissions or Git settings on the remote host; it gives you the command,
  • commit Terraform state without asking.

If SSH reaches the remote through Session Manager, ship needs a live AWS session. Your account on the remote host must be in the group that owns the repository (git-dir-group= in the discovery output).

document

Updates the docs so they describe the code as it is, to the documentation standards. The scope:

  • No argument: the session's changes, plus everything on the branch that isn't on the default branch.
  • new: only the branch's unmerged changes: commits that aren't on the default branch yet, plus uncommitted and untracked files. Unlike the default, it ignores the session's history.
  • all: checks every page against the code, scripts, Terraform and Makefile.
  • Paths: only those pages.

The standards it applies, in brief. The full list, and a table of which page owns which kind of content, are in SKILL.md.

  • Docs match the code. Every claim it touches is checked against the source, or against a host where that's the only source. Observations carry their date, and anything it can't verify goes in Limitations.
  • Sentence case for page titles, headings, nav entries and admonition titles (Writing the docs).
  • A make equivalent next to every command: a "Quick install" block on install pages, and "Or with make" in runbooks. Makefile changes also update Make targets and the Developer tools table.
  • Nothing account-specific in shipped pages. It uses placeholders, Terraform variables or *.local.env files. Where the repository has a .dist-denylist, it adds new kinds of internal value to it.
  • Team-only content stays out of shipped pages. Where the repository keeps internal pages (docs/internal/, left out of the nav), shipped pages don't link to them.
  • One home per fact. Other pages link to it instead of repeating it.
  • New tools, external services and dependencies go on Developer tools, Network dependencies and Open source software acknowledgements. Licenses are checked against the actual license files.

It finishes with make docs-build, and the deny-list scan where there is one, and reports each page it changed, what it checked without changing, and stale docs outside its scope that it noticed but left alone.

plan, run and report

The runbook covers what to type and where the output goes. What each will and won't do:

  • plan writes and dry-runs a plan. It asks before replacing an existing plan file, and never runs the plan, pushes code or touches a host.
  • run never stages, commits or pushes to Git; it asks before git add. It never edits a plan or a targets file to make a run work, never reruns a plan or stops a unit on a host without asking, and never reads credential files. Each analysis gets a new folder holding only the runs it ran.
  • report reads the analysis without changing it or the price list, and flags a number that looks wrong rather than fixing it. It never adds runs nobody asked for to an analysis.

Changing the skill

Edit the files in .claude/skills/snap-bench/ (and the shortcuts in .claude/commands/snap-bench/), and commit them like any other change. Keep this page and Run benchmarks with Claude Code in step: when a command's behaviour changes, update them in the same commit.