agent-skills
Copilot instructions2 starsChanged 2 months agoMITView on GitHub
Keep CLAUDE.md in sync: whenever you add, update, or remove a rule in this file, apply the equivalent change to the appropriate CLAUDE.md — the root CLAUDE.md for repo-wide rules, or a subdirectory CLAUDE.md (e.g. skills/CLAUDE.md, evals/CLAUDE.md, tests/CLAUDE.md, specs/CLAUDE.md) for context-specific rules (skill authoring, eval benchmarks, test conventions, spec editing). Claude Code auto-loads subdirectory CLAUDE.md files when working in those directories; Copilot has only one instructions file, so all rules — including those whose canonical home is a subdirectory CLAUDE.md…
- Deletes or force-pushes
- Commits and pushes
In this repository12 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- evals/CLAUDE.mdCLAUDE.md
- skills/CLAUDE.mdCLAUDE.md
- specs/CLAUDE.mdCLAUDE.md
- tests/CLAUDE.mdCLAUDE.md
- js-depsSkill
- learnSkill
- peer-reviewSkill
- pr-commentsSkill
- pr-human-guideSkill
- ship-itSkill
- uv-depsSkill
The file
Show its rules and text
We split this copilot-instructions.md into the rules it gives an agent
39 rules. About 0 are common, 13 are distinctive, and 26 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈13
Distinctive · estimate
This author's own choices. Worth a look.
26
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 11
Keep instructions assistant-neutral unless a tool or platform detail is inherently assistant-specific.
- Distinctive: line 14
When substantially modifying a skill, update its README.md entry and notes.
- Distinctive: line 27
Use phrase anchors, not hardcoded line numbers, in specs for files that may change during the same task.
- Very specific: line 28
If a spec has both plan.md and tasks.md, apply the corresponding fix to both files in the same pass.
- Very specific: line 30
When working through specs/*/tasks.md, mark each checkbox complete immediately after completing that item.
- Distinctive: line 31
After editing spec files, re-read all modified spec files before finishing.
- Very specific: line 40
Every skill with evals should keep evals/<skill-name>/benchmark.json in sync with the latest results.
- Very specific: line 45
Keep run_summary.delta.pass_rate at 2-decimal precision.
- Very specific: line 47
When adding new evals or re-running existing evals, run them in the same task and update benchmark artifacts immediately — also update …
- Very specific: line 49
When renaming an eval's name field in evals.json, also update eval_name in all matching benchmark.json run entries, any prose mentions in …
- Very specific: line 50
When adding a new skill to README.md, add an Eval cost note sourced from the skill's benchmark doc.
- Very specific: line 51
If reviewer feedback suggests benchmark values, recompute from the actual runs array instead of copying the suggestion.
- Very specific: line 53
When updating pass_rate, passed, failed, or total in a run entry, also scan both the run-level notes array and the top-level notes array …
- Very specific: line 55
Place the top-level notes array at the root of benchmark.json, not inside metadata — between the closing } of metadata and the opening [ of …
- Very specific: line 56
When renaming action labels or vocabulary in SKILL.md, also search all CLAUDE.md files (CLAUDE.md, evals/CLAUDE.md, skills/CLAUDE.md) for …
- Very specific: line 62
When a benchmark.json run entry has null result fields, the corresponding benchmark.md table row must show N/A | — | — in the Pass rate, …
- Distinctive: line 74
After modifying skills or skill reference files, run:
- Very specific: line 80
Consider whether tests under tests/<skill-name>/ need to be added or updated for behavior changes.
- Very specific: line 82
When adding a new skill with tests, create a corresponding .github/workflows/test-<skill-name>-skill.yml that runs only on path changes to …
- Very specific: line 86
New subdirectory CLAUDE.md format: Use # <Name> as the first heading and make the first body line a brief auto-load note for that …
- Very specific: line 88
If cspell flags a legitimate repo term, add it to cspell.config.yaml immediately.
- Very specific: line 89
If a word is no longer used, remove it from cspell.config.yaml after confirming with rg -w <word>.
- Very specific: line 90
Keep the words list in cspell.config.yaml alphabetically sorted — insert new entries in the correct alphabetical position, not at the end …
- Very specific: line 92
Do not pipe npx cspell through grep -v — if the npm cache has an EPERM error, filtering with grep -v "npm error" silently swallows the …
- Distinctive: line 116
Never commit directly to main.
- Distinctive: line 118
Do not rewrite history on a PR that already has review comments.
- Very specific: line 123
After pushing follow-up commits or reverts to an existing PR branch, compare git log origin/main..HEAD --oneline against the PR title/body …
- Distinctive: line 128
After implementing or fully addressing a PR review comment, resolve the thread through the GitHub GraphQL API only when no further reviewer …
- Very specific: line 141
Do not hardcode /tmp/; use mktemp, $TMPDIR, or ${TMPDIR:-/private/tmp}.
- Very specific: line 148
If git commit fails because of GPG/keyring access, use --no-gpg-sign only as a fallback after the failure.
- Very specific: line 158
When passing shell variables into jq, use jq --arg name "$value" instead of shell string interpolation inside the filter.
- Distinctive: line 190
Bash auto-backgrounds long-running commands: don't rerun — check the prior command's output or use your environment's wait/follow mechanism …
- Very specific: line 191
GitHub Actions
workflow_dispatchinputs: never use ${{ inputs.field }} directly in run: (injection risk) — pass via env: VAR: ${{ … - Distinctive: line 198
When the user's request matches a skill's trigger phrases, read the skill file and follow its workflow exactly.
- Distinctive: line 211
Keep README / CLAUDE documentation in sync when skill changes are substantial.
- Distinctive: line 213
When listing exit conditions for a workflow loop, state that they are the only valid exit conditions and explicitly forbid subjective early …
- Very specific: line 218
Repo-specific paths need portability notes: When a skill step references a layout-specific path (e.g., skills/*/SKILL.md), add (adjust …
- Very specific: line 228
Do not write to ~/.claude/projects/.../memory/ for this project.
- Distinctive: line 229
Write timeless rules, not session history — do not reference specific PR numbers, dates, or session details in config rules.
≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Copilot Instructions
Keep CLAUDE.md in sync: whenever you add, update, or remove a rule in this file, apply the equivalent change to the appropriate CLAUDE.md — the root CLAUDE.md for repo-wide rules, or a subdirectory CLAUDE.md (e.g. skills/CLAUDE.md, evals/CLAUDE.md, tests/CLAUDE.md, specs/CLAUDE.md) for context-specific rules (skill authoring, eval benchmarks, test conventions, spec editing). Claude Code auto-loads subdirectory CLAUDE.md files when working in those directories; Copilot has only one instructions file, so all rules — including those whose canonical home is a subdirectory CLAUDE.md — must also appear here; a rule dropped from a CLAUDE.md because a subdirectory CLAUDE.md covers it stays here. The two assistants (Copilot vs. Claude Code) should encode the same project conventions. When running /learn in this project, always update both the appropriate CLAUDE.md and .github/copilot-instructions.md without asking which to update. The instruction-sync CI check enforces this pairing for any CLAUDE.md path in the repo — it does not compare the two files' content.
Project Overview
Evals belong under evals/ at the repo root, not inside skill directories — they are development artifacts and should not be bundled when a skill is distributed.
Core Editing Rules
- Keep instructions assistant-neutral unless a tool or platform detail is inherently assistant-specific.
- Skill description has a 500-character hard limit — the
descriptionfield in SKILL.md frontmatter is capped at 500 characters by the skills runtime. Keep descriptions concise; count characters before finalizing. - Preserve the existing workflow style in
SKILL.md: numbered process sections, executable bash blocks, tables where useful, and examples where useful. - When substantially modifying a skill, update its
README.mdentry and notes. - Bump
metadata.versionon everySKILL.mdchange or reference-file change that affects the skill. - On an active PR branch, re-run the check below before committing any
SKILL.mdchange — not just when you intend to bump — to confirm no bump already exists relative toorigin/main:
git fetch origin && git diff origin/main -- skills/<name>/SKILL.md | rg '^\+ version:'- Only bump once per PR. Follow-up reviewer-fix commits should not add another bump. Each reviewer-fix commit should touch only the files needed to address the feedback. This limit applies to the PR as a whole — a PR touching SKILL.md plus multiple reference files still gets exactly one version increment total. Do not add a new bump for each changed reference file. Exception: do not bump the version when a skill is first introduced — a new skill's initial version (e.g.
"0.1") is set at creation time; the "once per PR" bump applies only to subsequent changes. Checkgit diff --name-status origin/main...HEAD -- skills/<name>/SKILL.md:A(added) means first introduction in this PR;M(modified) triggers the bump rule.
Specs
- Spec step numbers drift. Re-verify references like "Step 5" or "Step 13" against the current
SKILL.mdbefore editing spec text. - Use phrase anchors, not hardcoded line numbers, in specs for files that may change during the same task.
- If a spec has both
plan.mdandtasks.md, apply the corresponding fix to both files in the same pass. - Update a spec's embedded copy of a real file (test snippet, verification command) in the same commit as the file — a re-runner follows the spec, not the code.
- When working through
specs/*/tasks.md, mark each checkbox complete immediately after completing that item. - After editing spec files, re-read all modified spec files before finishing.
Planning Workflow
- For any change that warrants a spec (a new skill, or a behavior change to an existing one), use the superpowers skills to plan and create tasks: brainstorm and write the plan with
superpowers:brainstorming/superpowers:writing-plans, capturing it asspecs/<N>-<topic>/plan.md+tasks.md. - Do not start implementing until the user explicitly approves the plan — producing
plan.mdandtasks.mdis not itself approval to implement. Execute the tasks (optionally viasuperpowers:executing-plans/superpowers:subagent-driven-development) only after the user gives the go-ahead.
Evals And Benchmarks
- Every skill with evals should keep
evals/<skill-name>/benchmark.jsonin sync with the latest results. - After updating a benchmark, also update the
Eval Δcolumn inREADME.mdand the±stat values in thebenchmark.mdSummary table — the table mirrorsrun_summaryand is not auto-generated. Also update theEval costbullet in the skill's Skill Notes section inREADME.md— it contains the delta percentage and discriminating eval count and does not auto-update. grading.jsonfiles must include asummaryblock withpassed,failed,total, andpass_rate.- Eval
evidencestrings must be repo-relative — no absolute/Users/...paths inbenchmark.jsonorgrading-*.json. - Use
null, not0or0.0, for unknown token/time measurements in benchmark data (tokens,time_secondsfeedrun_summaryaggregates). Treattool_callsanderrorsas optional per-run metadata: usenullonly when truly unknown, keep0when actually measured. When updating or adding runs, backfill any existingtokens: 0,time_seconds: 0.0,tool_calls: 0, orerrors: 0entries tonullonly when they represent unknown measurements. - Keep
run_summary.delta.pass_rateat 2-decimal precision. run_summary.deltavalues must be computed from exact (unrounded) run-data means, not from the roundedmeanfields. When stored means are rounded, add a sentence tobenchmark.md: "Summary-table Delta values are computed from unrounded means, so they may differ slightly from subtracting the displayed rounded means."- When adding new evals or re-running existing evals, run them in the same task and update benchmark artifacts immediately — also update
metadata.skill_versionandmetadata.evals_run. Exception: for validation-only runs, do not add run entries or bumpmetadata.skill_version. - When changing pass/fail verdicts on existing benchmark expectations, re-run the eval rather than re-grading with hypothetical reasoning — hypothetical re-grades can describe fundamentally different behavior from what was originally observed. The same applies when adding a new assertion to an existing run entry — evidence must come from an observed transcript, not inferred reasoning. Spawn a fresh executor run to get real evidence.
- When renaming an eval's
namefield inevals.json, also updateeval_namein all matchingbenchmark.jsonrun entries, any prose mentions inbenchmark.jsonnotesstrings, and the correspondingbenchmark.mdsection header. - When adding a new skill to
README.md, add anEval costnote sourced from the skill's benchmark doc. - If reviewer feedback suggests benchmark values, recompute from the actual
runsarray instead of copying the suggestion. - A convention inferred from sibling files may be drift — verify a reviewer's "other files do X" against the written rule (
pr-human-guide's benchmark violates theskill_versionrule it seems to demonstrate). - When updating
pass_rate,passed,failed, ortotalin a run entry, also scan both the run-levelnotesarray and the top-levelnotesarray for matching prose counts (e.g. "3/5 (60%)") and update them — numeric fields and prose strings drift independently. - When adding version-scoped notes to
benchmark.json's top-levelnotesarray, also audit older entries that reference the same eval IDs — they can describe behavior removed in an earlier version. Stale semantic descriptions contradict newer entries and mislead reviewers. Update or replace them in the same commit. - Place the top-level
notesarray at the root ofbenchmark.json, not insidemetadata— between the closing}ofmetadataand the opening[ofruns. - When renaming action labels or vocabulary in
SKILL.md, also search all CLAUDE.md files (CLAUDE.md,evals/CLAUDE.md,skills/CLAUDE.md) for hardcoded step references that use the old name — step renames must propagate there just as they do toevals.jsonandbenchmark.json. - Eval assertions must test user-facing output, not internal signals: if a skill uses an internal return value from a subagent (e.g.
NO FINDINGS) and translates it to user-visible text (e.g.'No issues found.'), the assertion must test the user-visible string — not the internal signal. An assertion testing the internal signal will never catch regressions in the translation/presentation layer. - When assertion semantics are inverted (not just renamed), null ALL result fields in the affected
benchmark.jsonruns:pass_rate,passed,failed,time_seconds,tokens,tool_calls, anderrors. The measurement fields still feedrun_summaryaggregates even when pass/fail is null. After nulling, recomputerun_summaryexcluding those runs from all stat calculations, then updatebenchmark.mdSummary table and README Eval Δ. - Fixture-based eval prompts must embed the fixture in the
promptfield, notexpected_output:expected_outputis prose describing the expected grading outcome for the eval runner — it is not readable by the executor. Putting fixture CLI/tool responses inexpected_outputwould confuse the executor about what to output, or cause the grader to treat fixture data as the expected result. - Eval prompts must not name the skill or say "the user has invoked the X skill" — skill-name leakage in the prompt context reaches the baseline agent, causing it to follow the skill's output format without needing the skill. All evals become non-discriminating and the delta collapses to 0%. Write prompts as natural user requests that don't reference the skill by name (e.g. "Can you add a review guide to PR #42?" not "The user has invoked the pr-human-guide skill on PR #42").
- When a run is excluded from both sides of the paired comparison (e.g. contaminated), null all result fields in BOTH the
with_skillandwithout_skillentries — not just the contaminated side. Leaving one side non-null makes the documented paired-eval count inconsistent with what mechanical consumers derive from filtering non-null entries. When nulling result fields, also null thepassedandevidencefields in the run'sexpectationsarray — leaving verdicts set while results are null implies the grading is valid when it is not. - When a benchmark.json run entry has null result fields, the corresponding
benchmark.mdtable row must showN/A | — | —in the Pass rate, Passed, and Failed columns — not the original computed values. - Eval executor subagents must NOT call Claude Code's
Skilltool — bothwith_skillandwithout_skill. Forwith_skill, the executor must follow SKILL.md directly (read it and act); callingSkilldelegates to a fresh sub-instance instead, which is not what's being measured. Forwithout_skill, prohibiting SKILL.md reads alone is insufficient — the agent can still register-and-invoke the skill via theSkilltool, contaminating the baseline. Phrase the agent prompt as: "Do NOT call theSkilltool. Forwith_skill, do the work yourself by reading SKILL.md." Detection signature:TOOLS_USED: Other: Skill (...). - Fence the executor out of
evals/explicitly — a recursivegrep/rgacross the repo can return the eval's ownexpected_outputand assertion text, silently contaminating the run. Scope the executor's searches to the skill directory, and audit each transcript forevals/-touching tool calls before trusting its results. - Per-run
tokensin benchmark.json =input_tokens + output_tokenssummed across assistant turns (matcheslearn/pr-comments/peer-review). Track cache tokens in a separatecache_tokensfield — they bill at 0.1× (reads) and 1.25–2× (creation), and folding them in inflates the headline 50–100× without proportional cost. - Validate expectation key schema after grading:
jq '[.runs[] | .expectations[] | select((. | keys) != ["evidence","passed","text"])] | length'must return0. Graders drift from{text, passed, evidence}despite explicit prompts — common drifts:description/assertioninstead oftext, strayid/nfields. - Use
evals/scripts/extract_subagent_usage.pyto backfill per-run usage from subagent JSONL transcripts — implements thetokens(input + output) /cache_tokens(creation + reads) split and emits per-agent JSON. Don't roll your own parser. - Before committing a new category of artifact in
evals/(transcripts, scratch scripts, intermediate JSON), survey what parallel skills commit —ls evals/*/. If no other skill keeps that artifact, don't be the first. Fix "dangling reference" findings by removing the reference, not committing the file. - All
run_summary.deltavalues are signed strings ("+0.31","+835") — not numbers. Applies topass_rate/time_seconds/tokens/cache_tokens. Storing as numbers breaks consumers that expect the documented schema. - Commit grading json selectively; don't commit raw transcripts. Other skills (
learn/peer-review/ship-it) commit onlyevals.json+benchmark.{json,md}+fixtures/.pr-commentsadds selectivegrading-eval{N}-{config}.jsonfiles only where graders made judgment calls — not the full set. Transcript content goes inline as quotedevidenceinbenchmark.json.
Tests And Validation
- After modifying skills or skill reference files, run:
uv run --with pytest pytest tests/- Consider whether tests under
tests/<skill-name>/need to be added or updated for behavior changes. - Prefer test file basenames that remain unique across
tests/subdirectories to avoid pytest import collisions when directories do not use__init__.py. Skill-prefixing is a recommended collision-avoidance convention (for example,test_prhumanreview_argument_parsing.pyinstead of a generictest_argument_parsing.py), but the key requirement is avoiding duplicate basenames. Recommended pattern:test_<skillshortname>_<topic>.py. - When adding a new skill with tests, create a corresponding
.github/workflows/test-<skill-name>-skill.ymlthat runs only on path changes toskills/<skill-name>/**andtests/<skill-name>/**. Usetest-learn-skill.ymlas the template — it coverspush,pull_request, andworkflow_dispatchtriggers, runsuv run --with pytest pytest tests/<skill-name>/ -v, and uploads fixtures on failure. - A
tests/<skill>/suite is CI-gated only if a corresponding workflow exists (test-<skill>-skill.yml, ortest-<skill>.ymlasuv-depsuses) — localpytestpassing doesn't mean CI ran it. When changing a skill's tests, confirm a workflow actually runs that suite; add one if missing. - Exercising a skill that shells out to a bundled script, from a worktree:
.claude/skills/is gitignored and absent in a fresh worktree — and where it does exist its entries may symlink into the repo's ownskills/tree — so either way the assistant loads the skill from the main checkout and silently runs that copy of the script — your worktree edits are not under test. PointSKILL_DIRat the worktree copy in the same Bash call that invokes the script —SKILL_DIR="$(git rev-parse --show-toplevel)/skills/<skill-name>"on the line above the invocation. Env vars do not survive between Bash tool calls, so anexportin an earlier call is gone by the time the script runs, and the failure is silent: an[ -f "$SCRIPT" ]guard still passes against the main checkout's copy, which exists. When the skill's workflow changed and not just its script,SKILL_DIRis not enough — the assistant still loads the staleSKILL.md; drive the steps manually instead of invoking the skill. - Count markers inside the extracted block, not by whole-file grep — a document whose prose quotes the markers it also contains (a PR describing the marker feature it adds) inflates every whole-body count, so a correct run fails verification.
- New subdirectory CLAUDE.md format: Use
# <Name>as the first heading and make the first body line a brief auto-load note for that directory, following the existing pattern inskills/CLAUDE.mdandevals/CLAUDE.mdrather than requiring one exact sentence. - This repo uses cspell. After editing markdown or instruction files, run
npx cspell <file>on each modified file. - If cspell flags a legitimate repo term, add it to
cspell.config.yamlimmediately. - If a word is no longer used, remove it from
cspell.config.yamlafter confirming withrg -w <word>. - Keep the
wordslist incspell.config.yamlalphabetically sorted — insert new entries in the correct alphabetical position, not at the end of the list. - Adding a singular form to
cspell.config.yamldoes not automatically cover its plural — add both forms explicitly (e.g.,metacharacterandmetacharacters) if both appear in the codebase. - Do not pipe
npx cspellthroughgrep -v— if the npm cache has an EPERM error, filtering withgrep -v "npm error"silently swallows the failure, making it appear as "No matches found" when cspell never ran. - Trust cspell's
Files checked: Nline, not the absence of issues —npx cspellon a path outside the repo's config scope (e.g. branch content copied to a temp dir) printsFiles checked: 0, Issues found: 0and reads as clean. Check the in-repo path instead. - Tests that run
gitin a temp dir must stripGIT_*from the subprocess env — git exportsGIT_DIR/GIT_WORK_TREEto hook subprocesses, overridingcwd=, so it operates on the real repo. Useenv={k: v for k, v in os.environ.items() if not k.startswith("GIT_")}plusGIT_CEILING_DIRECTORIES. Passes under barepytest; only misfires under a hook.
Security scanning
evals/security/ pins per-skill snyk-agent-scan output so CI catches new findings without forcing pre-existing ones to be fixed first. See evals/security/CLAUDE.md for directory rules.
- Refresh the baseline in the same PR as a security-relevant skill change. Run
bash evals/security/scan.sh --update-baselines --confirmand commit the updatedevals/security/<skill>.baseline.json. Drifted baselines silently mask future regressions. scan.sh --update-baselinesrewrites every baseline, not just the skill you changed. The scanner is non-deterministic, so unrelated baselines come back with findings dropped or severities lowered.git checkout --the ones your PR does not touch, and keep each pin at the worst observed severity —scan.shtreats an escalation as a regression, so pinning a lower severity fails CI on the next flap.- Removing a finding from a baseline requires a PR-comment justification explaining why the underlying mitigation actually closed it (vs. the scanner moved on between versions).
- Severity escalations are regressions —
medium→highfails CI even when the finding ID is unchanged. - Adding a new skill that ingests untrusted content — add a baseline file in the same PR. Use the same schema. Even if the scan returns zero findings, write
"findings": []so the harness knows about the skill. - Bumping the scanner version — pin the new version in
scan.sh(e.g.,SCANNER_PKG="snyk-agent-scan==0.6.0"), refresh all baselines, and call out the version change in the PR description. Heuristics may shift between scanner releases; expect baseline churn. - Check the pinned scanner version against PyPI when entering
evals/security/.snyk-agent-scanhas no auto-update mechanism — compareSCANNER_PKGinscan.shagainstcurl -sS https://pypi.org/pypi/snyk-agent-scan/json | jq -r '.info.version'(requires lifted network restrictions forpypi.org). If newer, surface the gap to the user once per session and ask whether to bump; do not auto-bump. - The shared
## Security modelsection template lives atspecs/36-snyk-scan-baseline/template.md— mirror it into the SKILL.md of any skill that ingests untrusted content, placed immediately above the first ingestion step. - Pin doc-example tool invocations to the same version as the CI-pinned counterpart (e.g.,
uvx snyk-agent-scan==0.5.1rather than@latest) when CI compares output against a baseline.@latestdrifts from CI.
Code Review
- Before raising PR feedback, read existing review threads and replies on the touched code, and skip any whose concern your comment would repeat — or that would reverse a change an earlier comment already drove. Do not restate issues that were already answered, intentionally accepted, or deferred to a linked follow-up issue unless later commits materially changed the code or invalidated the earlier resolution. Operationally: query the PR's
reviewThreadsvia paginated GraphQL rather than a singlereviewThreads(first: 100)page — includepageInfo { hasNextPage endCursor }, request subsequent pages withafter:, and continue untilhasNextPageis false (or use the existing paginated query pattern inskills/pr-comments/references/graphql-queries.md). IncludeisOutdatedalongsideisResolved, and fetchcomments(first: 100) { nodes { path, line, body } }. For each line you intend to comment on, scan unresolved, non-outdated threads in the same file; if an open thread already raises the same concern — same file, same rule, same fix direction — do not add a duplicate, even if no user reply exists yet. A comment proposing the opposite fix direction on a line a prior thread already changed is a reversal, not new feedback; if you think the earlier fix was wrong, reply on that thread instead of opening a contradicting one. Applies to humans and bots equally.
Git And PR Workflow
- Never commit directly to
main. Always create a feature branch and open a PR for review. git commitwith no pathspec commits the whole index, not just what you staged this turn. A file the user staged before the session is swept into your commit. Restrict the commit withgit commit -m ... -- <paths>whenevergit status --porcelainshows a staged path you did not stage.- Do not rewrite history on a PR that already has review comments. Avoid force-push, rebase, and
git commit --amendon pushed commits. - When a PR branch has merge conflicts and rebase is forbidden (review comments exist), run
git fetch origin && git merge origin/main— not rebase — to resolve them. - The auto-mode classifier blocks branch deletion and force-push even when the user authorized them in conversation (it needs a Bash permission rule). Don't retry via an alternate tool (e.g.
gh api -X DELETEaftergit push --deleteis denied) — surface it for the user to run via the!prefix. git mergeblocked by untracked files:git stash -u, merge, thengit stash pop. If pop reports "already exists" or conflicts, verify stash contents (git stash show -p) beforegit stash drop— pop may not have fully restored everything.- This repo only allows squash merges and auto-deletes the remote branch. Use
gh pr merge --squash—--delete-branchis redundant and the auto-mode classifier blocks it. The local branch survives; delete withgit branch -D <branch>. After merging, ask the user to run/learnon the merged PR (or onmain) so the assistant updates its context; in Claude Code a PostToolUse hook prompts automatically forgh pr merge. PostToolUse hooks fire on pattern match, not success — write hook messages as "If [action] succeeded...", since a grep-based hook also fires on failed commands and--helpcalls. - After pushing follow-up commits or reverts to an existing PR branch, compare
git log origin/main..HEAD --onelineagainst the PR title/body and update the PR description if behavior changed. gh pr edit --body-file FILEblanks the PR body when FILE is empty. A separate generator command that fails (e.g. a script erroring to an empty file) leaves FILE empty and the unchained edit still runs, wiping the body. Chain them (build-body && gh pr edit --body-file FILE) or guard with[ -s FILE ]before editing.- After pushing commits to a PR outside of a
/pr-commentsinvocation, immediately invoke the skill without asking: run/pr-comments {pr_number}(auto mode, the default) or/pr-comments {pr_number} --manualif the session is already in manual mode. This includes when/ship-itcreates a new PR. Check theanthropics/claude-code-actionworkflow trigger:on: pull_requestre-triggers on push; if it useson: workflow_dispatch, first identify the workflow by searching.github/workflows/foranthropics/claude-code-actionand use the matching workflow filename, or rungh workflow listand use the workflow name or ID it returns, then rungh workflow run <workflow> -f pr_number={pr_number}after the push. - The moment you would report a PR as ready for or waiting on human review, automatically run
/pr-human-guidefirst — without asking. This includes after/pr-commentsiterations complete. It annotates the PR for human reviewers. Do not merge until a human has reviewed — bot approval alone is not a substitute. - Before reporting a PR as ready to merge, verify CI status with
gh pr checks {pr_number}— no check may be failing or pending ("no checks reported"counts as pass, but is transient for ~60s after a push — re-poll before trusting it); a clean review is not a substitute. - After implementing or fully addressing a PR review comment, resolve the thread through the GitHub GraphQL API only when no further reviewer follow-up is needed.
- After merging a PR, run the whole sync on
main—gh pr mergedoes not switch branches, sogit checkout mainfirst, sincegit pullupdates whatever branch is checked out. Once onmain, usegit pull --ff-only origin main(notgit reset --hard). Rungit status --porcelainas its own standalone step first (never chain it with&&); if it outputs anything, STOP — stash (git stash -u, so untracked files are included and can't block the pull) → pull → pop, or ask the user. Stash and pop on the same branch (main) — stashing on a feature branch and popping onmainmoves the changes across branches. If--ff-onlyfails (main diverged), investigate — don't force. - When
gh pr mergeerrors locally (e.g. uncommitted changes prevent the local branch update, the local branch can't be checked out because it's already in use by a worktree), checkgh pr view --json state,mergedAt— the GitHub merge may have already succeeded. If so: for the worktree-lock casegit worktree remove -f -f <path>thengit branch -D <branch>; otherwise rungit fetch origin && git diff origin/main(fetch first — a stale localorigin/mainmakes the diff misleading) — empty diff means the "uncommitted" files are the squash-merged content andgit pull --ff-onlyis safe; non-empty, stash → pull → pop. git branch --merged mainnever lists a squash-merged branch — the squash commit shares no ancestry. Before deleting a stale branch, confirm it landed viagh pr view <n> --json mergedAt. Tooling that counts commits (e.g.ExitWorktree) reports a squash-merged branch as unmerged work; an emptygit fetch origin && git diff origin/main <branch>proves it landed.
Git Hooks (lefthook)
glob:matches nested paths —glob: "*.json"matchesevals/js-deps/benchmark.json, not just root files (git pathspec*crosses/, unlike.gitignore).- lefthook does not stash unstaged changes — hooks see the working tree. Running a check in both
pre-commitandpre-pushis therefore not redundant: pre-commit tests the working tree, pre-push the pushed history. - Successful jobs' output is hidden — append
; exit 1to a probe job to see what it matched.lefthook run <hook> --file <path>is singular--file.
Command And Tooling Gotchas
- Do not hardcode
/tmp/; usemktemp,$TMPDIR, or${TMPDIR:-/private/tmp}.${TMPDIR:-/tmp}is also a violation — the fallback must be/private/tmp, not/tmp. chmod +xcan fail on temp files in sandbox mode: files written under$TMPDIR//private/tmp/may be writable but still reject setting the executable bit in sandbox mode. Invoke scripts via an interpreter (e.g.bash /path/script.sh) instead of relying onchmod +x.dangerouslyDisableSandbox: trueswitches$TMPDIR(sandbox:/tmp/claude-501/, disabled:/var/folders/.../T/). A${TMPDIR}/fooreference written in one mode won't resolve in the other. Pass an absolute path matching the writer's$TMPDIR, or keep writer and consumer in the same mode.- Read/Write file-state keys on the literal path string — macOS symlinks
/tmp→/private/tmp, so Reading/private/tmp/foothen Writing/tmp/foofails "File has not been read yet". Use one spelling for both. mktempX's must be last in the path component on macOS/BSD — a suffix after the X's (e.g.name-XXXXXX.md) causesmktempto fail or not substitute the Xs. Usemktemp "${TMPDIR:-/private/tmp}/name-XXXXXX"with no file-extension suffix.trapcleanup fires at the end of each Bash tool call: usetrap 'rm -f "$FILE"' EXIT INT TERMimmediately aftermktemponly when that temp file is created and consumed within the same tool call. When a temp file must persist across multiple tool calls, write it to a named path (e.g."${TMPDIR:-/private/tmp}/name.txt") without atrap—trap 'rm -f "$FILE"' EXITfires when the subshell exits at the end of each call, deleting the file before the next call runs. Clean up explicitly in a later call instead.- Writes into
$CLAUDE_JOB_DIR/tmpfrom a subprocess failoperation not permitted(Claude Code background jobs) — shell redirects and Python file writes alike; only the assistant's file-writing tool succeeds there. Write tomktempoutput instead. - If
git commitfails because of GPG/keyring access, use--no-gpg-signonly as a fallback after the failure. - In sandboxed environments, HTTPS
git pushmay hang on credentials. A working pattern is:
TOKEN=$(gh auth token) && git -c "url.https://x:${TOKEN}@github.com/.insteadOf=https://github.com/" pushgit pushdenied as "pushing to main": branch is trackingorigin/main(or upstream misconfigured); usegit push -u origin HEADto push and set the correct upstream.- Sandboxed git may log
could not write config file .git/configorcould not lock config file .git/configyet succeed (push -upushes and sets tracking;branch -Ddeletes) — don't retry; verify via the command's success line. gh api --paginate --jqapplies--jqper page. To deduplicate across all pages, collect pages first withjq -s.- When passing shell variables into
jq, usejq --arg name "$value"instead of shell string interpolation inside the filter. rgalternation uses bare|, not\|.- In an unquoted heredoc (
<<EOF),\"is a literal backslash-quote — the receiver sees\", not". If you need a double quote in the heredoc body, write plain"directly, or use<<'EOF'to suppress shell processing. --field 'body=...'not--field body="...": backticks in double-quoted strings execute as shell commands (e.g.`git stash drop`dropped a real stash). For bodies with single quotes, use'\''or--field body=@/path/to/file.--inputrequires the full JSON payload, not a raw body string.- GitHub review thread
isOutdatedmeans the diff location moved, not that the concern is resolved. replace_allremoving trailing text can merge the next line: when the removed substring is the last non-whitespace content on a line, the Edit tool may collapse the following line onto the same line. Verify surrounding context after anyreplace_allthat targets text at the end of a line.- Before
replace_all,rgeach occurrence — the same token may carry different meanings: the same numeric range or identifier can appear as both an incrementable counter (a value you want to bump) and a named label pinned to specific members (a set you want anchored). Use targeted Edits when meanings diverge. - Inserting elements into a JSON array with Edit requires a trailing comma on the preceding element: when replacing the closing
]to insert new objects, the previous element's}must end with,in the replacement string. Validate after array edits:python3 -c 'import json; json.load(open("file.json"))'. - JSON files with
\uXXXXescapes (e.g.benchmark.jsonstores—as\u2014): Python rewrites must usejson.dump(...)with the defaultensure_ascii=True;ensure_ascii=Falseun-escapes all unicode and explodes the diff. Match the file's on-diskindent(benchmark.jsonisindent=2; verify withhead -3) — a wrong value silently reformats the whole file. Edit tool matches literal bytes, soold_string="—"won't match\u2014— use Python or escape it as\\u2014. - In phrases used as
rg/grepanchors, use ASCII hyphen-, not en-dash–—rg 'Signals 1-3'silently fails to match an en-dashed copy. Copy-paste cross-file phrases rather than retyping. - External CLI tools (copilot, codex) may need network access and writable filesystem access outside a restrictive sandbox: they need network access to make API calls, and
copilotmay also need writable access for session-state files to avoid EPERM noise. In Claude Code, this may require enablingdangerouslyDisableSandbox: true; in other runtimes, use the equivalent setting that grants the needed capabilities. - zsh escapes
!in double-quoted strings and jq filters: In interactive zsh,!inside double-quoted strings triggers history expansion —"<!--"becomes"<\!--"and"!="in jq becomes"\!=". This silently corrupts content written to files or passed as arguments. Workarounds: use single-quoted strings ('<!-- marker -->'),$'...'ANSI quoting, or write content via Python (subprocess/ file I/O) which bypasses shell history expansion entirely. For jq specifically: write the filter to a file and usejq -f, or rewrite!=as(== | not). Skill jq snippets and any bash that emits HTML comment markers must avoid double-quoted!. This also applies to any heredoc — quoted delimiters (<<'EOF',<<'PYEOF') do not prevent zsh history expansion, which runs before the heredoc is constructed. Python scripts:\\!becomes\!. Plain text (GraphQL types,<!--markers, JSON with!):!becomes\!in the written file. For literal!in string literals (e.g.<!--markers), usechr(33)— it avoids the Write-tool approval prompt triggered when writing a temp file to$TMPDIR. For!=comparisons, rewrite asnot (a == b). Fall back to writing the script to a file with the Write tool when there are many such rewrites. This also applies toif ! cmd— usecmd || { ... }instead. Single-quoting does not reliably protect!inperl -pe/sedregex one-liners (a lookbehind(?<!…)arrived as(?<\!…)and broke the pattern); do the substitution with the Edit tool instead of a shell regex. - zsh
echointerprets backslash escapes by default —echo "$json" | jqturns escaped\ninside captured JSON into real newlines and jq errorscontrol characters … must be escaped. Useprintf '%s', neverecho, to pipe captured JSON/data into a parser. - zsh's
statusis a read-only special variable (holds the last pipeline exit code):status=...orlocal status=...errorsread-only variable: status. Rename towf_status/rcin bash snippets that may run under zsh. - In a worktree, edit skills at the worktree path
skills/<name>/SKILL.md— not via.claude/skills/<name>/SKILL.md, which resolves to the main repo's copy via the symlink. - Git write operations in a worktree may require sandbox restrictions to be lifted:
git add/commit/pushfrom a worktree write lock files to the main repo's.git/worktrees/<id>/path;git -C /path/to/main/repo <write-op>(e.g.fetch,reset --hard) from a worktree shell context writes elsewhere in the main repo's.git/(e.g..git/FETCH_HEAD) — both targets are outside the worktree's sandbox allowlist (.). In Claude Code, this may requiredangerouslyDisableSandbox: true. git worktree removedoes not delete the directory or local branch: use-f -f(overrides agent-isolation lock), thenrm -rf <path>andgit branch -D <branch>. In sandbox mode the directory delete fails "Operation not permitted" but git unregisters anyway — re-runninggit worktree removereports "not a working tree." Skip torm -rfwith sandbox disabled.- Worktree-isolated agents must prefix Read/Edit paths with
$WT: Read/Edit take absolute paths, so passing/Users/.../skills/<name>/SKILL.mdto an agent launched withisolation: "worktree"clobbers the main repo, not the worktree copy. In the agent's prompt, setWT=$(git rev-parse --show-toplevel)and require$WT/...prefixes. Symptom: main repo's HEAD ends up on the agent's branch. - Give review subagents
origin/<branch>:<path>refs, notHEAD:<path>— with multiple PRs in flight the session's working tree may be on a different branch, sogit show HEAD:<path>silently feeds the agent the wrong PR's content. - The worktree-isolation guard also blocks
!-prefixed commands the user runs — they execute in the session's context. Direct the user to a terminal outside the session. It also refuses compound commands (for … done,[ -f x ] && cmd) as "too complex to verify", even read-only ones — split into separate commands. - Git writes touching
.claude/settings.jsonfail in sandbox (checkout,reset --hard,merge,stash pop): usedangerouslyDisableSandbox: true. - GraphQL queries with
!type markers cannot be passed as inline shell strings in zsh —String!,Int!, etc. trigger history expansion and produceUNKNOWN_CHARerrors fromgh api graphql. Pass the query via Python subprocess (subprocess.run(['gh', 'api', 'graphql', '--field', 'query=' + q], check=True)) or write it to a file and pass--field query=@/path/to/file. This applies to anygh api graphqlcall with typed variable declarations. gh api --jqdoes not accept--arg: it treats any tokens after the filter as positional args and errors with "accepts 1 arg(s), received N". To inject a shell variable into a filter across paginated results, drop--jqand pipe the raw paginated stream tojq -s --arg name "$value" '[.[] | .[] | select(...)]'— the-sslurps the page-stream into one array and--argis safe on standalone jq. Omitting-sfails withCannot index string with string "<field>"— the stream is separate arrays, not one.gh run view --logcache (~/.cache/gh/) fails EPERM in sandbox — prefix withXDG_CACHE_HOME="${TMPDIR:-/private/tmp}/gh-cache".uv run --with pytest pytest tests/fails in sandbox (cache EPERM; theUV_CACHE_DIRoverride then panics on keyring) — run with sandbox lifted (in Claude Code:dangerouslyDisableSandbox: true). Thepre-pushhook runs pytest, sogit pushneeds the same.- Requesting Copilot code review via API: use
--field "reviewers[]=copilot-pull-request-reviewer[bot]"(include the[bot]suffix). Without[bot]returns 422 "not a collaborator";reviewers[]=Copilotreturns HTTP 200 silently but does nothing. The Copilot review workflow fires via a "dynamic" event and cannot be dispatched withgh workflow run. Copilot's bot login also varies by endpoint:/pulls/{n}/reviewsshowscopilot-pull-request-reviewer[bot], but inline/pulls/{n}/commentsshowsCopilot. Filter on both:(.user.login == "Copilot") or (.user.login == "copilot-pull-request-reviewer[bot]"). - Copilot's "generated no new comments" can still carry findings — "Suppressed comments" live in the review body (
/pulls/{n}/reviews), never on/pulls/{n}/comments. - jq bot-login exclusions need exact equality, not
contains(): when excluding a specific bot from a jq filter, use.user.login == "claude[bot]"— not.user.login | contains("claude"), which silently excludes unrelated bots sharing the substring (e.g.claude-reviewer[bot],claude-pr-reviewer[bot]). This bug is easy to introduce and passes casual review; catch it by naming the exact login you mean to exclude. claude[bot]posts its verdict as a PR timeline comment (/issues/{n}/comments), not a review object (/reviews) — findings included, not just clean approvals. A poll that omits the timeline surface reports the review as settled while findings are waiting.- A re-requested bot review may post nothing new —
claude[bot]won't post an identical clean verdict twice (confirm the run viagh run view <run_id> --json conclusion, don't poll for a comment that won't come), and Copilot may return a "reached their quota limit" body instead of findings. Treat both as terminal; stop the loop instead of polling to timeout. Asuccessconclusion is not evidence a verdict was posted — the run can be denied permissions throughout and post nothing anywhere. Distinguish nothing new from nothing ever: if noclaude[bot]verdict exists on the PR timeline at all, the gate did not run and the PR is unreviewed, not clean. grep | head -1underset -euo pipefailcan fail via SIGPIPE — whenheadcloses the pipe,grepexits non-zero. Usegrep -m1instead.jq IN()requires jq 1.6+:(.field | IN("a", "b"))fails on jq 1.5 (shipped in some CI environments). Use explicitorform:(.field == "a") or (.field == "b").- Bash auto-backgrounds long-running commands: don't rerun — check the prior command's output or use your environment's wait/follow mechanism to retrieve results.
- GitHub Actions
workflow_dispatchinputs: never use${{ inputs.field }}directly inrun:(injection risk) — pass viaenv: VAR: ${{ inputs.field }}and reference"$VAR". Sanitize before using in git refs. - Don't
SendMessage-retry a transient-failedAgentlaunch — the resume path silently inherits the parent's model, not the Agent'smodel:parameter. Re-spawn instead. Verify withmessage.modelin the agent's JSONL. - Subagent JSONL transcripts at
~/.claude/projects/.../subagents/agent-*.jsonlrecord every turn'smessage.model,message.usage, tool blocks, and timestamps — per-subagent time/tokens/tool_calls/errors are recoverable; parse the JSONL rather than recording them asnull. gh run list --workflow=...reportsheadShafrom the dispatching ref (e.g.,main), not fromrefs/pull/<n>/headeven when that's what the workflow checks out. Correlate runs bycreatedAt+ thepr_numberinput.
Available Skills
When the user's request matches a skill's trigger phrases, read the skill file and follow its workflow exactly.
| Skill | File | Trigger phrases |
| peer-review | skills/peer-review/SKILL.md | "peer review", "fresh review", "another set of eyes", "sanity check", "quick review before I push", "review with Copilot", "review using Codex" |
| pr-human-guide | skills/pr-human-guide/SKILL.md | "review guide", "human review guide", "prep for review", "flag for review", "flag for human review", "add review guide" |
Do NOT trigger peer-review on bare "review" phrases like "review my changes" or "review PR N" — those route to code-review.
Skill Design Guidance
- Name skills from the user's action or role, not the underlying implementation detail.
- Prefer auto-detection with a disambiguation prompt over adding new flags when a behavior is only needed in genuinely ambiguous situations. Handle unambiguous cases silently (e.g., only unstaged changes → auto-review with a note); prompt only when intent is unclear (e.g., both staged and unstaged →
[staged/unstaged/all]). Explicit flags can still be offered as an escape hatch for scripting. - Keep README / CLAUDE documentation in sync when skill changes are substantial.
- When a workflow pauses for user confirmation, make the stop explicit: tell the agent to output the prompt as its final message and stop generating until the user replies. If the workflow also has auto/manual modes, specify every confirmation gate each mode affects. If auto mode is meant to be hands-free, say explicitly whether later gates (for example push/re-request prompts) are skipped or still require confirmation.
- When listing exit conditions for a workflow loop, state that they are the only valid exit conditions and explicitly forbid subjective early exits.
- Disjuncts and tie-breakers in classification rules are load-bearing: in a rule like "include X only when it has a concrete risk or judgment call" or "when in doubt, flag only when...", each disjunct and tie-breaker is a distinct case — not a redundant adjective. Cutting one narrows classifier behavior even when the prose looks tighter.
- When a SKILL.md step does setup work (snapshot, POST, etc.) before delegating to a reference file that has its own entry/setup section covering the same actions, the delegation sentence must name the target section and list what not to re-run — otherwise agents re-enter the setup section and duplicate actions already done in SKILL.md.
- When a SKILL.md step creates a temp file with
mktempand uses it within the same tool call, documenttrap 'rm -f "$FILE"' EXIT INT TERMimmediately after themktempcall — a manualrm -fat the end of the block is skipped on error or interruption. When the temp file must persist across multiple tool calls, use a named path withouttrapinstead (see thetrapcleanup bullet above). - Sequential
trapsnippets clobber earlier traps in the same shell: bash supports one EXIT trap per shell — a latertrap 'rm -f "$B"' EXIT INT TERMreplaces the earliertrap 'rm -f "$A"' EXIT INT TERMand leaks$A. When a SKILL.md chains snippets that may run in one shell, combine cleanup in one trap and apply${VAR:-}defaults to every variable soset -udoes not abort the trap when one is unset at exit time:trap 'rm -f "${BODY_FILE:-}" "${PR_VIEW_STDERR:-}"' EXIT INT TERM. - Repo-specific paths need portability notes: When a skill step references a layout-specific path (e.g.,
skills/*/SKILL.md), add(adjust prefix to match your repo's skill directory structure)— downstream consumers with a different layout silently miss the trigger. - Never invoke a bundled script by a repo-relative
skills/<name>/…path — resolve it from the skill's own directory:SKILL_DIR="${SKILL_DIR:-<absolute base directory>}", thenHELPER="$SKILL_DIR/references/<script>". Installed skills live under.claude/skills/,.agents/skills/,~/.claude/skills/, or a plugin cache, where a root-levelskills/prefix does not exist; a cwd-relative path additionally executes a same-named file from whatever repo is checked out. The reference file describing the script is its sibling, so the assistant already knows the absolute path — no filesystem probe or vendor directory list is needed. Guard with[ -f "$HELPER" ]and abort with a message namingSKILL_DIR. - Cite reference files by full path (
skills/learn/references/refactoring.md, notrefactoring.md) — bare names are ambiguous outside the home skill. - Bash snippets that assign CLI output to a variable should include
2>&1so error messages flow into the captured variable and reach fallback/error handling paths (e.g.,REVIEW_OUTPUT=$(cli ... 2>&1)). || trueis too broad for a specific expected error — captureresp=$(cmd 2>&1)andcase-match the tolerated status (e.g.,HTTP 422); other errors still abort.- When capturing
git diff --quietexit codes, useVAR=0; git diff --quiet || VAR=$?— notgit diff --quiet; VAR=$?. In strict runners (set -e) the non-zero exit from "changes present" aborts the script before the assignment runs.
Persistence
- Store durable project learnings in
CLAUDE.md, not in per-user hidden memory directories. - Do not write to
~/.claude/projects/.../memory/for this project. - Write timeless rules, not session history — do not reference specific PR numbers, dates, or session details in config rules. Those belong in commit messages.
- In "X not Y" contrasts, annotate immediately after X — trailing parentheticals read as describing Y.
`cd dir && cmd` (skips if cd fails), not `cd dir; cmd` - Minimum viable rule text — every clause must be load-bearing (rule, fix, non-obvious why, or concrete example). Cut incident narratives and multi-clause rationales; they belong in commit messages.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

