Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .claude/skills/check-spec/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: check-spec
description: Check a feature or task spec as posted on GitHub, with a fresh context, before its approval box is ticked or its ready label is set — read the body, its parent or its tasks, the ADRs it names, the agent rules and the code it points at — and report contradictions, lines nobody could check, failure modes no line answers, overlapping tasks without a Depends on, and real-device lines with no slow-lane test, in a fixed block. Read-only. Use when spec-session reaches the end of technical or split mode, or when the user says "check the spec of #N".
description: Check a feature or task spec as posted on GitHub, with a fresh context, before its approval box is ticked or its ready label is set — read the body, its parent or its tasks, the ADRs it names, the agent rules and the code it points at — and report contradictions, lines nobody could check, failure modes no line answers, overlapping tasks without a Depends on, real-device lines with no slow-lane test, and terms a rule depends on that nobody defined, in a fixed block. Read-only. Use when spec-session reaches the end of technical or split mode, or when the user says "check the spec of #N".
model: opus
effort: high
context: fork
Expand Down Expand Up @@ -73,6 +73,13 @@ Report a finding for each of these, and nothing else:
5. **hardware.** A Done when line that needs a real simulator or emulator
but does not say so in its own words ("on a Mac with an iOS runtime:
..."), or does not name the slow-lane test that proves it.
6. **undefined.** A term a grammar, parser, filter or match rule depends on
that the body uses but never defines with examples: "bare version",
"exact match", "a valid name". Two readers would build two rules from
it. A line that says behaviour stays "as today" or "unchanged" is one
when the change could still alter it: name the inputs `main` accepts now
(run the command or grep the parser) and say which of them the new rule
would reject or reinterpret.

What a rule, an accepted ADR or `always-in-scope.md` already answers is not
a gap. "Nothing shows the suite is green" is never a finding: CI proves it.
Expand All @@ -85,7 +92,7 @@ End with exactly this block, nothing after it:

```
Issue: #N Checked: <#N and each task read> Findings: n
- [contradiction|unverifiable|failure-mode|overlap|hardware] #<issue> "<the line, quoted short>" — <what goes wrong>. Evidence: <file:line, rule or ADR number, or the command and its output>
- [contradiction|unverifiable|failure-mode|overlap|hardware|undefined] #<issue> "<the line, quoted short>" — <what goes wrong>. Evidence: <file:line, rule or ADR number, or the command and its output>
Verdict: ready | fix first
```

Expand Down
44 changes: 26 additions & 18 deletions .claude/skills/deliver/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,21 @@ A report without its block, or with narration in place of it, is not a
result: invoke the skill again with the same arguments plus "the last run
ended without its report block; report on the work already done".

**A person present or not.** If a person is in this session, show any text
you are about to post and ask before the slow lane runs. Unattended, post
directly and run the slow lane when the lock is free (rule 16).
**Ask once, then run.** A person in this session is asked at most one
question per run up front: whether the slow lane may run for every PR of
this run (rule 16). After that, do not stop to ask. Post PR bodies and
comments directly, merge every PR the gate accepts, and decide a round cap
by rule 14 without asking. Ask a person only for what parks an issue: they
may answer instead of reading the handoff. Unattended, nothing is asked:
the slow lane runs when the lock is free.

**Park only for a person's decision.** A small gap in the spec is not a
reason to stop: implement closes it the conservative way and lists it as
an `Assumption:` line in the PR body, and the spec review checks it (rule
3). Park only for a contradiction with the body, a rule or an accepted ADR;
for behaviour a user would see that nobody decided; for a real-device check
that cannot run; for a blocking finding still confirmed after round 2; or
for what the gate refuses (step 3).
that cannot run; for a blocking finding the review reports as open after
its last round (rule 14); or for what the gate refuses (step 3).

## 1. Take stock

Expand Down Expand Up @@ -72,18 +76,18 @@ Claim it: `gh issue edit <N> --add-assignee @me`. Its branch is

1. **Implement.** `implement` with `issue #N, branch <kind>/<N>, mode
build`. A report with `spec needs` under Open: park (step 6).
2. **Review and hardware, in parallel.** `review` with the PR number. If
implement reported Hardware lines, invoke `verify-hardware` in the
**same message**, with the PR, the branch and those lines, so both
check the commit implement pushed. With a person present, ask before
that message, since it starts the slow lane.
3. **Decide**, once both reports are in.
- Fix lines, or Hardware `fail`: one `implement` run in mode `fix` with
the Fix lines and the hardware Evidence lines pasted together. Then
round 2: `review` with `round 2` and the report's Rerun value (`code`
at least when only the hardware failed), and in the same message
`verify-hardware` again when the fix changed anything but docs.
- Spec needs, or a confirmed blocking finding after round 2: park.
2. **Review.** `review` with the PR number.
3. **Decide** on its report.
- Fix lines: one `implement` run in mode `fix` with the Fix lines
pasted. Then the next round: `review` with `round 2` (or `round 3`)
and the report's Rerun value.
- Spec needs, or a blocking finding the review reports as open with
`Rerun: none`: park.
- No Fix lines, and implement reported Hardware lines: `verify-hardware`
with the PR, the branch and those lines, on the commit the review
passed (rule 16). On `fail`: one `implement` fix run with the Evidence
lines, then `review` with `round 2` (or the next round) and `Rerun:
code`, and `verify-hardware` again on the commit that review passes.
- Hardware `busy` or `unavailable`: finish the review rounds without it,
do steps 4 and 5, run `gh pr ready <M>`, add the `needs-hardware`
label to the PR, and park instead of running the gate. The gate would
Expand Down Expand Up @@ -139,6 +143,7 @@ build`. A report with `spec needs` under Open: park (step 6).
.agents/scripts/merge-pr.sh <M>
```

Do not ask before this step: the gate is the check.
Exit 0 merged it. Any other exit: park with the line it printed. An
alive mutant implement could not explain also parks: the gate does not
read the report, you do.
Expand All @@ -164,7 +169,10 @@ gh api graphql -F owner="$OWNER" -F repo="$REPO" -F number=<N> -f query='

Runnable means open, `task:ready`, and unassigned; the issue-state workflow
only makes a task ready once everything under its Depends on is closed, so
readiness already encodes the order. Deliver up to two runnable tasks at
readiness already encodes the order. After a merge that workflow takes a
minute: watch its run (`gh run list --workflow "Issue state" --limit 1`,
then `gh run watch <id>`) and list again, rather than diagnosing why a task
is not ready yet. Deliver up to two runnable tasks at
once: invoke each stage for both in the same message, and keep the two
pipelines apart. Each task has its own worktree, so they never share files.
If both reach the hardware check at once, the second `verify-hardware`
Expand Down
42 changes: 34 additions & 8 deletions .claude/skills/implement/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ as you go, so a resumed run sees it.
Implement the smallest change that turns the next test green. Each commit
lowers the failing count and says so in its body: `3 failing -> 1 failing`.
Run `pnpm typecheck`, `pnpm lint` and the test files you touched before
each commit; the pre-commit hook runs the rest. Never pass `--no-verify`.
each commit; the hooks run the rest (format and lint on commit, `fallow` on
push). Never pass `--no-verify`. Push once per step, not after every commit:
the pre-push hook audits the whole branch.

Build what `always-in-scope.md` lists as you go: both `EVENTS.md` files for
a new or changed event; a search of `README.md`, `docs/` and every
Expand All @@ -96,17 +98,40 @@ not in the spec becomes a `bug:new` issue or one line under Open.

## 5. Prove it

**Check your own tests first**, the way the reviewers will. For each test
you added or changed:

- Its title, its assertions and its fixture state make the same claim. A
title naming two claims has an assertion for each.
- Break the code it covers once (flip the condition, drop the filter, return
early) and run that test file: it must fail on the assertion its title
names. Restore the code. A test that stays green is vacuous; fix it now.
- A test that compares two outputs fails when both are wrong in the same
way: assert one of them against a literal.

If the diff changed a schema, a contract type or a validator, rerun the
tests of every surface that publishes it (MCP `tools/list`, HTTP error
bodies, CLI help) — a refinement can empty a published schema while every
unit test stays green.

Then run the suite once:

```bash
pnpm check # typecheck, lint, format, unit, fast e2e
pnpm mutate # mutants on the lines this branch changed
```

`pnpm check` must pass. A failing test you did not touch: if an open
`flaky-test` issue names it (`gh issue list --label flaky-test --search
"<title>"`), list it under Flaky and move on. Otherwise apply testing rule
5: run it on the base commit; if it fails there too, open a `bug:new` issue
labelled `flaky-test` naming the test, and list it. Never skip, disable or
loosen a test.
`pnpm check` must pass. Run it once per round, after the last change, and
never start a second one while one runs. A failing test you did not touch:
if an open `flaky-test` issue names it (`gh issue list --label flaky-test
--search "<title>"`), list it under Flaky and move on. Otherwise apply
testing rule 5 to that one file: run `pnpm vitest run <file>` in a worktree
of the base commit (`git worktree add <scratch>/base origin/main`), up to
three times. If it fails there, open a `bug:new` issue labelled
`flaky-test` naming the file, the title and the error line, list it, and
move on. If it never fails there, it is yours. Do not stash your work or
re-run the whole suite or the whole e2e project to decide. Never skip,
disable or loosen a test.

Every mutant `pnpm mutate` reports alive is a line you can change or delete
with a green suite. Write the test that kills it, or delete the line if it
Expand All @@ -124,7 +149,8 @@ behaviour, write the test that fails first, then the fix; for a stale doc or
comment, just fix it. A line ending in `(record as Assumption: ...)` also
adds that assumption to the PR body. A hardware Evidence line is a failing
slow-lane test: fix the code, not the test. One commit per finding or per
closely related group. Then step 5 again.
closely related group. Then step 5 again, including the self-check on every
test the fix touched: a fix that leaves a test vacuous costs a review round.

## Report

Expand Down
19 changes: 13 additions & 6 deletions .claude/skills/review/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The two reviewers are the `spec-reviewer` and `code-reviewer` agents in
This skill runs on Opus too: verifying decides whether a reviewer's claim
is real, and a wrong rejection merges a defect nobody else will catch.

Arguments: a PR number, optionally `round 2` and which review to re-run
Arguments: a PR number, optionally `round 2` or `round 3` and which review to re-run
(`spec`, `code`, or `both`). With a branch instead of a PR, find its PR
with `gh pr list --head <branch>`. If the PR is not a delivery PR (a
person's PR the maintainer asked about), post the findings as one comment
Expand Down Expand Up @@ -61,7 +61,11 @@ calls with `run_in_background: false`: `subagent_type: "spec-reviewer"`
and `subagent_type: "code-reviewer"`. Never pass a model: it overrides
the agent's frontmatter. They run in
parallel, and your turn cannot end while they run, so you never hand back
before the findings are in. On `round 2`, spawn only the review named.
before the findings are in. If a reviewer's result is missing or has no
findings block (it says it is still working, or it hands back narration),
send that same agent a message asking for its findings block and wait for
it; never report a review as missing or end your turn while one is out.
On `round 2` or `round 3`, spawn only the review named.

**Spec review.** Read-only. It reads every file in `$R` except `rules/`.
Brief, verbatim, with the paths filled in (leave out the sentence for a
Expand Down Expand Up @@ -220,16 +224,19 @@ behaviour: then it is Spec needs.
## 4. Decide what runs again

A confirmed blocking finding changes the diff, so the review that raised it
runs again on the next round. Notes never start a round. After round 2
there is no third: a blocking finding still confirmed is reported as open,
and the orchestrator parks the issue.
runs again on the next round. Notes never start a round. After round 2, a
third round runs only when every confirmed blocking finding is a test that
cannot fail for the reason its title gives, or a stale doc or comment
(delivery rule 14); say so with `Rerun:` naming the review. Otherwise, and
always after round 3, a blocking finding still confirmed is reported as
open, and the orchestrator parks the issue.

## 5. Report

End with exactly this block, nothing after it:

```
PR: #M Round: 1 | 2 Kind: code | adr-only
PR: #M Round: 1 | 2 | 3 Kind: code | adr-only
Spec review: n findings (b blocking) | skipped Code review: n findings (b blocking) | skipped
Fix: <one confirmed blocking finding per line, as `path:line what is wrong`, or "none">
Notes: <one per line, `spec|code: path:line what could be better`, or "none">
Expand Down
38 changes: 35 additions & 3 deletions .claude/skills/spec-session/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ questions remain; the feature does not leave `feature:spec` until it is empty.
**`technical`** (feature delivered as one PR): fill the Technical spec
section. Before writing it, ask whether any decision here constrains more
than one future change or would be expensive to reverse. Each such decision
becomes an ADR: draft it in `docs/internal/adr/` at status _Proposed_ on a branch, and
becomes an ADR: draft it in `docs/internal/adr/` at status _Proposed_ on a branch,
with the diagrams `docs/internal/adr/README.md` asks for, and
add its line to Decisions. Tell the maintainer the feature cannot leave
`feature:spec` until that ADR is accepted. Write only what
`docs/internal/agent-rules/always-in-scope.md` does not already cover. The
Expand Down Expand Up @@ -125,8 +126,9 @@ gh api graphql -F parent="<feature node id>" -F child="<task node id>" -f query=

Get a node id with `gh issue view <n> --json id -q .id`. Run the spec check
(step 5) on the feature, which reads every task you created. Then remove the
Technical spec section from the feature body, add a Tasks section listing the
sub-issues in order, and change the label:
Technical spec section from the feature body, add the Tasks section the
feature template describes (the order as a diagram, then one entry per task
with what it changes for the user and its risk), and change the label:

```bash
gh issue edit <feature> --add-label feature:planned --remove-label feature:spec
Expand All @@ -144,6 +146,36 @@ in `task:draft`.

**`revise`**: only the reconcile step plus whatever amendments it produced.

**Make it easy to follow.** The maintainer approves what they understand,
so explain before you ask, and show before you explain:

- Open every question with the picture it is about: a Mermaid flowchart or
sequence diagram of the flow today and the flow proposed, or a before and
after example of the command and its output. Then ask, with your
recommended answer and one line on what each option costs.
- Use the words a user of the tool would use. The first time a term from
the code, an ADR or a rule appears, say what it means in plain words with
an example, and add it to the body's Words used section. Never cite a
rule or ADR number as the reason for something; say the reason.
- Keep each question to one decision and about five lines plus its
picture. If it does not fit, split it. Context the maintainer may not
have gets three lines or fewer.
- When a rule accepts, rejects or matches input, show a table of example
inputs with today's result and the proposed one, odd cases included, and
check today's column by running the tool on `main`.
- Before writing the body, play the result back: the user flow diagram,
the example, and a list of what will and will not change. Write only
after the maintainer says it matches what they meant.
- In a Technical spec, draw what the change touches: a Mermaid dependency
flowchart of the modules involved (changed ones marked), and a Mermaid
sequence diagram for any request that crosses a process or a network
hop, failure reply included. Use the same diagrams when you ask a
technical question.
- In the body, fill "How it works for the user", "Examples", "What could
go wrong" and "Words used" (feature) or "In short" (task) as the template
says. A diagram has at most about
ten boxes; split a bigger flow.

Write the spec the way rule 12 asks for everything else: short sentences,
common words, one idea per sentence. A spec is read by an agent that will
build exactly what it says, so every sentence that does not constrain the
Expand Down
8 changes: 8 additions & 0 deletions docs/internal/adr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ accepted. Numbers are never reused, and an ADR is never edited to say
something different — a decision that changes gets a new ADR that supersedes
the old one, and the old one's Status is updated to point at it.

Show the decision, not only describe it. Where it helps the reader, add
Mermaid diagrams: a flowchart of the modules or processes involved and how
they depend on each other, before and after the decision; a sequence
diagram of a request or flow the decision changes, failure paths included;
a state diagram when it changes the states a lease, device or worker can
be in. Each diagram has at most about ten boxes, and the text still states
the decision on its own.

Status values:

- **Proposed** — under discussion, not binding.
Expand Down
Loading
Loading