.claude/skills/create-runbook/SKILL.md
Use when the user wants to create a new runbook, write agent instructions for a repeatable task, or says "create a runbook for X", "write a runbook", "new runbook". Also triggers on "make this into a runbook" or converting an existing skill into a runbook.
npx skillsauth add ahrav/gossip-rs create-runbookInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Create runbooks that autonomous agents can execute via run-runbook.sh and Jetty.
A runbook is a self-correcting instruction document for an autonomous agent. It differs from a skill (one-shot reference) by encoding evaluation criteria and bounded iteration — the agent judges its own output, improves the weakest dimension, and re-judges, within guardrails you define.
Write for a competent new hire who must run your pipeline while you are on vacation. Enough detail for failure recovery, enough latitude for adaptation.
If the user does not specify what the runbook automates, ask before proceeding — you cannot write the Objective or domain steps without knowing the task.
digraph create_runbook {
"User specifies task?" -> "Determine scope" [label="yes"];
"User specifies task?" -> "Ask what task to automate" [label="no"];
"Ask what task to automate" -> "Determine scope";
"Determine scope" -> "PR-scoped or branch-scoped?";
"PR-scoped or branch-scoped?" -> "Include {{pr_number}} param" [label="PR"];
"PR-scoped or branch-scoped?" -> "Omit {{pr_number}} param" [label="branch"];
"Include {{pr_number}} param" -> "Write sections in order";
"Omit {{pr_number}} param" -> "Write sections in order";
"Write sections in order" -> "Validate template vars";
"Validate template vars" -> "Dry-run mental walkthrough";
"Dry-run mental walkthrough" -> "Write to runbooks/<name>.md";
}
run-runbook.sh injects exactly these variables — use no others:
| Variable | Syntax in runbook | Injected from |
|----------|-------------------|---------------|
| Repository | {{repository}} | runbook-params.json .repository |
| PR number | {{pr_number}} | runbook-params.json .pr_number |
| Base branch | {{base_branch}} | runbook-params.json .base_branch |
| GitHub token | ${GITHUB_TOKEN} | runbook-params.json .GITHUB_TOKEN |
| Review branch | {{review_branch}} | runbook-params.json .review_branch |
| Cargo home | ${CARGO_HOME:-~/.cargo} | runbook-params.json .CARGO_HOME |
{{var}} placeholders are substituted by run-runbook.sh before the runbook
executes. ${VAR} entries use normal shell expansion at runtime, so reserve
them for injected environment variables such as ${GITHUB_TOKEN} and
${CARGO_HOME:-~/.cargo} or for shell-local variables the runbook defines
earlier, such as ${BEFORE} in a generated PR body.
If you need additional parameters, add them to both files:
runbook-params.json — add a new key (e.g., "target_crate": "gossip-stdx")run-runbook.sh — add a jq -r extraction line and a ${runbook//\{\{new_var\}\}/$var} substitutionDo not invent ad-hoc template syntax without updating the runner.
| Type | When | Uses {{pr_number}}? | Examples |
|------|------|-----------------------|----------|
| PR-scoped | Reviews, responds to comments, audits a PR | Yes | pr-comment-response, security-reviewer |
| Branch-scoped | Audits, refactors, or generates artifacts from a branch | No | dedup-audit, doc-rigor |
Write every section in this exact order, separated by --- horizontal rules.
# <Name> — Agent Runbook
Second person. Numbered high-level steps. Optional bold Core principle.
You are given a Rust workspace repository. Your job is to:
1. Clone the repo and check out the target
2. <domain-specific analysis>
3. <domain-specific changes>
4. Verify all compiler checks pass
5. Open a PR / post results
**Core principle**: <one-sentence guiding philosophy>
Table of files under /app/results/. Always include verification.json.
Always include the incremental-write callout:
**CRITICAL: Write output files INCREMENTALLY, not at the end.**
- Create `/app/results/` and write initial skeleton files in Step 1
- Update after EACH major step
- This ensures partial results are captured even if the run times out
Table with columns Outcome and Verification. Every outcome must be
mechanically verifiable (exit code, file existence, count match).
Always include the four cargo gates:
| Outcome | Verification |
|---------|-------------|
| cargo fmt passes | Exit code 0 |
| cargo clippy passes | Exit code 0 |
| cargo nextest run passes | Exit code 0 |
| cargo doc passes | Exit code 0 |
List template variables with descriptions. Add ### Required Secrets
subsection with scope table.
Use the standard setup block — it is identical across all runbooks:
gh auth login --with-token <<< "${GITHUB_TOKEN}"
gh auth status
gh repo clone {{repository}} /workspace/gossip-rs
cd /workspace/gossip-rs
git checkout {{base_branch}}
git pull origin {{base_branch}}
git log --oneline -5
sudo apt-get update
sudo apt-get install -y libboost-dev protobuf-compiler
rustup toolchain install 1.93 --profile minimal --component rustfmt,clippy
rustup default 1.93
curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
mkdir -p /app/results
# Write skeleton output files here
cargo check --all-features
For PR-scoped runbooks, replace the checkout/pull sequence with:
gh pr checkout {{pr_number}}
git log --oneline -5
Add any domain-specific tool installs (npm packages, cargo tools) after the standard block.
Structure domain steps with:
## Step N: Title)### Na: Sub-step Title)cargo fmt --all
cargo check --all-features
cargo clippy --all-targets --all-features -- -D warnings
cargo nextest run --workspace --features test-support,perf-stats \
--exclude gossip-findings-postgres \
--exclude gossip-done-ledger-postgres \
--exclude gossip-coordination-etcd
Retry policy: "fix and re-run, iterate up to 3 times."
Branch naming: <task-name>/$(date +%Y-%m-%d)
PR body: use cat <<EOF (not <<'EOF') so shell variables expand.
Include before/after metrics table.
Standard polling pattern — 30s intervals, 40 iterations, break on FAILURE
or all-SUCCESS. On failure: gh run view <id> --log-failed, fix, push, re-poll.
Output file writes should happen incrementally throughout the runbook (skeleton in Step 1, updates after each step). The final write step consolidates and fills any remaining gaps.
Never use placeholder templates with "replace later" notes. Agents forget. Write actual data inline using shell variables captured during earlier steps.
Two parts:
- [ ] markdown items matching every required outcomeFooter (verbatim):
**If ANY item fails, go back and fix it. Do NOT finish until all items pass.**
Bulleted list. Each tip: bold imperative sentence. Explanation with concrete examples. Tips accumulate over time as agent failures reveal lessons — add to them after observing runs.
Run this mental checklist before writing the runbook file:
| Check | How to verify |
|-------|---------------|
| Runner-injected placeholders follow the compatibility contract | grep for {{ — only the supported {{...}} placeholders appear; confirm ${...} uses are either documented runner env vars or shell variables defined earlier |
| Objective gives full scope in <30 seconds | Read it cold — would a new agent know what to do? |
| Every output file has a skeleton write in Step 1 | Timeout at minute 5 still produces partial results |
| No "replace placeholder" instructions | Shell vars expand inline; no deferred substitution |
| Verification script covers every required outcome | 1:1 match between REQUIRED OUTCOMES table and script |
| Checklist covers every required outcome | 1:1 match between REQUIRED OUTCOMES table and checklist |
| Comment policy compliance | No tracking IDs, PR refs, or temporal narration |
| Domain tools installed in Step 1 | npm install, cargo install before domain steps |
| Mistake | Fix |
|---------|-----|
| Inventing template variables beyond the 6 supported | Add to runbook-params.json and run-runbook.sh first, or use env vars |
| Using <<'EOF' for PR body (suppresses variable expansion) | Use <<EOF so ${BEFORE} etc. expand |
| Writing output files only at the end | Skeleton in Step 1, update after each step |
| Placeholder JSON with "fill in later" | Capture data in shell vars, write inline with cat <<EOF |
| Missing npm install for tools like jscpd | Install all external tools in Step 1 |
| No retry bound on verification failures | Always cap: "iterate up to 3 times" |
| Forgetting the CI wait loop | Every PR-creating runbook needs the polling block |
| No --exclude on cargo nextest run | Always exclude postgres/etcd crates (need external services) |
development
Deep first-principles code explanation that builds real understanding through phased walkthroughs with diagrams. Covers algorithms, data structures, memory layout, concurrency patterns, and performance tricks — especially for systems code in Rust. Use whenever the user asks to explain, walk through, break down, deep dive into, or understand code. Trigger on "how does this work", "what's happening here", "teach me about this", "why is it done this way", or when the user references a file with @ and wants to understand it. Proactively use when examining code involving lock-free algorithms, atomics/CAS, memory ordering,
development
Use when creating implementation-ready beads tasks that need testing strategy, optimal implementation approach, and documentation requirements baked in — composes /create-task with parallel enrichment agents that analyze the codebase and produce concrete test specifications, algorithm/data-structure guidance, and doc quality standards so implementing agents don't need to re-research
development
--- name: autoresearch description: Autonomous Goal-directed Iteration. Apply Karpathy's autoresearch principles to ANY task. Loops autonomously — modify, verify, keep/discard, repeat. Supports bounded iteration via Iterations: N inline config. version: 1.9.11 --- # Claude Autoresearch — Autonomous Goal-directed Iteration Inspired by [Karpathy's autoresearch](https://github.com/karpathy/autoresearch). Applies constraint-driven autonomous iteration to ANY work — not just ML research. **Core id
development
Use when implementing a new feature and assessing coverage gaps, during periodic test hygiene, when test suites feel bloated, or before merging code that changes coordination or hot paths. Two-phase assess-then-improve testing pipeline.