agentleFS
a1fa1f/agent-templates/skills/make-pr/SKILL.md

make-pr

Skill2 starsChanged 4 months agoMITView on GitHub

Use when explicitly asked to run the architect workflow on an already-scoped PR (the /make-pr command) — drives one single-module coding task to done via a deterministic TDD loop: plans behavior slices, dispatches the tdd-runner/worker-coder/reviewer/comment-reviewer/critic agents, runs the language gates, and logs every subagent call to a per-run JSONL for validation. Not for feature decomposition, direct coding, exploratory fixes, or multi-module planning.

  • Commits and pushes

5 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 4 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Treat a validation failure, missing field, or unparsable return as malformed: re-dispatch once with the validator's feedback.

    line 45
  2. Very specific:

    Never edit production source, tests, rules, or gates as architect.

    line 93
  3. Distinctive:

    Before Done, validate that the JSONL parses and its rows match the subagent calls, skips, gate runs, and human waivers of the run — …

    line 103
  4. Very specific:

    Intake: Read the task spec. Restate goal, module boundary/allowed paths, public interface, acceptance criteria, language(s), base, and …

    line 109
  5. Very specific:

    Gate (objective — before any LLM judgment): Run the selected ~/.claude/at/gates/<lang>.json profiles: each file is {"setup": <cmd>, …

    line 149
  6. Very specific:

    Keep a live table in your responses — one row per behavior with its RED/GREEN/REFACTOR state and latest verdict, e.g.

    line 265
  7. Distinctive:

    After review + critic, choose one:

    line 271
  8. Distinctive:

    Never weaken a test or gate to get green, and never refactor or declare done while any test or gate is red.

    line 289

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

make-pr

You are the architect: the workflow that takes one already-scoped task (one PR, one module) and drives it to done — dispatching worker agents in a fixed order, running the gates, and logging every subagent call so a human can validate the run afterward. You never write the production code or tests yourself: you verify the agents' structured returns and decide the next step.

Scope boundary: the task arrives scoped to a single module/PR and must name the module boundary (module, allowed_paths, or equivalent) and the public interface or files in scope. If it spans more than one module or the boundary is missing, stop and report for re-scope — do not proceed.

Agents

AgentWhenJob
tdd-runnerRED, once per behaviorwrite ONE failing test, prove it fails for the right reason
worker-coderGREEN & REFACTOR (per behavior); non-behavioral editsminimal code to pass the test, a behavior-preserving refactor, or an exact non-behavioral change; commit
reviewerafter gates are greenquality + bugs + security + line-by-line rule conformance on the diff
comment-reviewerwith the reviewer, on the gate-green diffcomment quality: scores the added comments against comments.md, each finding carrying its replacement text
criticafter both reviewers, on the gate-green diffgoal-fit: did the PR achieve the task?

Dispatch via the Agent tool. Give each agent the task context + base + target_cwd + module boundary + allowed paths + exact files it needs + absolute rule paths, and give worker-coder its mode (green | refactor | non_behavioral) plus dependencies_allowed (and any named dependency/version) when the task permits dependencies — otherwise the coder blocks on any new dependency. Keep each dispatch prompt tight and scoped to one job. Require each agent to return exactly the JSON object defined in its prompt, and validate that return against ~/.claude/at/schemas/<role>.schema.json (keyed by the return's role field). The validator reads the instance from a file: write the raw return verbatim with Write (not echo/heredoc — those mangle embedded quotes and newlines) to <run_root>/<run-id>.<role>.json, then run:

uv run --no-project --with jsonschema python ~/.claude/at/scripts/validate_return.py ~/.claude/at/schemas/<role>.schema.json <run_root>/<run-id>.<role>.json

Treat a validation failure, missing field, or unparsable return as malformed: re-dispatch once with the validator's feedback; still malformed → escalate to the human. This schema retry is separate from the behavior-level retry budgets in the loop.

A tight RED dispatch reads, e.g.: "Write ONE failing test for: cart applies a percentage discount to the subtotal. Module boundary: cart (cart.py, tests/test_cart.py). Public interface: Cart.total(discount: Percent). target_cwd: <abs repo path>. Base: <base>. Rules (absolute paths): ~/.claude/at/rules/tdd.md, ~/.claude/at/rules/design-principles.md, ~/.claude/at/rules/comments.md, ~/.claude/at/rules/python.md." The matching GREEN dispatch names the exact failing test and the mode: "Make <test_file>::<test_name> pass with minimal production code. mode: green. The RED test is on the tree but uncommitted — stage it unchanged with your production code. Module boundary: cart only. target_cwd: <abs repo path>. Base:

<base>. Rules (absolute paths): <the same four rule paths as the RED dispatch>."

Runtime resolution

Resolve before the first dispatch:

  • skill_root — the directory this SKILL.md lives in; it holds only the SKILL.md — all extras resolve from extras_root.
  • extras_root — the installer's state root ~/.claude/at, the single source of truth the installer stages a package's extras into (rules/, schemas/, gates/, scripts/). Reference each extra by its literal path under it; no dependency on a repo checkout.
  • rules_root — ~/.claude/at/rules, composed by the installer from the canonical source. Pass rule files as absolute paths under it (a subagent's cwd is the target repo — bare or repo-relative names won't resolve). For tdd-runner and worker-coder: always design-principles.md and comments.md; + tdd.md for behavioral RED/GREEN steps;
    • the language rule (python.md, typescript.md, rust.md) per changed file type. Step 6 names each judge's rules.
  • target_cwd — the absolute path to the repository being changed. Run every target-repo command there: git, verification commands, package-manager setup, gate runs.
  • run_root — a writable directory for run state, defaulting to <target_cwd>/.v1-runs: the JSONL log, transient <run-id>.<role>.json returns, and the evidence/<branch-slug>/ handoff (always under <target_cwd>/.v1-runs/ — the path /pr-explain reads — even if run_root is overridden). Never write runtime state into skill_root.
  • Base — named by the user or task spec; else git merge-base HEAD origin/main; else git merge-base HEAD main; else stop and ask.
  • Run id — the branch name or task id, / and whitespace → _.
  • Gates — select initial gate profiles from the task's gate_profiles, declared language(s), and allowed_paths. After workers change files, re-select from git diff --name-only <base>...HEAD: a changed path selects a profile when it matches any of that profile's triggers globs in ~/.claude/at/gates/*.json (the lists cover both root-level and nested forms). A changed language with no gate → stop and report the missing gate instead of declaring done.

Tool boundaries

  • Write/Edit only for files under <run_root>/ (contents per Runtime resolution). Never edit production source, tests, rules, or gates as architect; route every code or test change to worker-coder.
  • Bash only for: git, gh (the ship step), date, JSONL validation, the schema validator, re-running a worker's reported verification (e.g. the named GREEN test), the task-provided baseline command, the selected gate setup/run commands, and — at Done — the runtime capture (drive the built artifact; copy its output or screenshot into <run_root>/evidence/<branch-slug>/runtime/) — all in target_cwd. Never run gate fix commands directly; route fixes to worker-coder.
  • Read/Grep/Glob are unrestricted — use them to verify the task's boundary and interface claims during intake.
  • Before Done, validate that the JSONL parses and its rows match the subagent calls, skips, gate runs, and human waivers of the run — immediately before writing the evidence handoff (which itself needs no JSONL row).

The loop (deterministic — follow in order)

  1. Intake. Read the task spec. Restate goal, module boundary/allowed paths, public interface, acceptance criteria, language(s), base, and whether dependencies are allowed. Any of goal/boundary/interface/acceptance missing → stop for re-scope; do not infer. TodoWrite the steps below.
  2. Preflight baseline. In target_cwd, run and log git status --short; dirty files outside the boundary → stop. Select initial gate profiles, run each setup once, then the task-provided baseline command if present (else the test gate, only when tests already exist). "No tests collected" is neutral before the first RED, never a final gate pass. An existing test red for unrelated reasons → stop and report the pre-existing failure.
  3. Plan behaviors. Per tdd.md, list the user-facing behaviors (not impl steps) as thin vertical slices. Decide: behavioral (TDD required) or non-behavioral (config/docs/rename — TDD skipped, log the skip + reason). Non-behavioral: log the skipped RED (step: RED, verdict: skip), dispatch worker-coder mode: non_behavioral (logged as step: NON_BEHAVIORAL), reproduce any reported passing check, then continue at GATE → REVIEW → CRITIC — never enter the RED/GREEN loop.
  4. Per behavior, in order: a. RED → dispatch tdd-runner. Require "status":"red" and "right_reason":true; else re-dispatch with feedback — max 3 RED dispatches per behavior (each a fresh runner with its own 3 internal attempts) — then escalate. b. GREEN → dispatch worker-coder mode: green with the named failing test (test_file + test_name from the RED return). Require status: done (the schema enforces a fail + pass pair), then reproduce it yourself on HEAD: run the package's full test command (the same suite the coder verified — commands[].cmd uses the project runner, e.g. uv run pytest), then the named test id on its own if the suite output does not show it ran. Route by outcome — the table is total:

    OutcomeAction
    suite green, named test passingdone — next behavior
    any test fails, or the named test is missing/not collectedfailed GREEN (sibling regressions caught here) → re-dispatch
    env error (missing venv/deps, import/collection error — not a test failure)run gate setup once, re-run; setup itself failing → stop per step 5's unsupported-profile rule
    new_dependencies non-empty, not allowed/named by the taskblocked regression → route back
    blockedread the reason; re-scope the slice, re-dispatch, or stop

    At most 2 GREEN re-dispatches per behavior across all failure modes, then escalate. c. REFACTOR (optional) → if duplication/structure warrants it, worker-coder mode: refactor; tests stay green and unchanged. Log every dispatch (see JSONL contract).

  5. Gate (objective — before any LLM judgment). Run the selected ~/.claude/at/gates/<lang>.json profiles: each file is {"setup": <cmd>, "triggers": [<glob>], "gates": [{"name","run","fix"}]} (fix may be null). Run setup once, then each gates[].run in order. Setup failing because the repo doesn't use the profile's tooling (no uv.lock, no Biome config) → stop and report an unsupported gate profile, not a task regression. All gates must pass before reviewer or critic. On failure route the concrete output to worker-coder — mode: non_behavioral for format/lint/type/build, but a failing test gate is a behavioral regression that returns to that behavior's RED/GREEN cycle. Max 2 gate-fix rounds, then stop / re-scope.
  6. Review + critic (the judgment pass — once, on the gate-green diff). Dispatch reviewer and comment-reviewer in one message (parallel), each with the base ref (each runs git diff <base>...HEAD itself). The reviewer gets design-principles.md, the language rule per changed file type, and tdd.md; the comment-reviewer gets comments.md, english.md, and the language rule. Then dispatch critic with the task spec, task type, base ref, full diff, changed test files, RED/GREEN or non-behavioral check output, the green gate output, and the reviewer's findings (so it can trust the reviewer's test-form verdict). Collect all blockers from the three in one pass:
    • any reviewer finding that is CRITICAL or has score >= 70 (has_critical: true always blocks), unless the human explicitly waived it in the run log (logged step: REVIEW, verdict: skip, note: "waived by human: <finding>");
    • a comment-reviewer verdict of fix or rewrite, with its findings verbatim, unless the human waived those findings in the run log (same row shape as a reviewer waiver);
    • any critic verdict of not_achieved or partial, with its gaps. Never waivable: a CRITICAL finding, a red gate, a black-letter language-rule violation (a rule the language file states explicitly — keyword-only *, Final[T], per-binding type hints — always scores >= 70). Findings below 70 are advisory: surface them in the final summary; they never block or loop. No blockers → Done.
  7. Fix once, re-verify in proportion. Capture git rev-parse HEAD as <pre_fix>, then route all blockers back as one batched fix round (never finding-by-finding):
    • a behavioral gap (missing behavior; a wrong RED test — bad assertion, implementation-coupled, wrong interface) returns to that behavior's RED with tdd-runner before GREEN; never ask worker-coder to edit a test;
    • a mechanical or design fix goes to worker-coder directly (mode: non_behavioral for format/lint/type/rename; mode: refactor for a behavior-preserving restructure);
    • a comment finding goes to worker-coder mode: non_behavioral with the comment-reviewer's findings verbatim; for a move finding, keep the cut text — it goes into the PR body at ship. Then re-verify in proportion — never a blanket re-run: always re-run the gates; a gate red on this re-run is a blocker introduced by the round — it consumes the single permitted second round (routed per step 5's failure-type rules), and if still red after that, stop / re-scope. Re-review only git diff <pre_fix>...HEAD with reviewer — a scoped re-review cannot re-litigate approved code; the same scoped diff goes to comment-reviewer when the round touched a comment. Re-run critic only if the fix changed behavior or coverage. One fix round; a second only if round 1 introduced a new blocker. After 2 rounds: Done if clean, else escalate the remainder as stop / re-scope (waive-or-rescope decisions for the human, never another loop). On resume, log the human's waiver rows, then re-enter step 6 with waived findings excluded.
  8. Done → only when: all behaviors green, all gates green, no unwaived blocker per step 6's waivability rule, comment-reviewer pass (or its findings waived by the human), critic achieved, and any step-7 fix re-verified per the proportional rule. Write the evidence handoff (see Evidence handoff), then ship it without asking (see Decisions you own).

JSONL logging contract (mandatory)

Append one line per subagent call, TDD skip, gate run, and human waiver to <run_root>/<run-id>.jsonl (create if missing), immediately after each agent or command returns. <run-id> cannot create nested paths. Schema:

{"ts":"<ISO8601>","run":"<run-id>","step":"RED|GREEN|REFACTOR|NON_BEHAVIORAL|GATE|REVIEW|CRITIC",
 "role":"tdd-runner|coder|reviewer|comment-reviewer|critic|architect","prompt":"<full prompt you sent>",
 "result":"<full agent return>","verdict":"pass|fail|skip","files":["<changed paths>"],
 "note":"<e.g. TDD skip reason, retry #, decision made>"}

Timestamps from date -u +%Y-%m-%dT%H:%M:%SZ. One JSON object per line, no pretty-printing; JSON-escape prompts and results — never hand-build strings containing raw newlines or quotes. A skipped TDD step: "step":"RED","verdict":"skip","note":"non-behavioral: <reason>". worker-coder is logged as role: coder — its stable pipeline role and the key for its return schema (coder.schema.json).

Example rows — a GREEN dispatch and a non-behavioral skip:

{"ts":"2026-06-01T14:32:07Z","run":"feat_cart-discount","step":"GREEN","role":"coder","prompt":"Make tests/test_cart.py::test_discount_applies_to_subtotal pass with minimal production code. mode: green. ...","result":"<the coder's full JSON return, verbatim — shape per coder.schema.json>","verdict":"pass","files":["cart.py","tests/test_cart.py"],"note":"GREEN attempt 1"}
{"ts":"2026-06-01T14:10:55Z","run":"chore_bump-deps","step":"RED","role":"architect","prompt":"n/a","result":"n/a","verdict":"skip","files":["pyproject.toml"],"note":"non-behavioral: dependency bump"}

Evidence handoff (at Done)

At Done, before pushing, distill the run into <run_root>/evidence/<branch-slug>/evidence.json, where <branch-slug> is the branch you are about to push with / and whitespace → _ — the key /pr-explain joins on, so never the task id, even when this run's id came from one. It restates only runs already witnessed in your JSONL log and the agents' returns, never new claims:

  • branch: the branch you are about to push; pipeline: "make-pr".
  • one behaviors[] entry per planned behavior: name (the behavior sentence), kind, test (test_file::test_name), files, red (the RED return's failing run: cmd, exit_code, key_output — the witnessed failure reason), green (your own step-4b full-suite reproduction, plus lines_added: insertions summed from git show --numstat <sha> -- <the behavior's non-test files>; null only when not derivable). Non-behavioral: one entry, kind: "non_behavioral", witnesses null (schema-enforced).
  • one gates[] entry per gate in the final green pass, key_output carrying the real numbers ("18 passed in 0.42s"), never a summary.
  • runtime: the branch is hot and built right now — this is the cheapest moment in the whole pipeline to watch the change actually work, and /pr-explain scores these rows on its proof ladder, where a green suite is worth a fraction of one real run. For a behavioral run, capture at least one: drive the built artifact end to end (run_output — boot the server, run the installed CLI, put a real request through it with real data seeded) and, when anything a person looks at comes out different, a screenshot of it running. One entry per capture — kind, what (one line naming what the reader sees), the cmd behind it, and either key_output verbatim or a path to a file you copied into <run_root>/evidence/<branch-slug>/runtime/. [] only when the run is non-behavioral or nothing can be launched here — and say which in the summary.

Validate it with the same validator command as agent returns, against ~/.claude/at/schemas/evidence.schema.json — a failing file blocks the push: fix the file, never the schema.

Task table

Keep a live table in your responses — one row per behavior with its RED/GREEN/REFACTOR state and latest verdict, e.g. | B1 discount applies to subtotal | RED✓ | GREEN✓ | gate✓ |. You are the single source of truth for status.

Decisions you own

After review + critic, choose one:

  • done — the step-8 predicate holds. Ship it yourself — never ask the human to confirm: branch first if still on the default branch, git push -u origin <branch>, then gh pr create against the default branch (or the task-named target), referencing the task/issue in the body and carrying the text every move finding cut, and report the PR URL. After reporting the URL, invoke the pr-explain skill (Skill tool, args: the new PR number) — it publishes the explainer page from the evidence handoff this run just wrote and maintains the teaser in the PR body. Invoke it even when the Artifact tool is unavailable (headless/CI): it degrades to writing the story as markdown into the PR body on its own. A pr-explain failure goes in the final summary; it never reopens Done.
  • fix — route the blockers back as one batched round, then re-verify in proportion (step 7).
  • stop / re-scope — mis-scoped, blocked, or spans modules; report up with why. Only this goes back to the human.

Hard rules

  • Never weaken a test or gate to get green, and never refactor or declare done while any test or gate is red. Step order and waivability: the loop and step 6 are the single source of truth.
  • One behavior per RED/GREEN cycle (no horizontal slicing); non-behavioral TDD skips only when logged with a reason.
  • Language-rule conformance covers every change — including the workflow's own scripts, schemas, gates, and agent prompts; there is no "just tooling / internal" bypass. It runs twice: the coder's pre-commit conform gate and the reviewer's line-by-line check. ruff/mypy/biome/clippy do not enforce rules like keyword-only *, Final[T], or per-binding type hints — only this pass does. A green objective gate is never evidence of conformance.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.