AGENT SKILL

implement

Run the implement loop: dispatch fresh pi subagents to build each ticket as a red-green vertical slice, then run the full suite, review the diff, and commit. Use when the user asks to implement or build a spec or tickets, or when another skill must execute the loop.

License 许可
MIT
最近更新
2026-10-12
Stars
★ 0
Forks
0

01 前言 Front Matter

name
implement
description
Run the implement loop: dispatch fresh pi subagents to build each ticket as a red-green vertical slice, then run the full suite, review the diff, and commit. Use when the user asks to implement or build a spec or tickets, or when another skill must execute the loop.

02 资源文件 1

03 SKILL.md 正文

The implement loop

A fixed state machine. You are the loop runner: you never write the code yourself. Each state dispatches one fresh pi subagent, checks its reply against the state's completion criterion, then advances. Every state runs once, in order; only a state's own fix branch repeats it.

If the user passes a ticket reference, fetch it from the issue tracker and state its title before starting. If the reference is ambiguous, ask.

One dispatch shape, always from the repo root:

pi --no-session -p "<PROMPT>"

Subagent prompts are context pointers, never pasted content: point at files with @path, name the seam, and let the subagent read the rest. Fill each <...> placeholder; nothing else changes between runs.

0. Pin the queue

Read the spec and tickets and write the work order: an ordered list of vertical slices, each with its seam — the public interface the slice is tested at. Take the seam from the spec, ticket, or an ADR; ask the user only for a slice that declares none. Record the review base before any dispatch: git rev-parse HEAD.

Done when every slice has a seam and the base commit is recorded. No dispatch before both hold.

1. RED — write the failing test

Dispatch pi:

Load the tdd skill. You are building one vertical slice. Spec: @<spec-path>. Ticket: @<ticket-path>. Seam: <seam>. Write one failing test for <slice> at that seam, in the project's existing test layout. Run it and confirm it fails for the asserted reason — not a missing import, not a setup error. Write only the test; the implementation is the next step's job.

Done when the reply shows the test on disk and a run that failed at the assertion, not the harness.

2. GREEN — make it pass

Dispatch pi:

Load the tdd skill. Spec: @<spec-path>. Ticket: @<ticket-path>. Seam: <seam>. The failing test is @<test-path>. Make that test pass with the smallest change. Run the project's typecheck and only that test file. Add only what the test forces; touch only what it forces.

Done when the single test passes and the typecheck is clean. If either fails, dispatch pi once more — "Fix the failures in @<test-path>; run the typecheck and that test file" — and re-check. After two failed fix attempts, stop and report to the user.

3. Advance

Move to the next slice in the work order and return to RED. When the queue is empty, go to FULL.

4. FULL — the whole suite

Dispatch pi:

Run the full test suite and the typecheck. Fix anything that broke, re-running the suite until clean. Report what passes and any failure you could not fix.

Done when the reply reports the full suite and the typecheck clean.

5. REVIEW — two axes

Dispatch pi:

Load the code-review skill and run it. Fixed point: <base>. Spec: @<spec-path>.

Done when the two-axis report is back. If it found issues, dispatch pi once — "Fix these findings in the working tree: <findings>; re-run the affected tests and the full suite" — and re-check. Leave committing to the final step.

6. COMMIT

Commit the work to the current branch with a message naming the tickets it closes.

04 同仓库更多 Skills