/gavel-skills:gavel-runnerfrom gavel-skills
Run gavel test and lint, focus on a subset, re-run only failures (defaults to .gavel/last.json), filter noise with baselines, and pull JSON/markdown results from finished or live runs
Ships in gavel-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Drive gavel for the everyday test + lint loop: run a subset, iterate on failures, suppress known noise with baselines, pull JSON/markdown out of a finished run, and attach to a live run via the UI server's HTTP/SSE API.
Prefer gavel test / gavel lint over raw go test / ginkgo / vitest / golangci-lint / make test: gavel auto-detects every framework and linter present, captures structured JSON, and layers on re-run-failures, baselines, and caching. gavel test --help and gavel lint --help are the source of truth for flags — this skill is the when/why and the recipes.
For writing fixture-style markdown tests, defer to the gavel-fixture-tester skill; for PRs, CI status, and commits, see gavel-git; for the TODO/agent loop, see gavel-todos.
.gavel.yaml, a .gavel/ directory, or a make target invokes gavel).| Goal | Command |
|---|---|
| All tests + lint | gavel test --lint |
| Only changed packages | gavel test --changed |
| Only previously-failed | gavel test --failed (uses .gavel/last.json) |
| Suppress baseline noise | gavel test --baseline baseline.json |
| Save JSON + markdown | gavel test --format "json=.tmp/g.json,markdown=.tmp/g.md" |
| PR-comment summary | gavel summary --input results.json --output summary.md |
| Lint only | gavel lint |
Three orthogonal mechanisms — pick the one that matches the user's intent:
By path — positional args. Recursive by default:
gavel test ./pkg/foo ./pkg/bar
By change — diff-based filtering:
gavel test --changed # vs origin/main
gavel test --since v1.2.0 # since merge-base with this ref
By cache — skip packages whose content fingerprint matches the last passing run:
gavel test --cache
By framework — restrict execution to one or more frameworks:
gavel test --framework go,ginkgo
By name — use either native Go focus spelling after --; gavel maps the
pattern to every focus-capable framework and skips unsupported frameworks:
gavel test ./pkg/foo -- -run "MyTest" # maps to go test -run / ginkgo --focus
gavel test ./pkg/foo -- --focus "MyTest" # equivalent spelling
Raw runner args — select exactly one framework first:
gavel test ginkgo ./pkg/foo -- --label-filter "smoke"
gavel test --framework vitest ./pkg/web -- --testNamePattern "MyTest"
--failed re-runs only the tests / linters that failed in a previous run. Pass it without a value to default to .gavel/last.json:
gavel test --failed # uses .gavel/last.json
gavel test --failed path/to/results.json # explicit
gavel lint --failed # same on lint
If .gavel/last.json does not exist, gavel errors loudly — run gavel test once first. Don't fall back silently to a full run.
--baseline <snapshot.json> reports only what is new vs the baseline. Lint baseline keys are line-insensitive (linter+file+rule) so they survive line-shifting edits.
# Capture on main:
git checkout main && gavel test --lint --format "json=baseline.json"
# Run on the branch with main's noise suppressed:
git checkout my-branch && gavel test --lint --baseline baseline.json
.gavel/ directoryGavel persists every run here so the next invocation can compare or re-run.
| File | Shape | Purpose |
|---|---|---|
.gavel/sha-<commitsha>[-<uncommitted-hash>].json | Full snapshot | One per run; the actual data |
.gavel/last.json | Pointer ({path, sha, uncommitted}) | Most recent run |
.gavel/<branch>.json | Pointer | Most recent run per branch |
.gavel/<linter-binary> | Binary | Auto-installed linters (e.g. golangci-lint) when config calls for them |
.gavel/ssh_host_key, .gavel/repos/ | — | Only present when gavel ssh serve has been used |
The pointer files are pointers, not snapshots — they reference a path inside .gavel/. To read the snapshot you have to follow the path field.
Field names below come straight from the Go structs. When in doubt, read the source — these are the canonical definitions:
Test record — testrunner/parsers/types.go (type Test struct). Fields: name, package, package_path, framework, failed, passed, skipped, duration, message, file, line, cached, timed_out, …Snapshot envelope — testrunner/ui/snapshot.go (type Snapshot struct). Holds the flat tests array plus lint results and bench comparison.LinterResult and Violation — linters/ package. Keyed by linter, file, rule.Pointer — snapshots/snapshots.go (type Pointer struct): {path, sha, uncommitted}.jq recipes against results.json# All failed tests, grouped by package:
jq -r '.tests[] | select(.failed) | "\(.package_path)\t\(.name)"' results.json | sort | uniq -c
# Counts by framework:
jq -r '.tests[] | select(.failed) | .framework' results.json | sort | uniq -c
# Slowest 10 tests:
jq '[.tests[] | {name, package_path, duration}] | sort_by(-.duration) | .[:10]' results.json
# Failure messages, package + first line of message:
jq -r '.tests[] | select(.failed) | "\(.package_path) :: \(.name)\n \(.message | split("\n")[0])"' results.json
# Lint violation counts per linter:
jq -r '.lint_results[]? | "\(.linter)\t\(.violations | length)"' results.json
# CI gate: exit non-zero if anything failed.
test "$(jq '[.tests[] | select(.failed)] | length' results.json)" = 0
.gavel/last.json (two-step)# Resolve the pointer, then jq the snapshot it points at:
SNAP="$(jq -r '.path' .gavel/last.json)"
jq '.tests[] | select(.failed) | .name' "$SNAP"
There is no gavel watch. The live workflow is gavel test --ui, which starts an HTTP server with a JSON snapshot endpoint and an SSE stream. The port is printed on startup.
Endpoints (from testrunner/ui/handler.go):
| Method | Path | Use |
|---|---|---|
| GET | /api/tests | Current snapshot as JSON (same shape as --format json) |
| GET | /api/tests/stream | SSE stream of live test updates |
| GET | /query/<run id>/... | The run's trace store (process_tree, process_samples, stacks, fixture traces); POST /query/<run id>/api/v1/sessions/<status.traces.sessions.stacks>/checkpoint with {key or pid, transport?, reason?} dumps a process's stacks (inprocess for gavel, native for any process, sigquit — which kills it — for a Go test binary); the same on sessions.samples with {key} reads its facets (open files, sockets, ports, connections; armed under --ui/--process-facets) |
| POST | /api/rerun | Trigger a rerun with filters (test names / frameworks) |
| GET | /api/rerun/stream | SSE stream of rerun updates |
| POST | /api/stop | Stop the in-flight run |
| GET | /api/benchmarks | Bench comparison JSON |
| GET | /?format=json|html|markdown | Export the current report |
Recipes:
# Failed tests in a live run:
curl -s http://localhost:$PORT/api/tests | jq '.tests[] | select(.failed) | {pkg: .package_path, name}'
# Stream live updates:
curl -Ns http://localhost:$PORT/api/tests/stream | grep --line-buffered '^data:'
# Trigger a rerun of two specific tests:
curl -X POST http://localhost:$PORT/api/rerun \
-H 'Content-Type: application/json' \
-d '{"tests":["TestFoo","TestBar"]}'
Replay a finished run (no live execution): gavel ui serve run.json exposes the same endpoints against a saved snapshot.
Multiple formats in one invocation, one path per format:
gavel test --lint --format "json=.tmp/g.json,html=.tmp/g.html,markdown=.tmp/g.md"
For a compact PR-comment-shaped markdown (counts + first few failures only):
gavel summary --input .tmp/g.json --output .tmp/summary.md
Use the JSON for full failure detail; the markdown is sized for PR comments.
Gavel layers four wall-clock deadlines on gavel test. Each kills its subprocess when it fires (no graceful drain).
| Flag | Default | Scope |
|---|---|---|
--timeout | 20m (or test.timeout) | Global, for the entire gavel test run (test + lint). On hit, diagnostics are captured (logged, and gavel's goroutines checkpointed into the run's stacks with reason timeout; also every 10m as periodic) and every subprocess is killed. |
--test-timeout | none (or test.testTimeout) | Per-test-package subprocess (one go-test/ginkgo/vitest invocation). Before the kill, each running Go test binary is SIGQUIT and given up to 3s to print its goroutines: the dump lands on the timed-out test's attempt (stack_trace, goroutine_count) and, with --ui/--diagnostics, as stacks records on the binary's process key (reason: package-timeout:<pkg>); goroutine_count is that checkpoint's record count. |
--lint-timeout | 5m | Per-linter subprocess when --lint is set. |
gavel lint --timeout | 5m | Per-linter when running gavel lint standalone. Duration string (30s, 2m, …). |
The stacks checkpoints need a process capture: pass --diagnostics (no browser) or --ui; without one the log says not checkpointed. --process-facets (needs one of those) also records open files, sockets, ports and environment. Details: site/content/docs/traces-profiling-benchmarks.mdx.
Two more deadlines apply only to the detached UI (gavel test --ui --detach):
--auto-stop (default 30m) — hard wall-clock for the detached UI child.--idle-timeout (default 5m) — exit the detached UI after this long with no HTTP requests.Tuning recipes:
# Long integration suite — bump global and per-test caps:
gavel test --timeout 30m --test-timeout 15m ./pkg/integration
# Stricter per-linter cap:
gavel lint --timeout 2m
When a global timeout fires, gavel dumps goroutines and a resource snapshot into .gavel/. Read those before bumping the timeout — the test that ran out of time is usually the bug, not the deadline.
# Run everything once, save artifacts:
gavel test --lint --format "json=.tmp/gavel.json,markdown=.tmp/gavel.md"
# Iterate on failures:
gavel test --failed
# Only NEW lint violations on this branch:
gavel lint --baseline .gavel/<main-pointer>.json
# Trigger a rerun in a live UI session:
curl -X POST http://localhost:$PORT/api/rerun -d '{"tests":["TestFoo"]}'
# CI gate on failed-test count:
jq '[.tests[] | select(.failed)] | length' results.json
.tmp/ (not /tmp) for scratch artifacts in this repo.gavel watch. Reach for --ui (live SSE) or --changed (rerun-on-edit via your editor) instead.--failed errors loudly when .gavel/last.json is missing — don't fall back silently to a full run; either pass an explicit baseline or run gavel test once first..gavel/last.json is a pointer, not the snapshot. Follow .path before parsing test data.linter+file+rule only — so they survive line-shifting edits but won't distinguish two violations of the same rule in the same file.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
6 skills in this plugin
/gavel-ci-migratorMigrate a repo's GitHub Actions lint and test workflows onto the flanksource/gavel composite action — discover existing golangci-lint / go test / make lint|test jobs, ask the user per-workflow whether to replace, add alongside, or skip, rewrite YAML with the right permissions and checkout depth, and verify with actionlint without auto-committing/gavel-fixture-testerCreate and run Gavel fixture-based tests and TODO executable definitions of done using Markdown command blocks, tables, test/lint steps, acceptance checklists, and CEL assertions. Use when authoring standalone fixtures or persisted TODO Verification content./gavel-gitUse gavel instead of gh/git for pull requests, CI status, and commits — check a PR's checks with gavel pr status, open PRs with AI-generated content, and commit with gavel commitnpx claudepluginhub flanksource/gavel --plugin gavel-skills