|
| 1 | +--- |
| 2 | +name: execute-plan |
| 3 | +description: Take a hint identifying which phase(s) in docs/PLAN.md to implement, and actually build them — write the code and tests, update docs/PLAN.md (mark complete, note deviations), docs/features.md, README.md, docs/parity.md, docs/deprecations.md as applicable, and add a changeset. Use when the user wants to implement, build, or ship a phase that's already scheduled in PLAN.md (as opposed to phase-plan, which only schedules it). |
| 4 | +argument-hint: [phase number(s) or hint, e.g. "122", "122-125", "the multi-tenant auth track", "Phase A of the auth track"] |
| 5 | +--- |
| 6 | + |
| 7 | +This skill is the opposite end of the pipeline from `phase-plan`: where |
| 8 | +`phase-plan` only *schedules* work into `docs/PLAN.md` without writing code, |
| 9 | +`execute-plan` takes an already-scheduled phase and actually *builds* it — |
| 10 | +code, tests, and the full doc-maintenance checklist `CLAUDE.md` requires for |
| 11 | +a shipped phase. It **does** write/edit source files, run the test suite, |
| 12 | +edit `docs/PLAN.md`/`docs/features.md`/`README.md`/`docs/parity.md`/ |
| 13 | +`docs/deprecations.md`, and add a changeset. It does **not** commit, push, |
| 14 | +open a PR, or merge unless the user explicitly asks for that as a separate |
| 15 | +step — landing the code is this skill's job; shipping the commit is the |
| 16 | +user's call, same as every other skill in this pipeline. |
| 17 | + |
| 18 | +## Why this skill exists |
| 19 | + |
| 20 | +`docs/PLAN.md` accumulates phase entries (via `phase-plan` or written |
| 21 | +directly) that describe *what* to build and link back to a design doc's |
| 22 | +*why*, but nothing in the existing skill set actually does the building. |
| 23 | +`CLAUDE.md`'s "When implementing a new feature or phase" checklist (7 steps: |
| 24 | +features.md, README.md, PLAN.md completion mark, parity.md, deprecations.md, |
| 25 | +review-doc awareness, changeset) is currently followed ad hoc, phase by |
| 26 | +phase, with no single skill ensuring all seven steps happen together. This |
| 27 | +skill exists to make "implement Phase N" a repeatable, complete operation |
| 28 | +instead of a checklist someone has to remember by hand. |
| 29 | + |
| 30 | +## What to do |
| 31 | + |
| 32 | +1. **Locate the target phase(s).** Resolve the hint to one or more concrete |
| 33 | + `### Phase N — Title` (or `### Phases N–M — Title`) entries: |
| 34 | + - A bare number or range (`"122"`, `"122-125"`) — grep `docs/PLAN.md` for |
| 35 | + that heading directly. |
| 36 | + - A track/title name (`"the multi-tenant auth track"`) — grep for the |
| 37 | + `## <Track name> Track` heading and its phase table. |
| 38 | + - A sub-phase label (`"Phase A of the auth track"`) — multi-phase tracks |
| 39 | + reference design-doc phase letters (Phase A/B/C/D) in their `| Phase | |
| 40 | + Spec section | ... |` table's "Spec section" column; match the letter |
| 41 | + to the correct numbered phase row. |
| 42 | + If the hint doesn't resolve to anything in `docs/PLAN.md`, say so and |
| 43 | + stop — don't invent a phase to build. If it resolves to a phase already |
| 44 | + marked `✅ complete`/`*(completed vX.Y.Z)*`, tell the user it's already |
| 45 | + shipped and ask whether they mean something else before doing any work. |
| 46 | + |
| 47 | +2. **Read the full phase entry and its linked design doc.** Phase entries |
| 48 | + written by `phase-plan` link back to a `docs/<name>-plan.md` (or |
| 49 | + `docs/design/<name>.md`) via a **Design:** line — read that doc in full |
| 50 | + for the actual implementation detail (schema shapes, route changes, CLI |
| 51 | + surface, conceptual model) the PLAN.md entry only summarizes. For |
| 52 | + Mode-B-style phases with no linked doc, the PLAN.md entry's own |
| 53 | + **Goal:**/**Design:**/deliverable bullets are the full spec. |
| 54 | + |
| 55 | +3. **Check dependencies before starting.** If the phase entry or its track |
| 56 | + header states a dependency (e.g. "hard-depends on Phase 122/123", |
| 57 | + "Build order: A → C → D → B") on another phase, verify that prerequisite |
| 58 | + phase is already marked complete in `docs/PLAN.md`. If it isn't, stop and |
| 59 | + tell the user which prerequisite phase needs to land first — don't build |
| 60 | + out of order even if it looks technically possible, since later phases |
| 61 | + are often written assuming the earlier phase's schema/interfaces exist. |
| 62 | + If multiple phases were targeted by the hint (a whole track), build them |
| 63 | + in the stated/dependency order, one phase at a time, not interleaved. |
| 64 | + |
| 65 | +4. **Survey existing code before writing new code.** Read the modules the |
| 66 | + phase will touch or extend (schema, routes, CLI registration, the |
| 67 | + relevant `src/core/*` subsystem) so new code follows existing naming, |
| 68 | + error-handling, and structural conventions per `CLAUDE.md`'s "Development |
| 69 | + conventions" and "Design constraints" sections — ESM `.js` import |
| 70 | + extensions, strict TypeScript, no barrel exports, per-blob error handling |
| 71 | + in indexing paths, `logger.ts` not `console.log` in library code, no new |
| 72 | + CLI commands without registering them in `src/cli/index.ts`. |
| 73 | + |
| 74 | +5. **Implement the phase's deliverables.** Write the code (schema |
| 75 | + migrations, routes, CLI commands, core logic) and accompanying tests |
| 76 | + (`tests/*.test.ts` unit, `tests/integration/` for end-to-end) per |
| 77 | + `CLAUDE.md`'s testing conventions — including closing any opened |
| 78 | + `better-sqlite3` handle (`session.rawDb.close()`) before temp-dir cleanup |
| 79 | + in new integration tests, per the Windows-CI note in `CLAUDE.md`. If the |
| 80 | + phase entry describes work bigger than fits one reasonable session, |
| 81 | + implement a coherent, independently-testable subset and say explicitly |
| 82 | + what's deferred — don't half-implement silently. |
| 83 | + |
| 84 | +6. **Run the test suite.** `pnpm build && pnpm test` (or a scoped |
| 85 | + `pnpm test -- <file>` first while iterating). Fix failures before |
| 86 | + proceeding; don't report a phase as built with a red test suite. |
| 87 | + |
| 88 | +7. **Run the full doc-maintenance checklist** from `CLAUDE.md`'s "When |
| 89 | + implementing a new feature or phase" section: |
| 90 | + - Add the feature to `docs/features.md` under the relevant group. |
| 91 | + - Update command/option tables in `README.md` if a new command/flag was |
| 92 | + added. |
| 93 | + - Mark the phase `✅ complete` (or `*(completed vX.Y.Z)*` once a version |
| 94 | + is known — leave the version placeholder if not yet released) in |
| 95 | + `docs/PLAN.md`, noting any deviations from the original spec in the |
| 96 | + phase entry's body. |
| 97 | + - Update `docs/parity.md` if the change affects tool availability across |
| 98 | + CLI/REPL/Guide/MCP/HTTP or adds/modifies flags — delegate this check to |
| 99 | + the `parity-check` skill rather than re-deriving its logic here. |
| 100 | + - Update `docs/deprecations.md` if anything was deprecated or removed as |
| 101 | + part of this phase. |
| 102 | + - Check the latest review doc named in `CLAUDE.md`'s canonical-docs table |
| 103 | + for findings this phase resolves, and note the resolution if relevant. |
| 104 | + |
| 105 | +8. **Add a changeset** (`pnpm exec changeset` or a `.changeset/<kebab-name>.md` |
| 106 | + file directly) per `CLAUDE.md`'s "Releases & changesets" section — `minor` |
| 107 | + for a new phase/feature, `patch` for a hotfix-shaped phase. This is |
| 108 | + required, not optional, per `CLAUDE.md`. |
| 109 | + |
| 110 | +9. **Do not commit, push, open a PR, or merge** unless the user explicitly |
| 111 | + asks for that as a following step — building and documenting the phase |
| 112 | + is this skill's full scope; shipping the result is a separate decision. |
| 113 | + |
| 114 | +## Output format |
| 115 | + |
| 116 | +Report back: |
| 117 | +1. Which phase(s) were targeted and resolved, and which were actually |
| 118 | + implemented vs. deferred (with a one-line reason for any deferral). |
| 119 | +2. A summary of what was built (files touched, schema/route/CLI changes) |
| 120 | + and the test results (`pnpm test` pass/fail summary). |
| 121 | +3. Which doc-maintenance steps were completed (features.md, README.md, |
| 122 | + PLAN.md completion mark + deviation notes, parity.md, deprecations.md) |
| 123 | + and the changeset filename added. |
| 124 | +4. Any dependency blockers found in step 3 that prevented starting a |
| 125 | + requested phase, stated explicitly so the user can decide what to do. |
0 commit comments