Writing plans
Write self-contained implementation plans for an agent with zero repo context.
Assume a skilled engineer who does not know the repo or domain. Name files,
behavior, constraints, and verification. Keep tasks bite-sized and apply DRY,
YAGNI, and TDD.
Announce at start: "I'm using the writing-plans skill to create the
implementation plan."
Terms
- Green: a paste-able command emits an observable success token (exit 0,
PASS, 0 errors, artifact). Manual-only checks name an exact procedure and
expected observation. Every task and checkpoint ends green
- Task: one checkbox-tracked, committable unit with a shared file set
- Step: one numbered action nested under its task. A later task-level check
may verify it
- Substep: one numbered action nested under a step when that step needs an
ordered breakdown
- Bootstrap stubs: minimal types/signatures that make tests run (not pass)
- Put empty bodies,
NotImplementedError, or wrong defaults inside the
implementation step
- Use a separate step only when a later task imports the new symbol
- Task gate: the smallest non-dominated set of checks that proves one task's
changed files and behavior are commit-safe
- Full gate: the project's whole validation suite. Run it no more than once
per relevant implementation state and only when the diff or repo policy
requires it. A one-task or last-task gate may own it when that result covers
the complete implementation; final verification reuses it while that state
remains unchanged
- Narrow gate: the single test file or single check a step actually affects
- Dominated check: an earlier check fully covered by a later check when
nothing consumes the earlier result before the later check
- Footprint: the files, frameworks, runtimes, imports, and tooling a step
touches - scanned to match skills
Task formatting
- Write each task as one top-level checkbox item:
- [ ] **Task N: ...**
- Give each task title one umbrella outcome
- Never join separate task outcomes with
and
- Split tasks when no single outcome covers their steps and their file sets do
not overlap
- State one observable behavior in
Goal
- Nest every step under its task as a numbered list
- Nest ordered substeps under the step they implement
- Put one action or idea in each list item. Never join actions in a prose line
or paragraph
- Indent all task content under the task checkbox. Indent all step content under
its numbered item
- Use a paragraph only for non-action context that materially helps execution,
such as an edge case, constraint rationale, caveat, or justification
- Keep each paragraph to one idea. Place it directly under the task, step, or
substep it qualifies; do not use it to hide a sequence of actions
- Prefer a labeled paragraph such as
**Edge case:**, **Constraint:**, or
**Why:** when the relationship is not obvious
- Apply this structure to every plan section, including tasks, checkpoints,
header fields, and handoff text
Worked example (the shape every task follows)
Python here; use the same shape in any language.
- [ ] **Task N: [Observable outcome]**
**Goal:** [One new observable behavior]
**Files:**
- `exact/path/to/file.py`
- Responsibility: validate input
- Output: `Result`
- Reuse: `LibraryThing` from `exact/path/to/lib.py`
- `exact/path/to/file.test.py`
- Base-case coverage for `function()`
- Edge-case coverage for `function()`
1. **Implement `function()` with TDD**
**Skills (load if not already loaded):** `<test-runner-skill>`,
`<language-skill>`
1. Stub the final `Result` signature
2. Stub the final `function()` signature with a wrong body
3. Write tests for the base cases
4. Run the narrow gate
- Require assertion failures
- Require no import errors
- Require no runtime errors
5. Implement the constraints
**Signature:** `def function(input: str) -> Result`
**Constraints:**
- Accept X
- Validate Y
- Return Z
- Use `LibraryThing` for heavy lifting
- Return `Result.empty()` for empty input
**Base cases:**
- `function("valid")` -> `Result(value="valid")`
- `function("")` -> `Result.empty()`
- `function(None)` raises `ValueError`
**Edge case:** Unicode normalization can change equality without changing
the visible value.
2. **Run the task gate once**
1. `[one formatter command listing every applicable task file]`
- Omit when no changed file is covered by that tool
- Expected: exit 0
2. `[one linter command listing every applicable task file]`
- Omit when no changed file is covered by that tool
- Expected: exit 0
3. `[affected test command]`
- Omit when an unchanged valid result already covers the final task diff
- Expected: exit 0
Green: every applicable non-dominated check exits 0.
Plan location
- Plan ALWAYS lives in a file. Subagents have no session memory; the file is the
only source of truth
- Already in a plan file: preserve content outside the requested changes
- Not saved: default
docs/plans/YYYY-MM-DD-<feature-name>.md. User may pick
another path
- A caller-supplied plan path is authoritative and overrides the default
- User refuses to save to any file: STOP
- Saving does not commit the plan. Record whether execution commits the plan
file; default to included unless the user explicitly excludes it
Additional plan state files are optional tracker documents that execution
updates with the plan, such as a milestone index
- Every additional state path must exist before execution starts
- When concurrent plans share an additional state file, name its exclusive owner
or exact turn protocol in
Source requirements and the written update
checkpoint. Without that ownership gate, require sequential execution
Plan file policy applies to the plan file and every additional plan state
file as one policy
Review source
- Capture
review_source_requirements before drafting the plan
- Preserve the user's original asks
- Preserve the user's acceptance criteria
- Preserve every explicit must statement
- Preserve every explicit never statement
- Preserve each user-provided source-spec path
- Keep this capture independent from the drafted plan
- Do not reconstruct it from the finished plan
- After context compaction, stop and request the source again when the capture
is unavailable
- Derive the header's
Source requirements from this capture
Commit policy
Before writing, resolve the commit policy from the request. When the request
does not specify one, use Per-task commits. Record
Plan file policy: Include | Exclude; default to Include unless requested.
Apply it to the plan file and all Additional plan state files. Record exact
repo-relative additional paths, or none when no other state file exists.
Plan state means the plan file plus every listed additional state file.
Record the choice in the header and encode it with commit checkboxes:
Per-task commits: append one unchecked checkpoint to every task, the
unchecked conditional final-review-fixes commit checkpoint after final
verification, then a final-state commit checkpoint when the plan file is
included
One commit at the end: append one commit checkpoint after final verification
No commits: write no commit checkpoints
Every plan ends with one self-contained final-verification checkpoint after all
tasks.
- Build a review-evidence map from completed task reviews before dispatching a
final reviewer
- Reuse a task review when it covers the complete current implementation. This
is normally true for a one-task plan and for the last cumulative task review
when no implementation content or semantic input changed afterward
- Dispatch a final reviewer only for review scope not already covered
- Build an evidence map from completed task gates and reviewer-fix gates before
adding final commands
- Add a final command only for applicable scope not already covered by valid
evidence
- A commit, read-only review, checkbox update, or other bookkeeping does not
invalidate evidence unless it changes implementation content or the check's
semantic inputs
- For a one-task plan, list no final automated or manual checks when the task
gate covers the complete implementation and the review-fix loop reruns every
check invalidated by a fix
- Apply the same rule when the last task gate already covers the complete
implementation: do not repeat it at final verification
- Do not copy task-gate commands into final verification as fallback commands
- Batch all files accepted by the same formatter, linter, or checker into one
invocation
- Put final review coverage inside the checkpoint
- Require no unresolved final-review findings before final validation
- Run only checks invalidated by final-review fixes; prefer narrow checks and
rerun a full gate only when narrower evidence cannot restore required coverage
- Reuse a valid task-gate or reviewer-fix result when it covers the current
implementation state and semantic scope
- Run the project's full gate only when source, tests, build inputs, tool
config, generated artifacts, repo policy, or uncovered cross-task integration
makes it relevant
- When one full-gate command covers selected checks, omit every contained
formatter, linter, type-check, build, and test command
- Do not run unit tests, type checks, or builds for documentation-only changes
unless the repo explicitly makes those checks applicable
- Add an exact build command only when relevant and not already covered
- Add an exact documentation command only when relevant and not already covered
- Add each required manual check as an exact procedure
- Give each manual check one expected observation
- Remove every unused command or check placeholder
- Never point final validation commands or manual checks to another plan section
- [ ] **Final verification checkpoint**
1. **Close final review coverage**
**Skills (load if not already loaded):** `requesting-code-review`
Omit the skills line and dispatch step when reusable task-review evidence
already covers the complete current implementation.
1. Reuse a task-review result when it covers the complete current
implementation
2. Dispatch a fresh code-quality reviewer only when complete review
coverage remains missing
3. Resolve each substantiated finding
1. Verify its cited evidence
2. Apply the narrowest valid fix
3. Update `Solved defects`
4. Run only checks invalidated by the fix
- Prefer affected narrow gates
- Rerun a full gate only when narrower evidence cannot restore its
required coverage
4. Re-dispatch after a behavioral fix round
5. Do not re-dispatch after an all-static fix round when its affected gates
pass
6. Require reusable review coverage, `PASS`, or fully discharged findings
2. **Close uncovered automated evidence**
**Skills (load if not already loaded):** `verification-before-completion`
1. Reuse every task-gate and reviewer-fix result that covers the current
implementation state and semantic scope
2. Run `[exact command for uncovered applicable scope]`
- Omit this step when reusable evidence covers all applicable scope
- Expected: exit 0
3. **Close uncovered manual evidence**
1. Reuse every valid task or reviewer-fix observation that covers the
current implementation state
2. Perform `[exact manual procedure for uncovered applicable behavior]`
- Omit this step when reusable observations cover all applicable
behavior
- Expected: `[observable result]`
Green:
- Final code-quality review has no unresolved findings
- Reused and newly collected evidence covers every applicable check for the
current implementation state
Commit checkpoints contain no command, message, or fixed file list. The owner
derives all three from the actual diff at checkpoint time.
- [ ] **Commit task N**
**Skills (load if not already loaded):** `git-commit-message`
1. Resolve the checkpoint's verified change set from the current diff
2. Include current plan-state changes when `Plan file policy` is `Include`
3. Derive the paths from the resolved change set
4. Derive the message from the resolved change set
5. Commit the resolved change set
Green:
- New commit contains the checkpoint's complete verified diff
- No intended checkpoint changes remain uncommitted
For One commit at the end, place this immediately after the final-verification
checkpoint:
- [ ] **Final commit checkpoint: whole plan**
**Skills (load if not already loaded):** `git-commit-message`
1. Resolve the complete reviewed change set from the current diff
2. Include current plan-state changes when `Plan file policy` is `Include`
3. Derive the paths from the resolved change set
4. Derive the message from the resolved change set
5. Commit the resolved change set
Green:
- New commit contains the complete reviewed plan diff
- No intended plan changes remain uncommitted
For Per-task commits, place this immediately after the final-verification
checkpoint:
- [ ] **Conditional commit checkpoint: final-review fixes**
**Default:** No final-review changes.
**Skills (load if not already loaded):** `git-commit-message`
1. Determine whether the final-verification checkpoint changed files
2. When no final-review fixes exist, tick this checkpoint without committing
3. When final-review fixes exist, resolve their verified change set from the
current diff
4. Include current plan-state changes when `Plan file policy` is `Include`
5. Derive the paths from the resolved change set
6. Derive the message from the resolved change set
7. When `Plan file policy` is `Include`, tick this checkpoint before staging
8. Commit the resolved change set
9. When `Plan file policy` is `Exclude`, tick this checkpoint after the commit
Green:
- No-change path
- No final-review changes exist
- Fix path
- One commit contains all verified final-review fixes
- No intended checkpoint changes remain uncommitted
Under Per-task commits, when Plan file policy is Include, place this after
the conditional final-review-fixes commit checkpoint:
- [ ] **Final state commit checkpoint**
**Skills (load if not already loaded):** `git-commit-message`
1. Resolve the final verified plan-state change set from the current diff
2. Derive the paths from the resolved change set
3. Derive the message from the resolved change set
4. Commit the resolved change set
Green:
- Final plan state is committed
- No intended checkpoint changes remain uncommitted
Under Per-task commits, the task owner commits after its task gate, then
summons reviewers. Each task-review fix round gets one follow-up commit. Keep
final-review fixes uncommitted through re-review. Commit them once after final
verification passes. On the no-change path, tick after confirming no
final-review fixes exist. On the fix path with Plan file policy: Include, tick
immediately before staging and restore [ ] whenever scope resolution, staging,
or commit fails. With Plan file policy: Exclude, tick only after the commit
succeeds.
If No commits and a PR are both requested, record an external-commit handoff:
the executor stops before PR creation, supplies the exact reviewed plan-owned
change set, and verifies the resulting branch contains no baseline-only work.
Execution mode
Before writing, resolve the execution mode from the request. When the request
does not specify one, use Subagent-Driven. Record the exact choice in the plan
header.
Scope check
- Spec covers multiple independent subsystems: suggest splitting into separate
plans, one per subsystem
- Each plan must produce working, testable software on its own
Verification deduplication
- Classify each changed file before selecting commands: documentation, source,
test, build/tool config, generated artifact, or other
- Map each command to the changed paths or behavior that justify it
- Omit a command when no changed path or repo rule makes it applicable
- Documentation-only changes do not justify unit tests, type checks, or builds
by default
- A test-only change justifies the affected tests, not an unrelated full suite
- Build or tool-config changes justify only the checks whose behavior they can
alter
- A comment-only source change does not justify tests, type checks, builds, or a
full gate when comments have no executable role
- Treat directives, suppressions, pragmas, doctests, generated-documentation
inputs, shebangs, encoding declarations, and format-sensitive metadata as
executable rather than comment-only
- Canonical formatter-only output does not justify tests, type checks, builds,
or a full gate when formatter configuration and semantic inputs are unchanged
- Formatting or lint checks may still be applicable to comment-only and
formatter-only changes
- List verification and formatting commands in execution order before writing
them into tasks
- Batch all applicable files into one formatter/linter invocation when the tool
accepts multiple paths; never emit one invocation per file
- Remove an earlier command when a later command covers the same scope plus more
- Remove an earlier command when nothing consumes its result before the broader
command
- Treat a result as consumed only when a later action depends on its output,
pass state, fail state, or produced artifact
- Compare semantic scope instead of command text
- Treat focused tests followed immediately by a containing test suite as one
check
- Keep the containing suite
- Remove the focused green run
- Treat one-file formatting followed by containing multi-file formatting as one
formatting action
- Keep the containing formatting action
- Remove the one-file action
- Treat a post-write existence/read-back check as dominated when the write
command already reports failure and a later formatter, parser, test, diff, or
review consumes the file
- Treat a final command or manual check as dominated when a task gate or
reviewer-fix gate covers the same current implementation state and semantic
scope
- In a one-task plan, presume the task gate remains valid through commit and
read-only review unless implementation content or semantic inputs change
- Do not preserve duplicate final commands as hypothetical fallback paths;
reviewer fixes run invalidated checks inside their fix loop
- Keep a focused TDD red run when implementation depends on its expected failure
- Keep a focused green run mid-implementation only when the next action depends
on it; do not repeat it as a pre-commit validation immediately before a
containing suite
- Keep both commands when the broader command does not execute the narrow check
- Keep both commands when an intervening action consumes the narrow result
- Reuse valid evidence when it covers the exact current content and semantic
scope
- Run a relevant full gate no more than once per implementation state; never
rerun it after read-only review or bookkeeping, and rerun it after a fix only
when narrower evidence cannot restore the required coverage
Decomposition
- Map files to create/modify + their responsibilities before defining tasks
- One responsibility per file. Group files that change together
- Follow existing patterns. Don't restructure unilaterally. Split an unwieldy
file only when modifying it
- Search the codebase for existing components/helpers/hooks/utilities first.
Reuse mandatory. Extend before creating
- Apply YAGNI. Prefer the fewest files and the smallest root-cause diff that
satisfies the source requirements
- Prefer existing code, then standard-library or native platform features, then
installed dependencies. Add an abstraction, dependency, configuration point,
fallback, or extension hook only when a current requirement needs it
- Do not prescribe unsolicited comments or documentation. Add a comment only
when required by the request or repo rules, or when a non-obvious invariant
cannot be expressed clearly in code
- Cover behavior realistically reachable through the supported UI, API, job, or
ordinary system operation
- Do not invent paranoid cases based on impossible states, deliberate internal
tampering, unsupported misuse, or hypothetical hacking mechanisms
- Include adversarial security cases only when explicitly required, when
untrusted input crosses a real trust boundary, or when evidence shows a
recognized industry exploit with credible impact in this application
- Never simplify away validation at a real trust boundary, data-loss prevention,
or an explicitly requested security measure
- Don't bundle unrelated changes because they touch nearby code
- Every task ends with the narrowest non-dominated
Green: proof selected from
its actual change impact
- Add an intermediate
Green: only when a later action consumes its result
- Prefer a paste-able command and observable token
- Use an exact procedure only for manual-only checks
- Keep TDD red inside its implementation step. Require assertion failure; fix
import/runtime setup before proceeding
- Run the task gate only as each task's last verification
- Merge tasks whose file sets overlap
- One task per file set, not one task per concern
- A task delivers one slice of working behavior plus its tests. Everything that
behavior needs to run — schema, storage, migration, table, helper, type —
belongs in the task that uses it, not a preceding one
- Never write a task whose only deliverable is a type, a schema, a constant, or
a stub that a later task consumes. Merge it into its consumer. Bookkeeping
tasks (commit the plan, tick the boxes) are exempt: they deliver no behavior
by design
- Every task dispatches a fresh implementer that reads this plan cold, so a task
that ships nothing still costs a full plan read
- Past ~8 tasks: merge or split into separate plans
- Rationale capped at 2 lines per constraint. Cite
path:line instead of
restating the argument
- State repo rules once in the shared preamble
- Collapse families of near-identical base cases (same assertion, different
input) unless they cover distinct code paths
Execution log
The plan goes stale during execution. Execution log is the record that keeps a
fresh agent correct when the task text no longer matches the repo.
Log an entry when execution contradicts or outgrows the plan:
drift: a plan fact turned out wrong (signature, path, return type, command,
dependency, existing helper)
gotcha: a non-obvious fact that cost time and would cost it again (required
build order, flaky fixture, env var, tool quirk, hidden coupling)
decision: a choice the plan left open, resolved during execution
Silence is the default. Most tasks log nothing. A task that went as planned
writes nothing at all: no entry, no placeholder, no none, no "no drift found".
An empty section already says it.
Do not log restated plan text, per-step narration, reviewer findings already in
Solved defects, or work that matched the plan.
Keep each entry to one line. Write what a fresh agent needs, not what happened.
- Wrong:
T2 | drift | had trouble with the parser and fixed it
- Right:
T2 | drift | plan assumed parse() -> str | repo returns Result; 3 callers updated
Correct the stale task text in place when the drift invalidates a later task's
instructions. The log records the change; the task text stays executable.
Tracking
Executing from a plan file: flip a task's - [ ] to - [x] after all nested
steps pass, including its task gate. Flip the task back before a reviewer fix.
Inline execution owns all boxes; in subagent mode, the current task implementer
owns its task and completed tasks changed by its reviewer fixes; the finalizer
owns final boxes and completed tasks changed by final-review fixes. Tasks
execute sequentially, so the plan has one writer at a time.
Also track progress in the harness native task/todo list.
Required skills (per step)
- Skills load at the step that needs them, not upfront
- Scan each step's footprint against skills listed in the current environment.
Use exact names. Do not invent or rename
- Signals: file extensions touched; frameworks/runtimes named; test
runners/config; specific imports; build/package managers; domain tooling (Git,
Obsidian, Slack, Jira, CI, Neovim, browsers)
- Add
**Skills (load if not already loaded):** line only on steps with a
match. No match -> no line
- Final-verification automated-evidence step always:
**Skills (load if not already loaded):** verification-before-completion
- Add
requesting-code-review only to a final-review step that can dispatch a
reviewer; omit it when reusable review evidence already supplies complete
coverage
- Load
verification-before-completion only after final review coverage has no
unresolved findings
- Any step that reads or replies to a bot review always:
**Skills (load if not already loaded):** replying-to-pr-review-threads
Review-related steps
Execution skills own implementation-review mechanics and PR creation. The plan
owns the final-review step inside its final-verification checkpoint. In subagent
mode, the finalizer executes that written checkpoint. Preserve a PR request in
Source requirements; the final execution owner loads create-pull-request
after final verification.
If the requested work itself reads external review output:
- Never narrow the applicable reviewer template or replace defect review with
plan conformance
- Read the full output, reconcile stated and observed finding counts, and do not
treat a green status as proof that review occurred
- Annotate bot-review steps with
replying-to-pr-review-threads; leave its
mechanics to that skill
Fresh reviewers receive the header's Solved defects list. Execution owners
record each fixed finding once as severity | path or symbol | invariant.
Plan document header
Every plan MUST start with this header:
# [Feature Name] Implementation Plan
> **For the executing agent:**
>
> 1. Read `Execution log` before the first task; it overrides stale plan text
> 2. Execute tasks in plan order
> 3. Load `executing-plans` when working from a saved plan
> 4. Append every drift, gotcha, and decision to `Execution log` before ticking
> its task
> 5. Tick a task after all its nested steps pass
> 6. Un-tick a task when a reviewer sends it back
> 7. Track progress in the harness task list
>
> **Plan ownership:**
>
> - One writer at a time
> - Inline execution: executing agent owns all plan state
> - Subagent execution: current task implementer owns its task state
> - Subagent execution: current task implementer owns completed-task state
> changed by its reviewer fixes
> - Finalizer: owns final state
> - Finalizer: owns completed-task state changed by final review
> - `Execution log`: the current task owner appends; earlier entries are
> append-only history
**Goal:** [One new observable behavior]
**Source requirements:**
1. `R1`: [Original user requirement]
2. `R2`: [Acceptance criterion]
3. `R3`: [Explicit must statement]
4. `R4`: [Explicit never statement]
**Execution mode:** [Subagent-Driven | Inline]
**Commit policy:** [Per-task commits | One commit at the end | No commits]
**Plan file policy:** [Include | Exclude]
**Additional plan state files:**
- none
**Solved defects:**
- none
**Execution log:**
---
Source requirements is required
- Record each original user ask
- Record each acceptance criterion
- Record each explicit must statement
- Record each explicit never statement
Additional plan state files is required
- Use
none as the only item when no additional state file exists
- Otherwise list each exact repo-relative path once and omit
none
- List only paths that exist before execution starts
- Do not list the plan file itself
- Record every required edit to these files in
Source requirements
- For a path shared by concurrent plans, record an exclusive owner or exact
turn protocol and require it before the edit
- Treat the required update delta as
execution-state, never implementation
scope. Preserve unrelated pre-existing content as baseline-only
Solved defects is required
- Keep
none until a reviewer finding is fixed
- Replace
none with unique regression-relevant entries
- Format each entry as
severity | path or symbol | invariant
Execution log is required as a heading, empty
- Write the heading with no body when drafting the plan
- Execution owners append entries; the plan writer never pre-fills it
- Never write
none, nothing found, or any placeholder under it. An empty
section already says nothing was found
- Format each entry as
<task id> | <kind> | <what the plan assumed> | <what is true and what changed>
kind is drift, gotcha, or decision
Skills are annotated per step, not in the header.
- Put every exact task-gate command directly in the task step that runs it
- Never point a task's verification step to the header or another plan section
- Put only exact commands for uncovered scope into the self-contained
final-verification checkpoint; record evidence reuse without copying commands
Detail calibration
Every step states what to build, constraints, and tests without dictating
derivable implementation.
Never write:
- "TBD", "TODO", "implement later", "fill in details"
- "Add appropriate error handling", "handle edge cases", "style nicely"
- "Write tests for the above" (without listing what to test)
- "Similar to Task N" (steps may be read out of order)
- Vague instructions such as "build the component"
- References to types/functions/methods not defined in any task
- Comments, abstractions, defensive branches, or tests for speculative future
needs and unreachable scenarios
Use verbatim content only for tricky config, signatures, and shell commands.
Describe test cases as inputs, outputs, and key assertions. Describe
implementation and layout as intent plus constraints.
Length
Every task's body is re-read cold by its implementer and its reviewer, so plan
length is paid per task, not once. Cut what no agent acts on:
- Design rationale for a decision already settled belongs in the slice's own
notes or an ADR, not in the plan body. Keep the decision, drop the argument
for it
- Repo rules, tool invocations, and conventions appear once in the shared
preamble, never restated per task
- Do not restate what a
path:line citation already shows
Floor — never cut into these. An implementer must reach Green: without
asking a question or re-deriving a decision:
- Signatures, types, exact constants, and named files
- Every constraint that changes behavior, and every base and edge case
- Anything a
## Detail calibration ban above would otherwise catch
If cutting a line would make a task ambiguous, keep the line. A short plan that
forces an implementer to guess costs a round trip and a drift entry; it does not
save time.
Cross-cutting constraints
- Commit and test-file conventions come from the target repo. Do not invent
either
- Design decisions affecting test assertions (ARIA roles, landmarks, semantic
HTML) locked in the plan. Styling can stay open
- Same constraint-detail level across steps of the same type
Self-review (run yourself, not a subagent)
After writing, re-check and fix inline:
- Coverage:
- Every captured source requirement appears in the header
- Every header source requirement maps to a task
- Every task maps to verification
Execution log heading is present and empty
- Ambiguity: remove every "Detail calibration" red flag
- Type consistency: signatures/names match across tasks (
clearLayers() in
Task 3 vs clearFullLayers() in Task 7 is a bug)
- Implementation leak: replace derivable bodies/tests with signatures,
constraints, and cases
- Reuse: anything created that already exists -> import or extend instead
- Safety: destructive operations match source requirements and target-repo
rules; every named error mapping has a step that handles it
- Scope discipline: remove unrequested comments, abstractions,
dependencies, configuration, fallback paths, defensive branches, and tests
- Reachability: every case is reachable through a supported flow or a real
trust boundary; speculative tampering requires an explicit requirement or
evidence of a recognized exploit with credible impact
- Verification:
- Remove repeated
Green: checks
- Remove standalone red phases
- Require exact impact-appropriate commands in each task's last verification
step
- Require one plan-level final-verification checkpoint after all tasks
- Put final review coverage inside the final-verification checkpoint
- Reuse a one-task or final cumulative task review when it covers the
unchanged complete implementation
- Dispatch final review only for uncovered review scope
- Require no unresolved final-review findings before final validation
- Establish complete final evidence once after the final-review fix loop,
reusing valid task and reviewer-fix evidence
- Require every newly listed final command to be exact
- Require every newly listed final manual procedure to be exact
- Reject a separate plan-level final-review task
- Reject verification commands that reference another plan section
- Reject checks unrelated to the changed file categories or behavior
- Combine per-file formatter/linter invocations by tool
- Reject post-write existence/read-back checks already proved downstream
- Reject a narrow green check immediately followed by a containing suite
when no intervening action consumes it
- Reject a full gate before final verification unless a one-task or
last-task gate covers the complete implementation and final verification
reuses it
- Reject final commands or manual checks already covered by still-valid
task-gate or reviewer-fix evidence
- Require a zero-command final-validation path for one-task plans whose
task gate covers the complete implementation
- Task overlap: list each task's file set. Overlapping sets -> merge the
tasks
- Repetition: move repeated repo rules and conventions to the preamble
- Commit cadence: checkpoint count and placement match the header policy;
the conditional final-review-fixes commit follows final verification; all
plan-state inclusion matches
Plan file policy; no checkpoint freezes
commands, messages, or paths; every additional state-file edit maps to a
source requirement
- Review duplication: remove implementation-review steps owned by
executing-plans. For requested external-review work, reject narrowed,
conformance-only, truncated, or status-only review
- Readability:
- Every task is a checkbox
- Every step is a nested numbered item
- Every action has its own list item
- Every idea has its own list item or justified paragraph
- Every paragraph is correctly indented
- Every paragraph adds necessary non-action context
- Duplicate work:
- Build the ordered command sequence for every task
- Compare test scopes
- Compare formatting scopes
- Compare lint scopes
- Compare type-check scopes
- Compare build scopes
- Remove each dominated command
- Keep an earlier command only when a later action consumes its result
- Group applicable paths into one invocation per tool
- Confirm every remaining command is justified by the change impact
- Compare task and reviewer-fix evidence with final-validation scope
- Remove final fallback copies of already-covered commands and procedures
- Remove tests, type checks, builds, and full gates invalidated only by
semantic-neutral comments or canonical formatter output
Plan reviewer
After self-review, dispatch one subagent using plan-reviewer-prompt.md.
Dispatch payload. Do NOT read or open plan-reviewer-prompt.md yourself, the
subagent reads it; reading it into your own context defeats the offload:
1. Read <skill_dir>/plan-reviewer-prompt.md first
2. Do not continue until the read completes
3. Apply these values
- skill_path = <abs path to this SKILL.md>
- plan_path = <abs path>
- repo_root = <abs path>
- source_requirements = <review_source_requirements captured before drafting>
<skill_dir> is this file's directory
- Substitute absolute paths
- Pass
review_source_requirements directly
- Do not derive reviewer input from the finished plan
- Pass the pointer and values
- Do not pass the template body
The reviewer audits the concrete plan for dominated work:
- Compare commands by semantic scope
- Check execution order
- Check whether an intervening action consumes the earlier result
- Check every command against the file categories and behavior it validates
- Reject per-file invocations when one invocation can cover the same files
- Reject existence/read-back checks already proved by a downstream consumer
- Reject tests, type checks, and builds unrelated to the planned diff
- Reject a full gate before final verification unless a one-task or last-task
gate covers the complete implementation and final verification reuses it
- Reject checks separately repeated immediately before a full-gate command that
contains them
- Reject final commands and procedures already covered by valid task or
reviewer-fix evidence, especially in one-task plans
- Reject final review dispatch already covered by a valid one-task or cumulative
task review
- Report an earlier dominated command as at least Important
- Do not limit this audit to identical command text
Flow:
- Reviewer returns
PASS or terse Critical/Important findings
- Fix blocking issues inline
- Re-review only if fixes could introduce new defects: changed architecture,
direction, tasks, boundaries, ordering, file ownership, verification, or test
expectations. Skip for surgical/wording/style fixes
- Cap at 3 dispatches. Blocking issues remain after the 3rd -> escalate
Review depth: a dispatched review must be a good review. Escalate a thin one
rather than accepting it.
Execution mode handoff
Write the resolved mode into the plan header, then save the plan. Report the
plan path and recorded mode. Do not ask during handoff.
Subagent-Driven -> REQUIRED SUB-SKILL: subagent-driven-development
Inline -> REQUIRED SUB-SKILL: executing-plans
1---2name: writing-plans3description: Create a written implementation plan saved to a file. Use only when the user directly invokes the writing-plans skill or explicitly asks for a written plan. Do not use for in-memory plans, in-chat plans, internal task decomposition, native task lists, or ordinary multi-step implementation.4---56# Writing plans78Write self-contained implementation plans for an agent with zero repo context.9Assume a skilled engineer who does not know the repo or domain. Name files,10behavior, constraints, and verification. Keep tasks bite-sized and apply DRY,11YAGNI, and TDD.1213**Announce at start:** "I'm using the writing-plans skill to create the14implementation plan."1516## Terms1718- **Green:** a paste-able command emits an observable success token (exit 0,19 `PASS`, `0 errors`, artifact). Manual-only checks name an exact procedure and20 expected observation. Every task and checkpoint ends green21- **Task:** one checkbox-tracked, committable unit with a shared file set22- **Step:** one numbered action nested under its task. A later task-level check23 may verify it24- **Substep:** one numbered action nested under a step when that step needs an25 ordered breakdown26- **Bootstrap stubs:** minimal types/signatures that make tests _run_ (not pass)27 - Put empty bodies, `NotImplementedError`, or wrong defaults inside the28 implementation step29 - Use a separate step only when a later task imports the new symbol30- **Task gate:** the smallest non-dominated set of checks that proves one task's31 changed files and behavior are commit-safe32- **Full gate:** the project's whole validation suite. Run it no more than once33 per relevant implementation state and only when the diff or repo policy34 requires it. A one-task or last-task gate may own it when that result covers35 the complete implementation; final verification reuses it while that state36 remains unchanged37- **Narrow gate:** the single test file or single check a step actually affects38- **Dominated check:** an earlier check fully covered by a later check when39 nothing consumes the earlier result before the later check40- **Footprint:** the files, frameworks, runtimes, imports, and tooling a step41 touches - scanned to match skills4243## Task formatting4445- Write each task as one top-level checkbox item: `- [ ] **Task N: ...**`46- Give each task title one umbrella outcome47- Never join separate task outcomes with `and`48- Split tasks when no single outcome covers their steps and their file sets do49 not overlap50- State one observable behavior in `Goal`51- Nest every step under its task as a numbered list52- Nest ordered substeps under the step they implement53- Put one action or idea in each list item. Never join actions in a prose line54 or paragraph55- Indent all task content under the task checkbox. Indent all step content under56 its numbered item57- Use a paragraph only for non-action context that materially helps execution,58 such as an edge case, constraint rationale, caveat, or justification59- Keep each paragraph to one idea. Place it directly under the task, step, or60 substep it qualifies; do not use it to hide a sequence of actions61- Prefer a labeled paragraph such as `**Edge case:**`, `**Constraint:**`, or62 `**Why:**` when the relationship is not obvious63- Apply this structure to every plan section, including tasks, checkpoints,64 header fields, and handoff text6566## Worked example (the shape every task follows)6768Python here; use the same shape in any language.6970```markdown71- [ ] **Task N: [Observable outcome]**7273 **Goal:** [One new observable behavior]7475 **Files:**7677 - `exact/path/to/file.py`78 - Responsibility: validate input79 - Output: `Result`80 - Reuse: `LibraryThing` from `exact/path/to/lib.py`81 - `exact/path/to/file.test.py`82 - Base-case coverage for `function()`83 - Edge-case coverage for `function()`84 1. **Implement `function()` with TDD**8586 **Skills (load if not already loaded):** `<test-runner-skill>`,87 `<language-skill>`8889 1. Stub the final `Result` signature90 2. Stub the final `function()` signature with a wrong body91 3. Write tests for the base cases92 4. Run the narrow gate93 - Require assertion failures94 - Require no import errors95 - Require no runtime errors96 5. Implement the constraints9798 **Signature:** `def function(input: str) -> Result`99100 **Constraints:**101102 - Accept X103 - Validate Y104 - Return Z105 - Use `LibraryThing` for heavy lifting106 - Return `Result.empty()` for empty input107108 **Base cases:**109110 - `function("valid")` -> `Result(value="valid")`111 - `function("")` -> `Result.empty()`112 - `function(None)` raises `ValueError`113114 **Edge case:** Unicode normalization can change equality without changing115 the visible value.116117 2. **Run the task gate once**118119 1. `[one formatter command listing every applicable task file]`120 - Omit when no changed file is covered by that tool121 - Expected: exit 0122 2. `[one linter command listing every applicable task file]`123 - Omit when no changed file is covered by that tool124 - Expected: exit 0125 3. `[affected test command]`126 - Omit when an unchanged valid result already covers the final task diff127 - Expected: exit 0128129 Green: every applicable non-dominated check exits 0.130```131132## Plan location133134- Plan ALWAYS lives in a file. Subagents have no session memory; the file is the135 only source of truth136- Already in a plan file: preserve content outside the requested changes137- Not saved: default `docs/plans/YYYY-MM-DD-<feature-name>.md`. User may pick138 another path139- A caller-supplied plan path is authoritative and overrides the default140- User refuses to save to any file: STOP141- Saving does not commit the plan. Record whether execution commits the plan142 file; default to included unless the user explicitly excludes it143- `Additional plan state files` are optional tracker documents that execution144 updates with the plan, such as a milestone index145- Every additional state path must exist before execution starts146- When concurrent plans share an additional state file, name its exclusive owner147 or exact turn protocol in `Source requirements` and the written update148 checkpoint. Without that ownership gate, require sequential execution149- `Plan file policy` applies to the plan file and every additional plan state150 file as one policy151152## Review source153154- Capture `review_source_requirements` before drafting the plan155- Preserve the user's original asks156- Preserve the user's acceptance criteria157- Preserve every explicit must statement158- Preserve every explicit never statement159- Preserve each user-provided source-spec path160- Keep this capture independent from the drafted plan161- Do not reconstruct it from the finished plan162- After context compaction, stop and request the source again when the capture163 is unavailable164- Derive the header's `Source requirements` from this capture165166## Commit policy167168Before writing, resolve the commit policy from the request. When the request169does not specify one, use `Per-task commits`. Record170`Plan file policy: Include | Exclude`; default to `Include` unless requested.171Apply it to the plan file and all `Additional plan state files`. Record exact172repo-relative additional paths, or `none` when no other state file exists.173`Plan state` means the plan file plus every listed additional state file.174175Record the choice in the header and encode it with commit checkboxes:176177- `Per-task commits`: append one unchecked checkpoint to every task, the178 unchecked conditional final-review-fixes commit checkpoint after final179 verification, then a final-state commit checkpoint when the plan file is180 included181- `One commit at the end`: append one commit checkpoint after final verification182- `No commits`: write no commit checkpoints183184Every plan ends with one self-contained final-verification checkpoint after all185tasks.186187- Build a review-evidence map from completed task reviews before dispatching a188 final reviewer189- Reuse a task review when it covers the complete current implementation. This190 is normally true for a one-task plan and for the last cumulative task review191 when no implementation content or semantic input changed afterward192- Dispatch a final reviewer only for review scope not already covered193- Build an evidence map from completed task gates and reviewer-fix gates before194 adding final commands195- Add a final command only for applicable scope not already covered by valid196 evidence197- A commit, read-only review, checkbox update, or other bookkeeping does not198 invalidate evidence unless it changes implementation content or the check's199 semantic inputs200- For a one-task plan, list no final automated or manual checks when the task201 gate covers the complete implementation and the review-fix loop reruns every202 check invalidated by a fix203- Apply the same rule when the last task gate already covers the complete204 implementation: do not repeat it at final verification205- Do not copy task-gate commands into final verification as fallback commands206- Batch all files accepted by the same formatter, linter, or checker into one207 invocation208- Put final review coverage inside the checkpoint209- Require no unresolved final-review findings before final validation210- Run only checks invalidated by final-review fixes; prefer narrow checks and211 rerun a full gate only when narrower evidence cannot restore required coverage212- Reuse a valid task-gate or reviewer-fix result when it covers the current213 implementation state and semantic scope214- Run the project's full gate only when source, tests, build inputs, tool215 config, generated artifacts, repo policy, or uncovered cross-task integration216 makes it relevant217- When one full-gate command covers selected checks, omit every contained218 formatter, linter, type-check, build, and test command219- Do not run unit tests, type checks, or builds for documentation-only changes220 unless the repo explicitly makes those checks applicable221- Add an exact build command only when relevant and not already covered222- Add an exact documentation command only when relevant and not already covered223- Add each required manual check as an exact procedure224- Give each manual check one expected observation225- Remove every unused command or check placeholder226- Never point final validation commands or manual checks to another plan section227228```markdown229- [ ] **Final verification checkpoint**230231 1. **Close final review coverage**232233 **Skills (load if not already loaded):** `requesting-code-review`234235 Omit the skills line and dispatch step when reusable task-review evidence236 already covers the complete current implementation.237238 1. Reuse a task-review result when it covers the complete current239 implementation240 2. Dispatch a fresh code-quality reviewer only when complete review241 coverage remains missing242 3. Resolve each substantiated finding243 1. Verify its cited evidence244 2. Apply the narrowest valid fix245 3. Update `Solved defects`246 4. Run only checks invalidated by the fix247 - Prefer affected narrow gates248 - Rerun a full gate only when narrower evidence cannot restore its249 required coverage250 4. Re-dispatch after a behavioral fix round251 5. Do not re-dispatch after an all-static fix round when its affected gates252 pass253 6. Require reusable review coverage, `PASS`, or fully discharged findings254255 2. **Close uncovered automated evidence**256257 **Skills (load if not already loaded):** `verification-before-completion`258259 1. Reuse every task-gate and reviewer-fix result that covers the current260 implementation state and semantic scope261 2. Run `[exact command for uncovered applicable scope]`262 - Omit this step when reusable evidence covers all applicable scope263 - Expected: exit 0264265 3. **Close uncovered manual evidence**266267 1. Reuse every valid task or reviewer-fix observation that covers the268 current implementation state269 2. Perform `[exact manual procedure for uncovered applicable behavior]`270 - Omit this step when reusable observations cover all applicable271 behavior272 - Expected: `[observable result]`273274 Green:275276 - Final code-quality review has no unresolved findings277 - Reused and newly collected evidence covers every applicable check for the278 current implementation state279```280281Commit checkpoints contain no command, message, or fixed file list. The owner282derives all three from the actual diff at checkpoint time.283284```markdown285- [ ] **Commit task N**286287 **Skills (load if not already loaded):** `git-commit-message`288289 1. Resolve the checkpoint's verified change set from the current diff290 2. Include current plan-state changes when `Plan file policy` is `Include`291 3. Derive the paths from the resolved change set292 4. Derive the message from the resolved change set293 5. Commit the resolved change set294295 Green:296297 - New commit contains the checkpoint's complete verified diff298 - No intended checkpoint changes remain uncommitted299```300301For `One commit at the end`, place this immediately after the final-verification302checkpoint:303304```markdown305- [ ] **Final commit checkpoint: whole plan**306307 **Skills (load if not already loaded):** `git-commit-message`308309 1. Resolve the complete reviewed change set from the current diff310 2. Include current plan-state changes when `Plan file policy` is `Include`311 3. Derive the paths from the resolved change set312 4. Derive the message from the resolved change set313 5. Commit the resolved change set314315 Green:316317 - New commit contains the complete reviewed plan diff318 - No intended plan changes remain uncommitted319```320321For `Per-task commits`, place this immediately after the final-verification322checkpoint:323324```markdown325- [ ] **Conditional commit checkpoint: final-review fixes**326327 **Default:** No final-review changes.328329 **Skills (load if not already loaded):** `git-commit-message`330331 1. Determine whether the final-verification checkpoint changed files332 2. When no final-review fixes exist, tick this checkpoint without committing333 3. When final-review fixes exist, resolve their verified change set from the334 current diff335 4. Include current plan-state changes when `Plan file policy` is `Include`336 5. Derive the paths from the resolved change set337 6. Derive the message from the resolved change set338 7. When `Plan file policy` is `Include`, tick this checkpoint before staging339 8. Commit the resolved change set340 9. When `Plan file policy` is `Exclude`, tick this checkpoint after the commit341342 Green:343344 - No-change path345 - No final-review changes exist346 - Fix path347 - One commit contains all verified final-review fixes348 - No intended checkpoint changes remain uncommitted349```350351Under `Per-task commits`, when `Plan file policy` is `Include`, place this after352the conditional final-review-fixes commit checkpoint:353354```markdown355- [ ] **Final state commit checkpoint**356357 **Skills (load if not already loaded):** `git-commit-message`358359 1. Resolve the final verified plan-state change set from the current diff360 2. Derive the paths from the resolved change set361 3. Derive the message from the resolved change set362 4. Commit the resolved change set363364 Green:365366 - Final plan state is committed367 - No intended checkpoint changes remain uncommitted368```369370Under `Per-task commits`, the task owner commits after its task gate, then371summons reviewers. Each task-review fix round gets one follow-up commit. Keep372final-review fixes uncommitted through re-review. Commit them once after final373verification passes. On the no-change path, tick after confirming no374final-review fixes exist. On the fix path with `Plan file policy: Include`, tick375immediately before staging and restore `[ ]` whenever scope resolution, staging,376or commit fails. With `Plan file policy: Exclude`, tick only after the commit377succeeds.378379If `No commits` and a PR are both requested, record an external-commit handoff:380the executor stops before PR creation, supplies the exact reviewed plan-owned381change set, and verifies the resulting branch contains no baseline-only work.382383## Execution mode384385Before writing, resolve the execution mode from the request. When the request386does not specify one, use `Subagent-Driven`. Record the exact choice in the plan387header.388389## Scope check390391- Spec covers multiple independent subsystems: suggest splitting into separate392 plans, one per subsystem393- Each plan must produce working, testable software on its own394395## Verification deduplication396397- Classify each changed file before selecting commands: documentation, source,398 test, build/tool config, generated artifact, or other399- Map each command to the changed paths or behavior that justify it400- Omit a command when no changed path or repo rule makes it applicable401- Documentation-only changes do not justify unit tests, type checks, or builds402 by default403- A test-only change justifies the affected tests, not an unrelated full suite404- Build or tool-config changes justify only the checks whose behavior they can405 alter406- A comment-only source change does not justify tests, type checks, builds, or a407 full gate when comments have no executable role408- Treat directives, suppressions, pragmas, doctests, generated-documentation409 inputs, shebangs, encoding declarations, and format-sensitive metadata as410 executable rather than comment-only411- Canonical formatter-only output does not justify tests, type checks, builds,412 or a full gate when formatter configuration and semantic inputs are unchanged413- Formatting or lint checks may still be applicable to comment-only and414 formatter-only changes415- List verification and formatting commands in execution order before writing416 them into tasks417- Batch all applicable files into one formatter/linter invocation when the tool418 accepts multiple paths; never emit one invocation per file419- Remove an earlier command when a later command covers the same scope plus more420- Remove an earlier command when nothing consumes its result before the broader421 command422- Treat a result as consumed only when a later action depends on its output,423 pass state, fail state, or produced artifact424- Compare semantic scope instead of command text425- Treat focused tests followed immediately by a containing test suite as one426 check427 - Keep the containing suite428 - Remove the focused green run429- Treat one-file formatting followed by containing multi-file formatting as one430 formatting action431 - Keep the containing formatting action432 - Remove the one-file action433- Treat a post-write existence/read-back check as dominated when the write434 command already reports failure and a later formatter, parser, test, diff, or435 review consumes the file436- Treat a final command or manual check as dominated when a task gate or437 reviewer-fix gate covers the same current implementation state and semantic438 scope439- In a one-task plan, presume the task gate remains valid through commit and440 read-only review unless implementation content or semantic inputs change441- Do not preserve duplicate final commands as hypothetical fallback paths;442 reviewer fixes run invalidated checks inside their fix loop443- Keep a focused TDD red run when implementation depends on its expected failure444- Keep a focused green run mid-implementation only when the next action depends445 on it; do not repeat it as a pre-commit validation immediately before a446 containing suite447- Keep both commands when the broader command does not execute the narrow check448- Keep both commands when an intervening action consumes the narrow result449- Reuse valid evidence when it covers the exact current content and semantic450 scope451- Run a relevant full gate no more than once per implementation state; never452 rerun it after read-only review or bookkeeping, and rerun it after a fix only453 when narrower evidence cannot restore the required coverage454455## Decomposition456457- Map files to create/modify + their responsibilities before defining tasks458- One responsibility per file. Group files that change together459- Follow existing patterns. Don't restructure unilaterally. Split an unwieldy460 file only when modifying it461- Search the codebase for existing components/helpers/hooks/utilities first.462 Reuse mandatory. Extend before creating463- Apply YAGNI. Prefer the fewest files and the smallest root-cause diff that464 satisfies the source requirements465- Prefer existing code, then standard-library or native platform features, then466 installed dependencies. Add an abstraction, dependency, configuration point,467 fallback, or extension hook only when a current requirement needs it468- Do not prescribe unsolicited comments or documentation. Add a comment only469 when required by the request or repo rules, or when a non-obvious invariant470 cannot be expressed clearly in code471- Cover behavior realistically reachable through the supported UI, API, job, or472 ordinary system operation473- Do not invent paranoid cases based on impossible states, deliberate internal474 tampering, unsupported misuse, or hypothetical hacking mechanisms475- Include adversarial security cases only when explicitly required, when476 untrusted input crosses a real trust boundary, or when evidence shows a477 recognized industry exploit with credible impact in this application478- Never simplify away validation at a real trust boundary, data-loss prevention,479 or an explicitly requested security measure480- Don't bundle unrelated changes because they touch nearby code481- Every task ends with the narrowest non-dominated `Green:` proof selected from482 its actual change impact483- Add an intermediate `Green:` only when a later action consumes its result484- Prefer a paste-able command and observable token485- Use an exact procedure only for manual-only checks486- Keep TDD red inside its implementation step. Require assertion failure; fix487 import/runtime setup before proceeding488- Run the task gate only as each task's last verification489- Merge tasks whose file sets overlap490- One task per file set, not one task per concern491- A task delivers one slice of working behavior plus its tests. Everything that492 behavior needs to run — schema, storage, migration, table, helper, type —493 belongs in the task that uses it, not a preceding one494- Never write a task whose only deliverable is a type, a schema, a constant, or495 a stub that a later task consumes. Merge it into its consumer. Bookkeeping496 tasks (commit the plan, tick the boxes) are exempt: they deliver no behavior497 by design498- Every task dispatches a fresh implementer that reads this plan cold, so a task499 that ships nothing still costs a full plan read500- Past ~8 tasks: merge or split into separate plans501- Rationale capped at 2 lines per constraint. Cite `path:line` instead of502 restating the argument503- State repo rules once in the shared preamble504- Collapse families of near-identical base cases (same assertion, different505 input) unless they cover distinct code paths506507## Execution log508509The plan goes stale during execution. `Execution log` is the record that keeps a510fresh agent correct when the task text no longer matches the repo.511512Log an entry when execution contradicts or outgrows the plan:513514- `drift`: a plan fact turned out wrong (signature, path, return type, command,515 dependency, existing helper)516- `gotcha`: a non-obvious fact that cost time and would cost it again (required517 build order, flaky fixture, env var, tool quirk, hidden coupling)518- `decision`: a choice the plan left open, resolved during execution519520Silence is the default. Most tasks log nothing. A task that went as planned521writes nothing at all: no entry, no placeholder, no `none`, no "no drift found".522An empty section already says it.523524Do not log restated plan text, per-step narration, reviewer findings already in525`Solved defects`, or work that matched the plan.526527Keep each entry to one line. Write what a fresh agent needs, not what happened.528529- Wrong: `T2 | drift | had trouble with the parser and fixed it`530- Right:531 `T2 | drift | plan assumed parse() -> str | repo returns Result; 3 callers updated`532533Correct the stale task text in place when the drift invalidates a later task's534instructions. The log records the change; the task text stays executable.535536## Tracking537538Executing from a plan file: flip a task's `- [ ]` to `- [x]` after all nested539steps pass, including its task gate. Flip the task back before a reviewer fix.540Inline execution owns all boxes; in subagent mode, the current task implementer541owns its task and completed tasks changed by its reviewer fixes; the finalizer542owns final boxes and completed tasks changed by final-review fixes. Tasks543execute sequentially, so the plan has one writer at a time.544545Also track progress in the harness native task/todo list.546547## Required skills (per step)548549- Skills load at the step that needs them, not upfront550- Scan each step's footprint against skills listed in the current environment.551 Use exact names. Do not invent or rename552- Signals: file extensions touched; frameworks/runtimes named; test553 runners/config; specific imports; build/package managers; domain tooling (Git,554 Obsidian, Slack, Jira, CI, Neovim, browsers)555- Add `**Skills (load if not already loaded):**` line only on steps with a556 match. No match -> no line557- Final-verification automated-evidence step always:558 `**Skills (load if not already loaded):** verification-before-completion`559- Add `requesting-code-review` only to a final-review step that can dispatch a560 reviewer; omit it when reusable review evidence already supplies complete561 coverage562- Load `verification-before-completion` only after final review coverage has no563 unresolved findings564- Any step that reads or replies to a bot review always:565 `**Skills (load if not already loaded):** replying-to-pr-review-threads`566567## Review-related steps568569Execution skills own implementation-review mechanics and PR creation. The plan570owns the final-review step inside its final-verification checkpoint. In subagent571mode, the finalizer executes that written checkpoint. Preserve a PR request in572`Source requirements`; the final execution owner loads `create-pull-request`573after final verification.574575If the requested work itself reads external review output:576577- Never narrow the applicable reviewer template or replace defect review with578 plan conformance579- Read the full output, reconcile stated and observed finding counts, and do not580 treat a green status as proof that review occurred581- Annotate bot-review steps with `replying-to-pr-review-threads`; leave its582 mechanics to that skill583584Fresh reviewers receive the header's **Solved defects** list. Execution owners585record each fixed finding once as `severity | path or symbol | invariant`.586587## Plan document header588589**Every plan MUST start with this header:**590591```markdown592# [Feature Name] Implementation Plan593594> **For the executing agent:**595>596> 1. Read `Execution log` before the first task; it overrides stale plan text597> 2. Execute tasks in plan order598> 3. Load `executing-plans` when working from a saved plan599> 4. Append every drift, gotcha, and decision to `Execution log` before ticking600> its task601> 5. Tick a task after all its nested steps pass602> 6. Un-tick a task when a reviewer sends it back603> 7. Track progress in the harness task list604>605> **Plan ownership:**606>607> - One writer at a time608> - Inline execution: executing agent owns all plan state609> - Subagent execution: current task implementer owns its task state610> - Subagent execution: current task implementer owns completed-task state611> changed by its reviewer fixes612> - Finalizer: owns final state613> - Finalizer: owns completed-task state changed by final review614> - `Execution log`: the current task owner appends; earlier entries are615> append-only history616617**Goal:** [One new observable behavior]618619**Source requirements:**6206211. `R1`: [Original user requirement]6222. `R2`: [Acceptance criterion]6233. `R3`: [Explicit must statement]6244. `R4`: [Explicit never statement]625626**Execution mode:** [Subagent-Driven | Inline]627628**Commit policy:** [Per-task commits | One commit at the end | No commits]629630**Plan file policy:** [Include | Exclude]631632**Additional plan state files:**633634- none635636**Solved defects:**637638- none639640**Execution log:**641642---643```644645- `Source requirements` is required646 - Record each original user ask647 - Record each acceptance criterion648 - Record each explicit must statement649 - Record each explicit never statement650- `Additional plan state files` is required651 - Use `none` as the only item when no additional state file exists652 - Otherwise list each exact repo-relative path once and omit `none`653 - List only paths that exist before execution starts654 - Do not list the plan file itself655 - Record every required edit to these files in `Source requirements`656 - For a path shared by concurrent plans, record an exclusive owner or exact657 turn protocol and require it before the edit658 - Treat the required update delta as `execution-state`, never implementation659 scope. Preserve unrelated pre-existing content as `baseline-only`660- `Solved defects` is required661 - Keep `none` until a reviewer finding is fixed662 - Replace `none` with unique regression-relevant entries663 - Format each entry as `severity | path or symbol | invariant`664- `Execution log` is required as a heading, empty665 - Write the heading with no body when drafting the plan666 - Execution owners append entries; the plan writer never pre-fills it667 - Never write `none`, `nothing found`, or any placeholder under it. An empty668 section already says nothing was found669 - Format each entry as670 `<task id> | <kind> | <what the plan assumed> | <what is true and what changed>`671 - `kind` is `drift`, `gotcha`, or `decision`672673Skills are annotated per step, not in the header.674675- Put every exact task-gate command directly in the task step that runs it676- Never point a task's verification step to the header or another plan section677- Put only exact commands for uncovered scope into the self-contained678 final-verification checkpoint; record evidence reuse without copying commands679680## Detail calibration681682Every step states what to build, constraints, and tests without dictating683derivable implementation.684685Never write:686687- "TBD", "TODO", "implement later", "fill in details"688- "Add appropriate error handling", "handle edge cases", "style nicely"689- "Write tests for the above" (without listing what to test)690- "Similar to Task N" (steps may be read out of order)691- Vague instructions such as "build the component"692- References to types/functions/methods not defined in any task693- Comments, abstractions, defensive branches, or tests for speculative future694 needs and unreachable scenarios695696Use verbatim content only for tricky config, signatures, and shell commands.697Describe test cases as inputs, outputs, and key assertions. Describe698implementation and layout as intent plus constraints.699700### Length701702Every task's body is re-read cold by its implementer and its reviewer, so plan703length is paid per task, not once. Cut what no agent acts on:704705- Design rationale for a decision already settled belongs in the slice's own706 notes or an ADR, not in the plan body. Keep the decision, drop the argument707 for it708- Repo rules, tool invocations, and conventions appear once in the shared709 preamble, never restated per task710- Do not restate what a `path:line` citation already shows711712**Floor — never cut into these.** An implementer must reach `Green:` without713asking a question or re-deriving a decision:714715- Signatures, types, exact constants, and named files716- Every constraint that changes behavior, and every base and edge case717- Anything a `## Detail calibration` ban above would otherwise catch718719If cutting a line would make a task ambiguous, keep the line. A short plan that720forces an implementer to guess costs a round trip and a drift entry; it does not721save time.722723## Cross-cutting constraints724725- Commit and test-file conventions come from the target repo. Do not invent726 either727- Design decisions affecting test assertions (ARIA roles, landmarks, semantic728 HTML) locked in the plan. Styling can stay open729- Same constraint-detail level across steps of the same type730731## Self-review (run yourself, not a subagent)732733After writing, re-check and fix inline:7347351. **Coverage:**736 1. Every captured source requirement appears in the header737 2. Every header source requirement maps to a task738 3. Every task maps to verification739 4. `Execution log` heading is present and empty7402. **Ambiguity:** remove every "Detail calibration" red flag7413. **Type consistency:** signatures/names match across tasks (`clearLayers()` in742 Task 3 vs `clearFullLayers()` in Task 7 is a bug)7434. **Implementation leak:** replace derivable bodies/tests with signatures,744 constraints, and cases7455. **Reuse:** anything created that already exists -> import or extend instead7466. **Safety:** destructive operations match source requirements and target-repo747 rules; every named error mapping has a step that handles it7487. **Scope discipline:** remove unrequested comments, abstractions,749 dependencies, configuration, fallback paths, defensive branches, and tests7508. **Reachability:** every case is reachable through a supported flow or a real751 trust boundary; speculative tampering requires an explicit requirement or752 evidence of a recognized exploit with credible impact7539. **Verification:**754 1. Remove repeated `Green:` checks755 2. Remove standalone red phases756 3. Require exact impact-appropriate commands in each task's last verification757 step758 4. Require one plan-level final-verification checkpoint after all tasks759 5. Put final review coverage inside the final-verification checkpoint760 6. Reuse a one-task or final cumulative task review when it covers the761 unchanged complete implementation762 7. Dispatch final review only for uncovered review scope763 8. Require no unresolved final-review findings before final validation764 9. Establish complete final evidence once after the final-review fix loop,765 reusing valid task and reviewer-fix evidence766 10. Require every newly listed final command to be exact767 11. Require every newly listed final manual procedure to be exact768 12. Reject a separate plan-level final-review task769 13. Reject verification commands that reference another plan section770 14. Reject checks unrelated to the changed file categories or behavior771 15. Combine per-file formatter/linter invocations by tool772 16. Reject post-write existence/read-back checks already proved downstream773 17. Reject a narrow green check immediately followed by a containing suite774 when no intervening action consumes it775 18. Reject a full gate before final verification unless a one-task or776 last-task gate covers the complete implementation and final verification777 reuses it778 19. Reject final commands or manual checks already covered by still-valid779 task-gate or reviewer-fix evidence780 20. Require a zero-command final-validation path for one-task plans whose781 task gate covers the complete implementation78210. **Task overlap:** list each task's file set. Overlapping sets -> merge the783 tasks78411. **Repetition:** move repeated repo rules and conventions to the preamble78512. **Commit cadence:** checkpoint count and placement match the header policy;786 the conditional final-review-fixes commit follows final verification; all787 plan-state inclusion matches `Plan file policy`; no checkpoint freezes788 commands, messages, or paths; every additional state-file edit maps to a789 source requirement79013. **Review duplication:** remove implementation-review steps owned by791 `executing-plans`. For requested external-review work, reject narrowed,792 conformance-only, truncated, or status-only review79314. **Readability:**794 1. Every task is a checkbox795 2. Every step is a nested numbered item796 3. Every action has its own list item797 4. Every idea has its own list item or justified paragraph798 5. Every paragraph is correctly indented799 6. Every paragraph adds necessary non-action context80015. **Duplicate work:**801 1. Build the ordered command sequence for every task802 2. Compare test scopes803 3. Compare formatting scopes804 4. Compare lint scopes805 5. Compare type-check scopes806 6. Compare build scopes807 7. Remove each dominated command808 8. Keep an earlier command only when a later action consumes its result809 9. Group applicable paths into one invocation per tool810 10. Confirm every remaining command is justified by the change impact811 11. Compare task and reviewer-fix evidence with final-validation scope812 12. Remove final fallback copies of already-covered commands and procedures813 13. Remove tests, type checks, builds, and full gates invalidated only by814 semantic-neutral comments or canonical formatter output815816## Plan reviewer817818After self-review, dispatch one subagent using `plan-reviewer-prompt.md`.819820Dispatch payload. Do NOT read or open `plan-reviewer-prompt.md` yourself, the821subagent reads it; reading it into your own context defeats the offload:822823```text8241. Read <skill_dir>/plan-reviewer-prompt.md first8252. Do not continue until the read completes8263. Apply these values827 - skill_path = <abs path to this SKILL.md>828 - plan_path = <abs path>829 - repo_root = <abs path>830 - source_requirements = <review_source_requirements captured before drafting>831```832833- `<skill_dir>` is this file's directory834- Substitute absolute paths835- Pass `review_source_requirements` directly836- Do not derive reviewer input from the finished plan837- Pass the pointer and values838- Do not pass the template body839840The reviewer audits the concrete plan for dominated work:841842- Compare commands by semantic scope843- Check execution order844- Check whether an intervening action consumes the earlier result845- Check every command against the file categories and behavior it validates846- Reject per-file invocations when one invocation can cover the same files847- Reject existence/read-back checks already proved by a downstream consumer848- Reject tests, type checks, and builds unrelated to the planned diff849- Reject a full gate before final verification unless a one-task or last-task850 gate covers the complete implementation and final verification reuses it851- Reject checks separately repeated immediately before a full-gate command that852 contains them853- Reject final commands and procedures already covered by valid task or854 reviewer-fix evidence, especially in one-task plans855- Reject final review dispatch already covered by a valid one-task or cumulative856 task review857- Report an earlier dominated command as at least Important858- Do not limit this audit to identical command text859860Flow:8618621. Reviewer returns `PASS` or terse Critical/Important findings8632. Fix blocking issues inline8643. Re-review only if fixes could introduce new defects: changed architecture,865 direction, tasks, boundaries, ordering, file ownership, verification, or test866 expectations. Skip for surgical/wording/style fixes8674. Cap at 3 dispatches. Blocking issues remain after the 3rd -> escalate868869**Review depth:** a dispatched review must be a good review. Escalate a thin one870rather than accepting it.871872## Execution mode handoff873874Write the resolved mode into the plan header, then save the plan. Report the875plan path and recorded mode. Do not ask during handoff.876877- `Subagent-Driven` -> **REQUIRED SUB-SKILL:** `subagent-driven-development`878- `Inline` -> **REQUIRED SUB-SKILL:** `executing-plans`