About execute
A skill for implementing one planned development phase, aimed at developers tracking slices and phase status with Doctrine. It combines TDD, memory capture, and verification gates, with optional worktree isolation.
Key features
- 01Check phase entry and exit criteria
- 02Implement tasks in small TDD units
- 03Retrieve and record project memory
- 04Run lint, tests, and format checks
- 05Update phase status and conformance bounds
- 06Opt into worktree isolation
Use cases
- 01Implement a single planned phase
- 02Review design and phase inputs before coding
- 03Add tests and reusable notes during implementation
- 04Isolate development in a worktree when requested
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ davidlee/ doctrine --skill executeAfter installing, type/executein Claude Code to confirm it loaded.
Details
From the project READMEExecute
You are executing one phase of planned work.
Inputs:
- the active runtime phase sheet (
state/.../phases/phase-NN.md) plan.toml/plan.mddesign.md(canonical design reference)slice-nnn.md(scope)
Process
- Confirm the phase's entrance criteria (
EN-) are met for the active phase. - Read
design.md+plan.toml+ the runtime phase sheet before coding. If the sheet is not yet filled, run/phase-planfirst; use/preflightif confirmed inputs, assumptions, and tensions are not yet surfaced. - Identify the concrete files or components you expect to touch first and run
/retrieve-memoryagainst those paths before deep reading or editing, so any scope-bound gotchas or patterns surface early. - Ensure status matches reality before implementation proceeds:
- first phase starting → move the slice:
doctrine slice status <id> started(bare number), if not already there. - flip the phase to
in_progresswithdoctrine slice phase(seelib:reference/using-doctrine.md). This auto-records the conformance boundary — the handler stampscode_start_oid = HEADinto the phase sheet. No extra call; the binding rides the transition you already issue. (It self-skips in a dispatch coordination context, where the funnel beat is the recorder instead.)
- first phase starting → move the slice:
- Implement phase tasks in small coherent units, TDD red/green/refactor write a failing test, make it pass, then refactor. Test behaviour, not trivial implementation. Build and improve test helpers and fixtures as you go.
- After each meaningful unit, run
/harvest. - If that unit produced a durable gotcha, pattern, or subsystem fact worth
future retrieval, run
/record-memorybefore moving on. - Lint as you go (
cargo clippy, zero warnings) and keep the tree buildable. - Follow the repo's commit policy: frequent, small conventional commits scoped
with the slice id (e.g.
feat(SL-NNN): …). Bias toward a clean tree; don't let.doctrine/**workflow edits drift in a stale uncommitted pile. - If
/preflightor implementation reveals unresolved design ambiguity, unexpected obstacles, tradeoffs, or policy ambiguity, stop and/consultbefore improvising past it. - Keep the runtime phase sheet current as work progresses — never record progress in
authored
plan.toml/plan.md(the storage rule). - Before declaring the phase ready, run the verification gate —
doctrine check gate(lint + test + format) — and review the touched subsystems and notes once more for missed memory-capture candidates. At phase wrap, weigh a per-phase review per the code-review skill's## Cadence— default on below the adherence bar, mandatory on any tripwire. - When exit criteria (
EX-) and verification (VT-, plus any agent/humanVA-/VH-modes) are satisfied, flip the phase tocompletedwithdoctrine slice phase. This closes the conformance boundary — the handler capturescode_end_oid = HEAD, applies the ancestor/non-merge guard, and upserts the phase's row into the slice's arm-neutral registry. Deterministic, on the critical path — not a "remember to also record" step;slice record-deltais only the manual fallback (correct a range, or bootstrap a pre-binding phase). Then hand off:/phase-planfor the next phase, or — when the slice's phases are all done —doctrine slice status <id> auditand/audit.
Optional: solo isolation (opt-in)
Default execution runs in-tree — the path above is unchanged unless isolation is requested.
Opt-in only — never automatic. Run the phase on its own worktree fork only when the user or the plan explicitly asks for isolation. Absent that annotation, implement in-tree.
When isolation is requested, before implementing (i.e. before step 5) invoke
/worktree with:
mode = solo,allow_work_in_place = true(solo MAY degrade to in-tree on sandbox denial);branch = slice/SL-NNN-slug(the slice id is in scope — e.g.slice/SL-NNN-<slug>), worktree dir keyed by the durable id (.worktrees/SL-NNN).
/worktree handles detection, the creation ladder (doctrine worktree fork),
provisioning, the spawn guards, and the green baseline; the fork branch it
returns is the deliverable.
Assert a clean direct-writer entry. Solo /execute is its own orchestrator —
worker mode is never used here (that is /dispatch's path). Worker-ness is a
property of the process: if DOCTRINE_WORKER is set in this shell, every
doctrine-mediated authored write refuses mid-work. Confirm it is unset before the
TDD loop (doctrine worktree status prints the resolved mode); if it is set,
unset it — there is no stale on-disk state to clear.
Carry out the TDD loop (steps 5–12) inside the fork. When green, land the fork
onto the coordination branch — /execute is the sole caller of land:
doctrine worktree land --fork slice/SL-NNN-slug # merge --no-ff, ancestry preserved (NEVER squash)
doctrine worktree gc --fork slice/SL-NNN-slug # reap the spent fork once the oracle proves it landed
See lib:reference/dispatch-mechanics.md §§ "The import severs ancestry — so
"did it land?" needs a patch-id oracle" and "The squash blind spot", for why
land/gc behave as they do.
Outcomes
- Phase objectives are implemented with traceable evidence, ending green.
- Phase status matches reality during implementation, not only at closure.
- Notes and durable memory stay current throughout execution.