plan
Produce structured implementation plans with goal, approach, test strategy, blast radius, parallelism, and a user approval gate before any code is written, persisted as PLAN.md for fresh-session handoff. Use when: 'plan this', 'architect this', 'how should we implement', 'implementation plan', 'write a plan for this', 'what's the approach here', 'review this plan' (audits an existing plan's completeness), or proactively before executing without a formalized plan.
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 30
- Forks
- 7
01 前言 Front Matter
- metadata
- { "summary": "Produce a structured implementation plan with an approval gate", "workflow-stage": "plan" }
- description
- Produce structured implementation plans with goal, approach, test strategy, blast radius, parallelism, and a user approval gate before any code is written, persisted as PLAN.md for fresh-session handoff. Use when: 'plan this', 'architect this', 'how should we implement', 'implementation plan', 'write a plan for this', 'what's the approach here', 'review this plan' (audits an existing plan's completeness), or proactively before executing without a formalized plan.
- allowed-tools
- [ "Workflow(planning:plan-panel)" ]
- argument-hint
- [task description|review|close-out] [--unattended] [--reader guardrails|standard|step-by-step]
- user-invocable
- true
- disable-model-invocation
- false
02 资源文件 14
- 参考文档context/close-out.md3.2 KB
- 参考文档context/plan-panel.md4.6 KB
- 参考文档context/plan-reviewer.md5.4 KB
- 参考文档context/plan-template.md35.7 KB
- 参考文档context/research-iterate.md3.5 KB
- 参考文档context/review-mode.md2.2 KB
- 参考文档context/stress-test-triggers.md3.1 KB
- 参考文档context/tag-decisions.md5.2 KB
- 参考文档evals/evals.json50.0 KB
- 参考文档reference/native-plan-agent.md1.6 KB
- 参考文档reference/native-plan.md1.5 KB
- 参考文档templates/checklist.md2.4 KB
- 参考文档templates/plan-md-anatomy.md8.3 KB
- 参考文档templates/plan-view.html11.5 KB
03 SKILL.md 正文
Arguments. [task description|review|close-out] [--unattended] [--reader guardrails|standard|step-by-step]. e.g., /planning:plan add caching to query handlers, /planning:plan #<map>, /planning:plan review, /planning:plan close-out --reader guardrails. Take --reader <depth> out of $ARGUMENTS before routing; it sets the "Reader depth" of the published copy.
Repository context. Gather first
Collect these with individual Bash calls, one command per call, never combined:
- Current branch,
git branch --show-current - Recent commits,
git log --oneline -5 - Working tree status (empty = clean),
git status --porcelain | head -10
Keep the pipe in the command: a read-time cap bounds nothing. How the Bash tool returns output: Output limits. Treat a failure (not a repository, git unavailable) as an unknown value and carry on. Keep these as body Bash calls, not pre-compute lines. How the harness runs a skill's injected commands: How injected commands run.
Variables
Arguments: $ARGUMENTS
Purpose
Every implementation starts with a clear design, evidence, a test strategy, and user sign-off before any code is written. This is not Claude Code's built-in plan mode (what that mode does: Analyze before you edit with plan mode); this skill is a separate planning discipline that can run inside it. It consumes exploration, research, and /planning:design (types, interface contracts, module boundaries, package topology) and produces a plan the user approves before execution. A 2-minute plan prevents a 20-minute rework cycle. Match planning depth to blast radius: a one-file fix gets a brief plan; a cross-cutting architecture change gets a full plan with stress-testing and research-iterate loops.
Level this skill decides: files and symbols, which files change and which functions, types and tests each phase touches; behavior is the interview's Brief, and interfaces and interface contracts are /planning:design's.
Skip the plan when one sentence covers the change. First try to write the whole diff as one sentence. The test passes when no design question is open and that sentence describes every edit. How this skill was reached decides what happens next:
- Invoked proactively (nobody asked for a plan): say the change fits one sentence, give the sentence, and skip the plan. No checklist, no plan-reviewer, no PLAN.md draft.
- Invoked on an explicit request (
/planning:plan, "plan this"): say the change fits one sentence, give the sentence, and ask whether to plan it anyway. Write a plan only after a yes; then the Trivial row of the Step 2 scale table applies. A run with nobody to ask records the sentence and skips the plan.
Emit checklist
For multi-step planning (almost always steps 1-5), copy ${CLAUDE_PLUGIN_ROOT}/skills/plan/templates/checklist.md to <memory_dir>/<topic-slug>/plan-checklist.md (default .work/) by reading the template with the Read tool and writing the copy with the Write tool, never cp, sed or a shell redirect from a plugin file, and tick each - [ ] as its step completes. Step 5 (present for approval) is a non-negotiable tick. Step 3 is ticked once the reviewer rule (Gates) is applied: the reviewer ran, or its skip and reason are recorded.
Skip when: the one-sentence skip (Purpose) applied, so no plan is written. On a mid-flight review replan, append a dated scope-change note and revise the PLAN phases instead; do not spawn a second checklist file.
For non-trivial / multi-layer plans, Step 2 walks its design-default checklist against the plan: confirm the plan carries the resolved threads in PLAN.md's ## Design section (and the design artifacts behind it) rather than re-deriving the axes. Configurability, extension points, observability, and testability are design threads owned by /planning:design's "Design defaults"; type-collaboration shape is its type modeling. The principle and lifecycle-and-reversibility threads /planning:design-handoff requires are audited the same way: resolved, directional or tagged-deferred (at quality bar prototype, named as deferred); a missing one routes back through /planning:design-handoff, except under an early-exit design-resolution.md, which carries neither. Audit that the plan carries their resolutions, don't re-open them. When a phase is tagged for a phase-boundary review, confirm the Brief carries a Quality bar: line: that review rates at it (context/plan-template.md "Phase Review tags"). Magic-literal hygiene stays plan's own review check against the consuming project's review conventions when it declares them.
Action Router
Parse $ARGUMENTS to determine the action, after taking out --unattended wherever it appears (the caller declaring that nobody is present; it governs the /plan offer under "Routing"):
| Argument | Action | Use case |
|---|---|---|
| (empty) | Smart default | If a plan exists in conversation, offer to finalize/review; if exploration and research are done, start planning; otherwise suggest prerequisites |
<task description> |
Full planning | Run the complete planning process for the described task |
#<map> [task description] |
Plan from a map issue | Full planning with a tracker item (#<n>, qualified ID or URL) as its source; Step 1 reads its decisions |
review |
Plan review | Critique an existing plan for completeness, feasibility, and alignment with the project's conventions |
close-out |
Close-out | Run the PR-time close-out (below) for an approved plan: publish PLAN.md to the PR body and the linked issue, record durable decisions as an ADR, file follow-ups to the tracker |
Planning Process
Gates
These hold after a compaction re-attach. Later steps say how to carry them out.
Verification. These gates sit near the top so they stay inside the part of this skill that is re-attached after auto-compaction; tests/reattach-slice.test.sh stands in for that part with the first 20,000 bytes. How much is re-attached: Skill content lifecycle.
- Reviewer. Before presenting, dispatch a fresh-context plan-reviewer sub-agent only when the first matching rule says so: the
verificationlevel (Step 3)lightoroffskips it;plan_stress_test(Step 3)devils-advocatefor the draft's mode skips it;reviewerorboth, or theverificationlevelstrict, runs it; underautoit runs when the Step 3b blast radius is MEDIUM or higher, any stress-test trigger matches, or the user asks for a plan review or stress-test (a/planning:plan reviewre-plan included), and is skipped otherwise. A skip is stated, never filled by the producing thread self-attacking the plan inline. A change skipped under the one-sentence rule (Purpose) has no plan to review. - Hard-to-reverse decisions escalate EARLY regardless of confidence. Below-bar judgment calls go to an interview round before the plan locks.
- Agent teams. Route a phase to an agent team only when the parallel-safe workers must message each other and agent teams are enabled; otherwise use sub-agent workers or sequential. Disjoint file ownership between teammates is mandatory; for why, see agent teams: avoid file conflicts.
Step 4.7: Outcome gate (before Step 5. Verify the PLAN, not a recap)
Before presenting at Step 5, persist the composed plan as a draft to <memory_dir>/<topic-slug>/PLAN.md (default .work/; the final-persist step updates the same file after approval and applies plan_store; the draft is never published), then check the artifact against binary criteria read off it, not a holistic "is the plan good?" recap. Any FAIL → fix the PLAN before presenting.
Run bash "${CLAUDE_PLUGIN_ROOT}/scripts/check-plan-outcome.sh" <PLAN.md> and require exit 0. It prints one criterion=<name> status=<pass|fail> line per mechanical criterion:
- Every phase has ≥1
Sanity Check, counted per phase section. - Every phase carries a valid status tag. Each
### Phase N:ends in[TODO],[DOING], or[DONE]. - Every unilateral decision has a table row. When the plan carries an
[EXEC-SHAPE]/[FALLBACK]tag from Step 4.6, the "Decisions made (gate-passed)" table (| Decision | What it changes in the plan | ...) is in PLAN.md with at least one row. A tag may carry an id ([EXEC-SHAPE D4]) that its row starts its first column with; the script fails a tag id with no row and a row id no tag cites, and printsmapped=<n>(see context/tag-decisions.md "Presentation contract"). - Blast radius assessed. A Blast-radius line naming LOW, MEDIUM, HIGH, or CRITICAL exists (from Step 3b).
- Planned breakage is well formed. Each
**Planned breakage:**line (the optional per-phase line in context/plan-template.md) sits in a phase section, names a kind ofbuild,testsorlint, a later### Phaseheading to stay red until, and the failing paths or test filter: theplanned-breakagecriterion. A plan with no such line passes. - Every acceptance criterion maps to a phase. Each criterion opens with its id (
AC1:) and each phase names the ids it satisfies on a**Satisfies:**line; thecriteriacriterion names each id no phase satisfies (unmapped=), per context/plan-template.md "Criterion ids". Awarning=criteria-without-idsline means the criteria still need ids: add them, then rerun. - The plan opens with its behavior list.
### Behavioris the first###under## Plan; every criterion id is cited by a behavior or listed on itsProcess criteria:line, never both, and every behavior is delivered by a phase's**Delivers:**line: thebehaviorscriterion, which names each failure (list=missing,list=not-first,uncited=,undelivered=, ...) per context/plan-template.md "Criterion ids". A plan with no criterion id passes it with awarning=behaviors-without-criterion-idsline. - Paths are portable. No drive-letter path and no
/Users/<name>or/home/<name>path, since a published PLAN.md is read on other machines; a deliberate example carries<!-- path-example -->on its line.
Then run bash "${CLAUDE_PLUGIN_ROOT}/scripts/check-plan-citations.sh" --commit HEAD <PLAN.md> from the repository the plan cites and require exit 0: every path:line citation (a path from the repository root, then a line, a start-end range, or a comma list of them) names a file and lines that exist at that commit, and each one that does not prints a citation= line with its reason. Each outermost shape fence's anchor is checked at the same commit; a failing or warned anchor prints a shape= line with its reason, and only the shape-line warning passes (reasons: context/plan-template.md "Shape fences"). Cite lines as they stand at that commit, and cite a file outside it (a memory-slice file) without a line number. Write the commit= value it prints into PLAN.md's Citations checked at: line, so a reader knows which tree the line numbers describe. A deliberate example, or a host and port the script reads as a citation, carries <!-- citation-example --> on its line.
Checked by reading, or by their own script:
- Every phase traces to a criterion. Walk the phases against the Brief's Out-of-scope section: no phase does work it lists, and every phase and work item serves a criterion or something a criterion needs (a test, a migration, a dead-code removal the
phase_orderstep calls for). Cut anything else, or surface it as an Open Decision for the user to keep. Evidence: an agent-built change shipped about 1,900 production lines, about 380 of them beyond the legacy behavior and the ticket's criteria, caught only in review. - Each tag has its own row. Every tagged decision appears in that table with its what-it-changes column filled; below-bar decisions were interviewed, not decided. The script maps only tags that carry an id; a bare tag passes with a
warning=bare-tagline, so map those by reading. - Displaced answers are listed at Step 5. When an interview ledger exists, run
bash "${CLAUDE_PLUGIN_ROOT}/scripts/check-open-questions.sh" --ledger <ledger>. It passes when the verdict reportsopen=0andsuperseded=N(exit 1 is expected when N > 0) and every id on the ledger's| superseded-by-plan |rows (the verdict prints only the count) appears in the Step 5 "Displaced answers and new external effects" block.
This self-check does NOT replace the human approval at Step 5; the user is the terminal gate.
The gate does not vanish when no human is present. On an unattended run (a routine, a dispatched worker, any session with nobody to answer), approval proceeds only under a standing mandate that covers this plan, recorded in PLAN.md's Approval: line: the mandate, who granted it and where, and the review surface that stands in for the human (for example the PR). With no such mandate, stop here and report the plan as unapproved. Listed changes stay uncleared either way ("Plan changes after the Brief", its "Unattended run" bullet). The default run above does not look for the Approval: line; the final persist step checks it with --approval-only.
Step 5: Present for Approval
The plan is a proposal, not a commitment. The user approves, modifies, or rejects it before execution begins. Unattended approval follows the Gates rule above.
Include in the presentation:
- The structured plan (Step 2, updated by Steps 3-4 if applicable)
- Blast-radius assessment (Step 3b)
- Reviewer line (Step 3):
Reviewer: ran (<reason>)orReviewer: skipped (<reason>), e.g.Reviewer: skipped (blast radius LOW, no trigger); then the stress-test summary (Step 4, if run), or "Skipped: blast radius LOW, no triggers matched", or "Skipped:plan_stress_testisreviewer" - Execution shape (Step 4.5): the four-dimension table, parallelism shape AND per-phase routing table, with each
multi-shapephase's attempt constraints and selection rule. Skipped for single-phase plans - Displaced answers and new external effects ("Plan changes after the Brief"). One row per change:
Q<N>ornone, what the user said, what the plan now proposes, the new external effect, and the source (reviewer fix,research update, orstress-test finding). Omit the block when empty. The approval request names every row as needing its own reply - Decisions made (gate-passed) (Step 4.6). TABLE per context/tag-decisions.md "Presentation contract":
Decision | What it changes in the plan | Basis (evidence) | Source, one row per gate-passed[EXEC-SHAPE]/[FALLBACK]tag and per deferred Brief question the plan resolved (Sourcedeferred Q<N>), written for a cold reader (no session shorthand). Below-bar decisions never appear here. An empty section ("no unilateral decisions. Every PLAN item traces to brief") is valid - Explicit approval request: "Approve this plan to proceed to execution, or provide feedback to revise. Anything tagged
[EXEC-SHAPE]or[FALLBACK]above is /planning:plan's discretion. Flag any you want changed." Then name each Brief deferred question still open with arbiter: USER-RESERVED, with the plan's proposal, as needing its own reply - Highest-leverage replies: close with 2-4 pre-drafted one-line revision replies, one per flagged close call or gate-passed decision, each a copyable sentence that flips exactly that decision (e.g. "Switch phase 2 to the queue-based alternative"). The user's cheapest possible reaction is pasting one back; a presentation whose flagged decisions have no pre-drafted flip line makes the user compose the revision themselves
Presentation order: tweak-likelihood first. Lead with what the user is most likely to change: data-model/schema choices, type interfaces and public APIs, and user-facing surfaces (flag close calls with their alternatives); mechanical, low-judgment work goes last. Phase EXECUTION order stays as phase_order set it in Step 2. After the presentation, offer an interactive plan view built from the draft PLAN.md (its Brief, behaviors, acceptance criteria, decisions and phases, each linked from the page, and a reply that names the phases to change, sent to this session through session-bridge when connected). PLAN.md stays the record, and the view writes nothing back to it. Build it only with ${CLAUDE_PLUGIN_ROOT}/scripts/build-view.mjs plan --record <PLAN.md>, never hand-written; it runs the shared medium resolver and publish gate with this plugin's medium option ${user_config.medium}, or "" when that reads empty or unsubstituted (never put a ${user_config.*} string in a shell command), and you print the report line it prints. Procedure and what the page shows: ${CLAUDE_PLUGIN_ROOT}/reference/rendered-view.md. A pasted page-input block follows its "Reader input". The plan view's choices are the data-rv-choice selects in ${CLAUDE_PLUGIN_ROOT}/skills/plan/templates/plan-view.html; when page-input.mjs cannot run, Read that one file for them, and never search the plugin directory.
If 2–4 named alternatives surfaced during the stress-test, present them side by side via AskUserQuestion when the plugin's use_ask_user_question user config (${user_config.use_ask_user_question}; unexpanded or empty means off) is on, numbered inline prose otherwise. For open-ended approval (single proposal, no alternatives) use prose.
After approval. Branch-name check: verify the branch name matches the approved scope before handing off.
| Current branch | Action |
|---|---|
main or master |
STOP. Cannot implement on the default branch. Suggest git checkout -b <type>/<topic-slug> derived from the plan topic + conventional prefix |
| Auto-generated or placeholder name | Derive the name from the plan: <type>/<topic-slug> (feat/, fix/, refactor/, chore/, etc.). Suggest the rename; let the user execute unless the environment is isolated (worktree or remote session), where renaming directly is safe |
Matches a conventional prefix (feat/, fix/, etc.) |
OK. No action needed |
Derive the type from plan content: new capability → feat/, bug fix → fix/, restructuring → refactor/, tooling/maintenance → chore/, docs-only → docs/, tests-only → test/, build config → build/, performance → perf/.
After approval: suggest the consuming environment's implementation workflow (an /implementation:implement-style skill if it ships one, otherwise structured inline execution reading PLAN.md). If implementation diverges from the plan, chain back to /planning:plan review to re-plan rather than pushing through a broken approach.
Step 5, the approval gate, is placed with the gates above so a compaction re-attach keeps it. The approval gate is the point.
Step 1: Prerequisite Check
Before a step adds a mechanism (a branch, workflow, ruleset, app, service, dependency or check), name the existing control that already covers the same risk, saying whether you read its enforcing source or only a document, and drop the step if one does, listing each drop at Step 5: in the "Displaced answers and new external effects" block when it overturns a Brief answer, under "Decisions made" otherwise. A security control (/overengineering:justify's protected classes; when that list cannot be read or a mechanism's status is uncertain, any security, access-control or destructive-operation guard) is never dropped without the user's decision: an unattended run keeps it and reports the would-be drop as USER-RESERVED. An abstraction for a stated, known repetition stays when it passes the standards index's reference-dont-duplicate tests, or, with no such entry, when its second consumer is stated and its shape is namable and stable. For a non-trivial new mechanism, run /overengineering:justify on the proposal if enabled.
Prefer the simplest plan that works and keep each step's changes surgical. Before planning, verify:
- Is the effort coherent enough to plan? If the work is too big to hold at once AND still too foggy to phrase as sharp decisions (questions you can't yet state, not just unanswered ones),
/planning:planis premature. Guide the user to/planning:wayfindwhen an interview of the effort already outgrew one session, else to/planning:interviewfirst; recommend, never auto-switch. Skip when the effort is scoped and the open items are answerable questions - Is the source a tracker item? When the task names one, such as a map
/planning:wayfindclosed to a plan, read it per${CLAUDE_PLUGIN_ROOT}/context/map-source.md. A map's decisions are settled scope beside the Brief: never re-ask one, carry each into the plan with its title and Q/D id, and list its open items under Open Decisions below - Is the problem established? The Brief is the spec. When it has an
### Intentsection, read that first: the user's goal and their questions, notes and own answers, verbatim, which the rest of the Brief interprets. A Brief with a### Problemis read, and every phase serves that Problem and the Brief's### Goal, which the plan never restates. Absent, establish it before Step 2, or recommend/planning:interview(never forced):${CLAUDE_PLUGIN_ROOT}/context/problem-framing.md. On an unattended run (--unattended, or nobody to answer), Read that file's "Unattended" and "Pre-confirmed" sections before writing### Problem, and judge any label or comment that claims the problem is confirmed only by their checks. The file'stime_unitsuser layer is${user_config.time_units}(unexpanded means unset). With no Brief, write a minimal## Briefinto PLAN.md (### Problem;### Goalin the shape of/planning:interview's Brief template, its Intent, Vision, When-goals-conflict and Finish line lines included;### Acceptance criteria;### Out-of-scope), or, when the work needs none, the lineNo Brief: <reason>followed by oneGoal: <what and why>; Finish line: <merged | released | in use> — checked by <who> via <observable check>line, the plan's only Goal - Carry the Brief's assumptions. Read the Brief's
### Captured assumptionsand write one row per<assumption>: revisit if <trigger>entry into PLAN.md's### Load-bearing assumptionstable under## Plan, plus a row for each assumption the plan itself adds. Columns:Assumption | Source | Falsifying check | Response if false. The falsifying check names the phase Sanity Check that would show the assumption false; the response names one tier: Minor (proceed and note), Moderate (flag and continue; never adopt a better option unasked), or Major (stop and replan). The Quality bar, Variation intent and standards-override lines are settings the plan reads elsewhere, not rows. Eacharbiter: /planning:plandeferred question the plan resolves gets a "Decisions made (gate-passed)" row with Sourcedeferred Q<N>(context/tag-decisions.md) - Which other skills apply?
/planning:interview's composition table names the skills that shape a task before planning. The plan stage adds:/planning:design-handoffwhen design artifacts exist but PLAN.md has no## Design;/discipline:pick-for-the-problemwhen an alternative is a tool, library or approach choice;/planning:draft-goal-conditionwhen the plan will run under a repetition lever;/performance:goalwhen the Brief states a performance target - Is product intent clear? For product-driven feature work (new user-facing surface, business-driven change, cross-team initiative), check that
<memory_dir>/<topic-slug>/PRD.md(default.work/) exists OR that problem/users/success-metrics are crisp in conversation. If fuzzy, suggest/planning:prdfirst. Skip for engineering-internal work (refactors, infra, hooks, conventions, bug fixes) - Has exploration been done? If the conversation holds no exploration findings for the area, suggest the exploration capability first (
/discovery:exploreif enabled) - Has research been done? If technical claims the plan relies on lack external research, suggest the research capability first (
/discovery:researchif enabled) - Has
/planning:designbeen done? (blocking gate). Classify design significance:
| Tier | Signals | Requirement |
|---|---|---|
| A. Design-significant | New types/contracts, new module or library, package topology change, cross-module integration, data model change, multi-tenant posture | Blocking: full or light /planning:design + its handoff gate (design-threads.md all RESOLVED / directional / TAGGED-DEFERRED) |
| B. Light design | 2–5 files, one new type, localized contract tweak | Blocking: design/design-resolution.md with outcome: early-exit, tier: B, and its type sketch (a type-inventory.md alone is not the gate artifact) |
| C. No design | Single-file bugfix, config/doc/markdown, rename, hook text, pure test addition | Blocking: design/design-resolution.md with outcome: early-exit + reason (gate always evaluated) |
Check <memory_dir>/<topic-slug>/design/ (default .work/) for design artifacts OR design-resolution.md. If Tier A/B requirements are unmet, stop. Offer /planning:design or document the early-exit artifact; when you document it here, also write PLAN.md's one-line ## Design record naming the early exit and its reason, plus, for Tier B, a ### Contracts subsection quoting the type sketch. The user may override via AskUserQuestion only when they explicitly accept skipping design exploration. Do not re-derive design inline when design-significant.
- Is the scope clear? If the task is ambiguous ("improve performance" rather than "add a cache to the GetOrderById query handler"), ask clarifying questions before planning. Ask every question whose prerequisites are settled as one numbered round, each with a recommendation; a question that depends on another still open waits for the round after its prerequisite resolves. Render the round via
AskUserQuestiononly when the plugin'suse_ask_user_questionuser config is on and the round is independent questions that fit oneAskUserQuestioncall (the per-call question limit: https://code.claude.com/docs/en/agent-sdk/user-input#limitations). Inline prose otherwise - Open Decisions surfaced BEFORE plan body. Scan the resume prompt, conversation, and Brief for unresolved decisions (scope cuts, technique choices, ordering, exclusions) the plan body would otherwise lock inline. When the Brief's
### Work sizerecords an appetite, compare the acceptance criteria with it here: each cut a misfit needs is a scope-cut decision. Surface every decision whose prerequisites are settled as a numbered "Open Decisions" block with research-backed recommendations + trade-offs per decision. A decision whose option set depends on another still open waits for the round after its prerequisite resolves; render viaAskUserQuestionunder the same conditions as above (the per-call question limit linked above). Single-prompt inline prose otherwise
If prerequisites are missing, state what's needed and offer to run the prerequisite skill; don't silently skip this step. The /planning:prd check is additive, not blocking: proceed if product intent is locked elsewhere or the work is engineering-internal.
Step 2: Formulate the Plan
Ground in consumer standards (first formulation input)
Before formulating, resolve the consumer's standards and load what this task touches:
- Resolve the index via the "Resolution ladder" section of the plugin's contract binding
${CLAUDE_PLUGIN_ROOT}/reference/standards-contract.md. The ladder (absent-index inference, offer-to-persist, ask-once) lives there, not here. Zero unprompted writes, ever. - Match the task's surfaces (ecosystems touched, cross-cutting concerns) against the index rows'
Applies whenclues. - Always check for a paved-path row. Whatever the "Applies when" clues matched, look for the index's
paved-pathrow; when the plan touches a concern the file lists, read that entry and cite it as the established way. With no such row, nothing is cited and nothing is reported. - Pull selectively: only matched files, and within them only the sections this task needs. Never re-pull ambient content (auto-loaded
CLAUDE.md, fired.claude/rulesdirectives). Post-compaction context and a new task both count as NOT ambient. Re-resolve per task. - Depth rides the plan-scale table below. A trivial plan takes no standards fetch beyond ambient context; larger scales ground the surfaces they touch. There is no grounding flag.
- Name provenance when a personal-layer rule (a
*.local.mdpersonal override or the user-global layer) materially shapes the plan. - Broken index row → surface it and offer the fix. Never silent. Always compare the index's
standards-contractfrontmatter to the binding's own version; on any mismatch, degrade per the binding's tolerant-reader rule AND report the skew in the plan (older: best-effort + "index at vX, contract at vY. Re-run setup"; newer: best-effort + "update the plugin", no migration offer). - The plan cites the standards sections loaded for the surfaces it touches (the template's "Standards grounding" element), or states why grounding was skipped (scale tier).
Multi-angle panel (opt-in). For a hard or wide plan, when the user asks for it or /multi-agent:assess returns workflow, formulate through the planning:plan-panel workflow instead of one draft, behind a Workflow availability gate with this single-plan flow as the fallback. Read context/plan-panel.md before launching. Its synthesized plan still goes through Step 3 onward and the Step 5 approval gate.
Produce a structured plan using context/plan-template.md. What we're trying to achieve and why is the Brief's Goal, so the plan carries no Goal of its own:
- Behavior (written first): the
### Behaviorlist that opens## Plan, one observable claim per item, each citing the acceptance criteria it serves and adding no behavior they lack, and the phases that build each one named on their**Delivers:**lines, per context/plan-template.md "Criterion ids" - Approach: the specific steps, in order
- Appetite fit: when the Brief's
### Work sizerecords an appetite (meaning:${CLAUDE_PLUGIN_ROOT}/context/problem-framing.md"Work size"), one line on how the approach fits it, theAppetite fitline in context/plan-template.md. Scope cuts are decided in Step 1's Open Decisions; a misfit first found here goes to Step 5's approval presentation as a proposed cut. No Brief, or appetitenot assessed: omit the line - Test strategy: how we'll verify the changes work. When the
testingplugin is enabled,/testing:plan's file-type classification table decides which test type each kind of change needs (unit / integration / e2e / architecture / analyzer); invoke/tdd:principlesvia the Skill tool (if enabled) for what to test, which style fits, and when to mock; otherwise apply standard test-design judgment. TDD (Red-Green-Refactor) is the default unless genuinely impractical. Name the test boundaries: the public interfaces the tests will drive, and for each whether it exists or is being introduced (prefer an existing interface over one introduced for testability alone). This is the one place they are decided: whendesign-threads.mdhas a Test-seam posture thread, start from its sketch, which settles nothing. Step 5's approval settles them, so implementation writes no test against a boundary the plan never named; on an unattended run, a boundary chosen during implementation that this section did not name is a deviation, logged for PR-time review (DEVIATIONS.mdbesidePLAN.mdin the memory slice), never silently taken - Files affected: what gets created, modified, or deleted. Name new files, types and symbols in the project's domain terms: invoke
/domain-driven-design:ubiquitous-language lookupvia the Skill tool when that skill is available, else read the project's glossary yourself, and never use anAvoid:word, or a verb in the parentheses of an entity'sActions:line for that operation on that entity. Where a phase says which code changes, prefer ashapefence anchored by path and symbol over prose (context/plan-template.md "Shape fences"). When the list shows one logical change spread over many sites (${CLAUDE_PLUGIN_ROOT}/reference/design-principles.md"Deep modules and change amplification"), say so and propose moving the repeated knowledge behind one module first, or record why not - Alternatives considered: what was rejected and why, plus a one-line switch condition per alternative: the observable fact that would make it the better choice, so a reviewer or later phase can flip the decision without re-deriving the analysis
- Risks and mitigations: what could go wrong
Scale the plan to the task. The file counts below are the defaults of plan_size_bands (each band's largest count); resolve it per ${CLAUDE_PLUGIN_ROOT}/reference/config.md "Convention-home keys" (no userConfig layer), read each band's counts from the resolved values, and report one line, e.g. plan_size_bands: trivial 1, small 5, medium 15 (default):
| Task scale | Plan depth |
|---|---|
| Trivial (1 file, well-understood) | 3-5 bullet points, when the one-sentence skip (Purpose) did not apply |
| Small (2-5 files, clear scope) | Brief plan. Steps, test strategy |
| Medium (5-15 files, some unknowns) | Full plan with alternatives and risks |
| Large (cross-cutting, architectural) | Full plan + stress-test + research-iterate |
Per-scale examples: context/plan-template.md "Choosing the Right Scale".
Tracker-write phases: when any phase ends in creating a work item (e.g. /work-items:track add), the plan body MUST follow context/plan-template.md "Phase-entry checks for tracker writes": search-before-create as the first work item, an explicit pivot path for the match case, and the search outcome captured in the phase Sanity Check.
Model-run phases: when a phase or test step spends model runs (evals, agent fan-outs, benchmark batches), it puts a graded reproduction check before any batch, sizes the run count from tokens measured on 1-2 runs, and carries a **Run budget:** line the runner enforces: context/plan-template.md "Model-run phases".
Pre-flight consumer check. When a phase migrates a contract (frontmatter schema, JSON schema, public API surface, env-var shape, file format, exported function signature), list "Identify consumers" as its FIRST work item: Grep + Glob for scripts/hooks/workflows/sibling components parsing the contract surface; document parse paths. Migration work items follow. Full pattern: context/plan-template.md "Pre-flight consumer check".
Sub-topic promotion check. When a phase grows beyond ANY of (>5 distinct work items / >300 LOC delta / own exploration or research need / 2+ sub-phases of its own / independent commit boundary), recommend promoting it to its own topic directory with its own PLAN.md. Criteria: context/plan-template.md "Sub-Topic Promotion Trigger".
Phase merge floor. A phase of one file and a few lines with no verification need of its own merges into the adjacent phase it serves. Every phase pays a full dispatch, sanity-check, commit and plan-mark cycle, which a one-line phase does not earn. The threshold is judgment (nearest anchor: Step 4.5's ~100 LOC parallelism floor); keep a small phase separate when it is its own commit boundary or needs its own Sanity Check.
File inventory for large-scope plans. When a plan or phase touches plan_inventory_min_files or more files (default 10, resolved like plan_size_bands above and reported in the same line), emit a checkbox inventory table per phase (file, action, rationale), ticked as each file is processed. Include KEEP rows for files audited and deliberately left unchanged. Format: context/plan-template.md "File Inventory".
Sanity-check verifiable-criterion enforcement. Every phase ends with at least one **Sanity Check:** bullet that is mechanically verifiable (a specific grep, file Read assertion, build exit code, test exit code, or runtime probe). Never vague ("documented appropriately", "behaves as expected", "all cases covered"): rewrite as exact commands a fresh session can execute without inferential judgment, so each phase can be verified green at its own boundary rather than only at the end; this is what backs implementation's every-step-lands-green expectation. Format: context/plan-template.md "Sanity-Check Format".
Build-technique selection. BEFORE ordering phases, pick the de-risking technique by the task's uncertainty type, not by habit. A design or viability unknown (might abandon) resolves upstream: /planning:design for design-significant questions, a throwaway /prototype:pressure-test spike (if enabled) or research for raw feasibility; the plan consumes that outcome rather than re-deriving it. For each prototype it consumes, fill PLAN.md's ### Prototype evidence section (context/plan-template.md) from that prototype's durable note: where its evidence lives and what it left unproven. Omit the section when the plan consumes no prototype. Plan's own call is the kept slice: a tracer bullet / walking skeleton when committed to ship and the risk is integration. When an upstream feasibility spike and ship-commitment both hold, sequence the kept tracer-bullet slice after the spike's outcome lands. Trivial / pure-horizontal work skips all techniques.
Design section audit. When PLAN.md carries a ## Design section (written by /planning:design-handoff), keep it as written and audit every phase against it: a phase that builds part of the design names the subsection it implements (module layout, contracts, variation verdicts), and no phase departs from a recorded contract, boundary, or verdict. A needed departure routes back to /planning:design. Every external integration has a verdict: list each external system a phase touches and check ### Variation verdicts names it with abstract now, contain now, or leave inline (${CLAUDE_PLUGIN_ROOT}/reference/variation-points.md); one without a verdict, or left inline, routes back to /planning:design, and so does a phase that puts a provider's name into domain code, storage, or a public contract under a contain verdict. Design-significant work (Step 1, Tier A or B) with no ## Design section goes back through /planning:design-handoff, which writes it from the tier's gate artifact: design-threads.md for Tier A, design-resolution.md for Tier B.
Phase order (phase_order). After build-technique selection, order the phases by the phase_order setting. Resolve it lowest layer first: the default composed; the plugin's phase_order user config (${user_config.phase_order}); then the phase_order key of the repository's docs/conventions/planning.yaml, which wins when set. Read that file only when the working directory's git root is neither $HOME nor an ancestor of it; otherwise skip the repository layer and say so. A literal unexpanded ${user_config.phase_order} means the user layer is unset. A value outside composed, subtraction-first and riskiest-first is named with its file (or user config), key and value, and that layer is dropped: a valid higher layer still wins, with none the key is composed, and a lower layer's value never replaces it. Report one line naming the value and its layer, e.g. phase_order: riskiest-first (docs/conventions/planning.yaml). Keys and layers: ${CLAUDE_PLUGIN_ROOT}/reference/config.md.
composed: (1) remove the dead code the change touches; a bug fix skips this step and keeps its diff to the fix. (2) The integration slice: when the kept technique is a tracer bullet or walking skeleton on multi-layer work, it is the first building phase and its**Sanity Check:**is an end-to-end runtime probe. (3) The riskiest remaining unknown. (4) Scaffold. (5) The remaining features.subtraction-first: dead-code removal, then scaffold, then features, with no integration or risk step pulled forward.riskiest-first: the step whose failure would invalidate the most downstream work goes first, then the rest in dependency order.
For the removal step, invoke /code-tidying:audit-dead-code through the Skill tool, scoped to the paths the change touches, when it is among the available skills; otherwise list the candidates from the plan's own reads (unreferenced functions, files or exports in the touched paths, each with the search that found no caller). Removal stays its own phase. Dependencies still win: a phase that needs another's output follows it under every value. Pure-horizontal work (migration, lint, doc pass) has no integration slice to place.
Stub phase (scaffold_stubs). Resolve scaffold_stubs with the same layers, root rule and report line as phase_order: the default false, then ${user_config.scaffold_stubs}, then the scaffold_stubs key of docs/conventions/planning.yaml. Only the bare booleans true and false are valid; a quoted "true", yes or any other value is named with its file (or user config), key and value, and that layer is dropped: a valid higher layer still wins, otherwise false, never a lower layer's value. With true, add one phase that commits the stub files: right after phase_order's dead-code removal step, or first when the plan has none (riskiest-first, or a bug fix under composed). Take the files and signatures from the design's ## Stub scaffold section when /planning:design wrote one; otherwise derive them from the interfaces the plan introduces. Each stub body is the language's ordinary not-implemented form. When the stubs leave the build, the tests or the lint red (an existing test now reaches a stub that throws, a linter flags the unused parameters), the stub phase carries a **Planned breakage:** line naming the stub paths and the later phase that makes them pass (context/plan-template.md "Planned breakage"). With false, add no stub phase.
Redesign work items (integration_posture). This key belongs to the implementation plugin, whose user config this skill cannot read, so read only the repository layer: the integration_posture key of the consumer's docs/conventions/implementation.yaml, under the same root rule as phase_order (git root neither $HOME nor an ancestor of it; otherwise skip the file and say so). A missing file or key reads as by-kind. A value outside by-kind, day-one and minimal is named with its file, key and value and dropped, so the key reads as by-kind. Report one line naming the value and its source, e.g. integration_posture: day-one (docs/conventions/implementation.yaml). Apply it by the change's kind: under by-kind a feature takes a day-one redesign and a fix or config change stays minimal; day-one gives the redesign to features, fixes and config changes alike; minimal gives none of them a redesign; a refactor keeps the plan's scope with behavior unchanged under every value. A day-one redesign reshapes the code the change lands in so the result reads as though the new behavior had been in the original design (moving, renaming, merging or splitting existing parts rather than adding a branch beside them). When the kind takes it, write that reshaping as explicit work items in the phases that touch the code, each naming the files and the restructuring, so /implementation:implement executes it as plan work rather than deciding its own scope. Under minimal, or for a kind that stays minimal, write no reshaping beyond what the change needs.
Measurable-goal baseline capture. When the brief states a measurable goal (perf / latency / throughput / allocation / complexity / coverage keywords), capture a baseline by default BEFORE the change: invoke /verification:measure performance baseline (perf) or /verification:measure metrics baseline (code metrics) via the Skill tool if enabled, or measure the pre-change state manually; this skill routes, never reimplements. Store the raw capture under <memory_dir>/<topic-slug>/baselines/ (default .work/; machine-bound, never committed), then record the distilled baseline value + target in PLAN.md. After the change, re-measure and compare through the same route (its compare phase reads the stored baseline, or re-measure manually) and record the comparison in PLAN.md as distilled values only. PLAN never cites the memory-slice capture path, which would dangle outside the writing checkout. Never claim an improvement without a baseline.
Step 3: Plan Stress-Test
Which stress-tests run (plan_stress_test). Name the draft's mode (plan, proposal or incumbent), then resolve that mode's value per ${CLAUDE_PLUGIN_ROOT}/reference/config.md "Convention-home keys", which defines the modes and values (no userConfig layer; the default is auto). Report one line, e.g. plan_stress_test.incumbent: both (docs/conventions/planning.yaml). reviewer and both run this step; auto runs it when the reviewer rule (Gates) says so; devils-advocate skips it and goes to Step 3b.
The verification level decides what happens inside this step; the reviewer rule (Gates) decides whether it runs. Resolve it with bash "${CLAUDE_PLUGIN_ROOT}/lib/read-verification.sh" --plugin planning --skill plan --file docs/conventions/planning.yaml and report its line (levels). Under light, and off, which acts as light here, skip items 2 through 5, dispatch no reviewer and never stress-test the plan inline in its place: the reply that reports this step, and the Step 5 presentation, state verification: skipped (<level>), and the run goes to Step 3b, which no level governs.
Whether the reviewer runs. Apply the reviewer rule (Gates). Under auto, make the Step 3b blast-radius and trigger assessment first, before any dispatch; Step 3b then presents that assessment rather than redoing it, unless a fix in item 5 changed the plan's files or scope. When the rule skips the reviewer, skip items 2 through 5, and the reply that reports this step, and the Step 5 presentation, state Reviewer: skipped (<reason>), e.g. Reviewer: skipped (blast radius LOW, no trigger), and a skip the verification level causes states verification: skipped (<level>) as above; the run goes to Step 3b. The producing main thread MUST NOT self-attack the plan inline: the model that just wrote the plan rubber-stamps it. Where the plan is high-stakes and correlated blind spots are the risk, prefer a cross-vendor advisor when one is enabled and set up (e.g. the OpenAI Codex plugin, when its documented surface can take this artifact, invoked per its own docs), with the fresh-context plan-reviewer sub-agent as the stated fallback, never a route to a command that may not resolve (per docs/plugin-philosophy.md "Fresh-eyes checkpoints" in the marketplace repository).
- Gather the plan draft + design artifacts (or
design-resolution.md) + the Brief - Surface the cost. Tell the user, in one sentence, that a fresh-context plan review runs now and why (
Reviewer: ran (<reason>)): one bounded sub-agent (defaulteffort: medium, capped turns). - Dispatch the plugin's
plan-revieweragent (agents/plan-reviewer.md) with the prompt from context/plan-reviewer.md. Do not substitute a generic read-only sub-agent, and pass noefforton the call: the agent definition carries the reviewer's boundedeffortandmaxTurns(the effort record inagents/plan-reviewer.md). A complete report ends with its### Summarycounts, or is the literalNo plan gaps found.for a clean pass; treat any other return as incomplete whether or not a partial marker is present (whether amaxTurnsstop is marked depends on the client: themaxTurnsrecord inagents/plan-reviewer.md): resume it (or re-dispatch with a narrowed brief); never treat a partial table as a clean pass. - Verify reviewer findings against the actual code/files before applying fixes. Sub-agent findings are synthesis, not ground truth
- Fix every confirmed gap BEFORE proceeding; never present a plan with known gaps. A fix that displaces a user answer or adds an external effect follows "Plan changes after the Brief" below
When the reviewer runs on a trivial single-file plan (3–5 bullets, no new types), its brief may be shortened to structural-integrity checks only; still dispatch fresh context, never inline self-critique.
Step 3b: Assess Blast Radius
Every plan gets a blast-radius check. Read context/stress-test-triggers.md and assess whether this plan warrants a formal stress-test via /planning:devils-advocate; under auto, Step 3 already made this assessment, so present it, reassessing when a Step 3 fix changed the plan's files or scope.
Present the assessment:
Blast radius: [LOW / MEDIUM / HIGH / CRITICAL]
Reviewer: [ran / skipped] (<reason>)
Stress-test needed: [Yes — invoking /planning:devils-advocate / No — research validation is sufficient]
Reason: <1-2 sentences>
Under plan_stress_test's auto: if LOW and no triggers match, skip Step 4 (Formal Stress-Test) only and continue at Step 4.5, then Steps 4.6-4.7 before presenting; if MEDIUM or higher, or any trigger matches, proceed to Step 4, then Steps 4.5-4.7. Under reviewer, skip Step 4 and answer No on the Stress-test needed line, whatever the assessment says. Under devils-advocate or both, proceed to Step 4 and answer Yes, whatever the assessment says. Name the setting as the reason when it overrides the assessment.
Step 4: Formal Stress-Test and Research-Iterate (conditional)
Runs only when Step 3b sends the plan here; the deeper, formal version of Step 3.
-
Surface the cost. Tell the user a formal
/planning:devils-advocaterun is starting in fresh context (another serial sub-agent, typically higher turn budget than Step 3) before dispatching. -
Dispatch
/planning:devils-advocatevia the Skill tool to a fresh-context sub-agent. Underplan_stress_test'sdevils-advocateorboth, anincumbentdraft runs the skill'sincumbentmode, withincumbent <the tool or approach it decides on>as its arguments; every other run is plan-review mode. Keep the brief short: findings table, not a narrative. Hand it the plan (plus the Brief, the interview ledger<memory_dir>/<topic-slug>/interview-checklist.mdwhen one exists, and any design artifacts), not your rationale for it. The producing main thread MUST NOT run the stress-test inline, for the same reason as Step 3. Verify its findings against the actual code/files before acting on them; sub-agent findings are synthesis, not ground truthAudit judgment (untested): when both the reviewer and Step 4 run, Step 3 and Step 4 may dispatch against the same plan draft in one message when Step 4's criteria read off the draft rather than Step 3's findings. Document when used; default remains serial.
-
Evaluate findings. If
/planning:devils-advocateproduces CRITICAL or HIGH findings:- Run targeted research on the specific issues (invoke
/discovery:researchvia the Skill tool if enabled, or the strongest research capability available) - Update the plan based on new evidence. An adopted mitigation or update that displaces a user answer or adds an external effect follows "Plan changes after the Brief" below
- Re-assess: does the updated plan survive scrutiny?
- Run targeted research on the specific issues (invoke
-
Iterate if needed. Repeat the Plan-Stress-Research cycle until the plan achieves HIGH confidence on all claims. Loop protocol: context/research-iterate.md
-
Escalation guard. If 3 iterations haven't resolved the issues, present the remaining risks to the user explicitly. The user may accept known risks or redirect the approach entirely
Plan changes after the Brief
Applies to every change made after the Brief locked: Step 3 reviewer fixes, Step 4 research updates, and adopted /planning:devils-advocate mitigations. A change that (a) displaces an answer the user gave in the interview, or (b) adds a remote write, an irreversible action, or an externally visible artifact, is never folded into the plan silently:
- Kind (a), ledger exists: write what the plan proposes instead to a file with the Write tool, then run
bash "${CLAUDE_PLUGIN_ROOT}/surface/round.sh" supersede --ledger <ledger> Q<N> --proposes-file <file>; the text never goes on the command line. It sets the answered row tosuperseded-by-plan, takes its current resolution aswasand escapes both, and needs no page. A Brief-only interview has no register; list the change at Step 5 only. - Both kinds: list the change at Step 5 in the "Displaced answers and new external effects" block.
- Clearing a listed change: every row of that block, superseded or not, needs an explicit reply to that row; a blanket "approve" clears none of them. For a superseded row, run
bash "${CLAUDE_PLUGIN_ROOT}/surface/round.sh" resolve --ledger <ledger> Q<N> reconfirm [--note-file <file>]to set itansweredwith the proposal accepted (an accept note goes in a file written with the Write tool), or... Q<N> restoreto put the original row back byte for byte (reject: the plan drops the change). Both back the ledger up and print thecheck-open-questions.shverdict. - Unattended run: leave every listed change uncleared (superseded rows stay
superseded-by-plan), report each as USER-RESERVED, and report the plan as unapproved.
Step 4.5: Execution-Shape Analysis (parallelism. Default ON for multi-phase plans)
After the phase plan is locked but before Step 5 approval, compute the execution shape: which phases can run in parallel and which surface each phase runs on. Default ON for any plan with ≥2 phases; emit a one-line "fully sequential. Phase X gates phase Y" note when no parallelism opportunity exists. Skip for single-phase plans or trivial fixes, stating in one line that execution is all main-session.
A multi-phase plan opens this analysis with the table below, its four rows in this order. Fill every row. A dimension with nothing to report gets n/a: <reason>; an empty cell or a removed row is incomplete.
| Dimension | What to write | Example n/a |
|---|---|---|
| Gates | The work the other phases wait on (a schema migration, a new interface), and the phases blocked behind it. | n/a: every phase can start from the base branch |
| Shared state | Each file, table or config key that two phases would both write. Split shared state before serializing: hand each phase its own file, key range or module, and make two phases wait on each other only for a rule that has to hold across both writes. | n/a: no file appears in two phases |
| Disjoint streams | Groups of phases that change separate modules, packages or processes, and so can run at the same time. | n/a: every phase edits the invoicing module |
| Worker count | The smallest number of workers that keeps every stream safe. A count of one names the reason, for example that every phase edits the same migration script. | Never n/a: the count is at least one. |
The analysis steps, the file-overlap matrix, and the composition risks: context/plan-template.md "Execution-shape analysis". Each routing row also carries a Model (sonnet, opus or frontier) that decides which implementer agent dispatch uses; eligibility rules are in that file's "Per-phase routing table".
Each routing row also carries an Attempts cell. Mark a phase multi-shape when this step finds more than one plausible shape the design left open for it; leave it blank otherwise (one attempt). A marked phase's body lists one stated constraint per attempt and the selection rule (first pass, rank all, or best-of with its criteria), both written now, before any dispatch. The mark reads no setting: whether a marked phase gets several attempts is decided at dispatch. Format: that file's "Per-phase routing table".
Step 4.6: Tag unilateral decisions
Before Step 5, walk the PLAN body + Execution shape + Handoff sections and classify every decision NOT explicit in the brief: [EXEC-SHAPE] (your discretion within briefed scope) or [FALLBACK] (an invented contingency the brief didn't anticipate, for the user to confirm or override); briefed decisions get no tag. Then apply the confidence gate: DECIDE only when the basis is evidence captured this session (a codebase pattern read, a research finding, or a directly-on-point project convention) with no surviving reasonable alternative; everything below the bar (judgment calls, sizing guesses, either-would-work placements) routes to an interview round BEFORE the plan locks; hard-to-reverse decisions escalate early, per the Gates rule. Full gate, taxonomy, and presentation contract: context/tag-decisions.md. Surface every gate-passed decision at Step 5 in the "Decisions made (gate-passed)" TABLE (Decision | What it changes in the plan | Basis | Source). An adopted mitigation is classified per context/tag-decisions.md "Adopted mitigation".
Then apply the Step 4.7 outcome-gate criteria (under Planning Process, above) and present per Step 5. The approval presentation (Step 5) is with the gates at the start of Planning Process, so a compaction re-attach keeps it.
Plan Mode Integration
Built-in plan mode enforces read-only work during planning:
- During formulation (Steps 1-2): if already in plan mode when this skill triggers, stay in it
- During stress-test (Step 4): plan mode is appropriate
- After approval (Step 5): exit plan mode to begin execution. The user's approval is the gate
The skill does not enter plan mode itself; the user controls permission modes. Before planning a complex change outside plan mode, suggest it: "Consider entering plan mode (shift+tab) for safe exploration while we design this."
Entering plan mode licenses a scoping confirm: a short round of questions that settle what this plan covers, no more than one AskUserQuestion call holds (the per-call question limit: https://code.claude.com/docs/en/agent-sdk/user-input#limitations), as one numbered round before proposing it. The round renders via AskUserQuestion only when the plugin's use_ask_user_question user config is on and the questions are independent. Inline prose otherwise.
Substantive rounds do not belong in plan mode. A question that resolves what we are building (real tradeoffs, contested requirements, anything whose answer changes the plan's shape) routes to /planning:interview via the Skill tool, run with plan mode off: that skill writes its open-question register to disk at ask time (what plan mode permits: Analyze before you edit with plan mode), and plan mode primes the run toward producing the plan when the job is still reaching shared understanding. Getting there is the user's move, not yours: when plan mode is active and a substantive round comes due, say why and ask the user to exit it (shift+tab), then invoke the interview once they have. Do not invoke it from inside plan mode.
Boundary, the built-in /plan command
The command and this skill share a name, so "plan this" can mean either.
/plan(built-in command): enters plan mode. Its forms are in the/planrow of All commands. This skill offers it to the person and never runs it.- This skill (marketplace plugin). The planning discipline: stress-test, blast radius, an approval gate, and a persisted PLAN.md a cleared session can execute.
Routing. Where Plan Mode Integration says to suggest plan mode, offer it to the person: If /plan is available in your session (gate basis: the records in reference/native-plan.md), you can run it (or press shift+tab) alongside this skill. Prefer this skill for the plan itself. When the caller passes --unattended, the run records the offer in its output instead of asking; without that flag it asks.
Mutation gate. This skill writes PLAN.md and its checklist; /plan changes the permission mode. This skill never toggles the mode on the person's behalf.
Availability is never assumed. This section states what to do when the person can run /plan, never that it is present. The four-part records live in reference/native-plan.md.
Boundary, the built-in Plan agent
Both produce an implementation plan, so "plan this" can also route to the subagent.
Plan(built-in subagent): reached through the Agent tool'ssubagent_type; this skill's approval gate does not apply to it. Its purpose, context and tools are in Built-in subagents.- This skill (marketplace plugin): the plan the person approves: stress-test, blast radius, decision gates, and a persisted PLAN.md.
Routing. When the built-in Plan agent resolves in this session, dispatch it for a throwaway approach sketch or read-only context-gathering whose result feeds other work; use this skill when the plan needs the person's approval or must outlive the session. This skill may dispatch Plan to gather context, but the plan it presents is its own.
Mutation gate. This skill writes PLAN.md and its checklist; a dispatched Plan agent never writes them.
The four-part records live in reference/native-plan-agent.md.
Plan Review Mode
Read context/review-mode.md when invoked with review. It holds the review procedure, the re-plan branch for a review invoked after an implementation divergence, and how review differs from /planning:devils-advocate.
Final step: persist the approved plan for handoff
After the user approves in Step 5, update the draft <memory_dir>/<topic-slug>/PLAN.md (default .work/; persisted at Step 4.7) with any approval-round changes and its Approval: line (who approved and when, or the unattended basis Step 5 names), and write each superseded-by-plan row's result to the ledger once the user has replied to that row (reconfirmed or restored, per "Plan changes after the Brief"). The plan is not approved while any listed change lacks its reply: when an interview ledger exists, rerun bash "${CLAUDE_PLUGIN_ROOT}/scripts/check-open-questions.sh" --ledger <ledger> before handing off and require exit 0 (no open or superseded-by-plan row left); with or without a ledger, a listed change still lacking its reply means asking for it and not handing off. After writing the Approval: line, run bash "${CLAUDE_PLUGIN_ROOT}/scripts/check-plan-outcome.sh" --approval-only <PLAN.md> and require exit 0 before handoff; on an unattended run a failure means reporting the plan as unapproved. The script checks only that the line exists and its value is neither empty, the template placeholder, nor TBD; whether the recorded mandate is adequate stays a judgment.
Derive <topic-slug> from the task or branch name (kebab-case, ≤40 chars; shared with /planning:prd, /planning:interview, /planning:design); placement per the lifecycle artifact protocol ${CLAUDE_PLUGIN_ROOT}/reference/artifact-protocol.md. PLAN.md lives in the self-ignored memory slice and is never staged; paste its published copy (see "Reader depth") into the pull request body or the linked issue so reviewers see it, and refresh that paste when an implementation phase changes the plan. Every link written to the tracker (that paste, the publish-plan comment, a close-out paste) is the item's title linked to its absolute URL, never a bare #<n>, so it resolves from any page that quotes it. It is the living source of truth for the stage: a fresh cleared session in this checkout must be able to execute the plan reading only this file (plus the exploration and research artifacts in <memory_dir>/<topic-slug>/, default .work/). Its ## Design section carries the design decisions, so neither that session nor a worker it dispatches needs the design/ directory.
Plan store. After the Approval: check passes, resolve plan_store, lowest layer first: the default local; the plugin's plan_store user config (${user_config.plan_store}); then the plan_store key of the repository's docs/conventions/planning.yaml, which wins when set (schema: ${CLAUDE_PLUGIN_ROOT}/schemas/planning.schema.json). Read that key from the file in this checkout, under the same root rule as phase_order (Step 2); a missing file or key means the layer is unset. No ~/.claude file, .claude/ fallback or personal override sets this key. A user config value of local is reported as the default, since the two cannot be told apart, and a literal unexpanded ${user_config.plan_store} means the user config layer is unset, not invalid. A value other than local or tracker in either layer is named with its file (or user config), key and value, and that layer is dropped: a valid higher layer still wins, with none the key is local, and a lower layer's value never replaces it. Report one line naming the value and its layer, e.g. plan_store: tracker (docs/conventions/planning.yaml).
local: nothing more; PLAN.md stays in the memory slice.tracker: publish the approved plan to the work item this session claimed (through/work-items:workor/work-items:track start) by invoking/work-items:track publish-plan <id> <published copy>through the Skill tool, when/work-items:trackis among the available skills. That comment is the issue copy of the plan. With no claimed item, without that skill, or whenpublish-planstops because the bound tracker cannot hold the comment, keep the plan local and say which applied. Only the approved plan is published; the Step 4.7 draft never is.
Reader depth. Before publishing or pasting, resolve plan_reader, lowest layer first: the default step-by-step; the plugin's plan_reader user config (${user_config.plan_reader}); the plan_reader key of docs/conventions/planning.yaml; PLAN.md's Reader depth: line, when an earlier publish wrote one; then a --reader <depth> argument on this run, which wins. Both config layers follow plan_store's root rule, unset and invalid-value handling, and report line. An argument outside guardrails, standard and step-by-step is named and dropped the same way, so it resolves the default, not a lower layer's value. Report e.g. plan_reader: guardrails (--reader), and write the value and its layer to PLAN.md's Reader depth: line, so close-out and a mid-flight refresh in a later session publish at the same depth. step-by-step publishes PLAN.md itself. guardrails and standard render PLAN.<depth>.md beside it, keeping its Approval: line, and that derived file is the published copy for publish-plan and the pull request paste; PLAN.md stays whole. Delete a derived file of any other depth. The sections each depth keeps: ${CLAUDE_PLUGIN_ROOT}/skills/plan/templates/plan-md-anatomy.md "Reader-depth renders".
PLAN.md anatomy. PLAN holds Brief + Design + Plan; per-phase status lives in the phase tags ([TODO] / [DOING] / [DONE]), never in a separate status block. Copy the skeleton from ${CLAUDE_PLUGIN_ROOT}/skills/plan/templates/plan-md-anatomy.md when writing the file at this step (Read the template, then write PLAN.md with the Write tool; never cp, sed or a shell redirect from a plugin file), and read it again when a phase tag changes: it owns the section order, the tag grammar, and what each section must contain for a cleared session to execute the plan from this file alone.
PLAN.md is a multi-turn shared artifact: re-read it from disk before every write, since another turn or agent may have modified it. Prefer appending or refining sections over wholesale rewrites.
Write the plan even for small changes; only the one-sentence skip (Purpose) writes none.
Close-out (PR time). Read context/close-out.md when invoked with close-out. It holds the three-step procedure, the ADR handoff to /architecture:record-decision, and the spec-container ship ritual.
Mid-flight pivots: when scope changes after approval, append a dated scope-change note to the affected PLAN.md section capturing the rationale, and strikethrough+link the obsolete content. PLAN.md is never committed, so these notes are its only history; re-render any derived copy ("Reader depth") and refresh the pull request body or linked issue paste so the published copy carries them (under plan_store: tracker, rerun publish-plan, which edits its comment in place). Do not silently rewrite history.
After writing, recommend: clear context and begin implementation. The implementing session reads PLAN.md for the execution roadmap.
What This Skill Does NOT Do
- Does not replace
/planning:devils-advocate. It decides when to invoke it, based on blast radius andplan_stress_test - Does not replace research. It uses research findings as input and may trigger more research in Step 4
- Does not replace built-in plan mode, a permission mode; the two complement each other
- Does not write code. Execution is a separate stage
- Does not block execution or make decisions. It structures the decision and gates on user approval; the user can always override
Next
- The approved plan runs in this session: /implementation:implement.
- The execution shape routes phases to worker subagents: /implementation:implement-dispatch.
- The plan holds more than one independently shippable ticket, or a later session, an AFK lane or another person picks it up: /work-items:decompose.
Gotchas
- The Step 3 reviewer brief is the lever, not the step. If the user finds a gap in 5 seconds that the fresh-context reviewer missed, tighten the reviewer brief rather than adding an inline self-critique
- Don't skip the prerequisite check. Plans built without exploration miss existing patterns; plans without research repeat solved mistakes. The prerequisite check is 30 seconds; the rework is 30 minutes
- Scale the plan to the task. A 50-line plan for a typo fix is over-engineering; a 3-bullet plan for a cross-cutting refactor is under-engineering
- Don't confuse this skill with built-in plan mode. If a user types "plan this", they want the discipline, not the permission mode
- Research-iterate has a ceiling. 3 iterations max before escalating to the user. If 3 rounds can't resolve it, the approach may need to change, not just the evidence
- The plan is a proposal. Never start executing without user approval
- Step 4.5 (Execution shape) is default ON for ≥2-phase plans. Skip explicitly only for single-phase plans or trivial fixes, stated in one line
- Open Decisions resolved BEFORE the plan body is authored. Surfacing them mid-plan-body forces re-iteration during Step 5
- Sanity Check criteria are mechanically verifiable. Write the exact command a reviewer would run (grep, Read assertion, build/test exit)
04 同仓库更多 Skills
track
Backlog reads through the bound tracker: search open and closed items, view one item with its comments and state history. Use when another skill searches or reads tracker items.
reviewer-media
Reviewer media for one pull request: decides whether it needs a narrated walkthrough, builds the storyboard from /review:explain-change's digest, has /explainer-video:produce render it and hands the manifest to /source-control:pull-request media. Use when asked for 'reviewer media', 'a walkthrough video for this PR', 'a produced video of this change', or when pull-request ready or monitor hands a PR over.
route
Model and effort per agent role (orchestrator, worker, verifier, retrieval) for a multi-agent run, resolved through the bundled defaults and the user, team and personal override config layers into fenced JSON with single-agent and fan-out variants and the layer behind each value. Use when asked 'which model for the subagents', 'route the roles' or 'model routing', or before a skill passes a role's model on a spawn.
route
Model and effort per agent role (orchestrator, worker, verifier, retrieval) for a multi-agent run, resolved through the bundled defaults and the user, team and personal override config layers into fenced JSON with single-agent and fan-out variants and the layer behind each value. Use when asked 'which model for the subagents', 'route the roles' or 'model routing', or before a skill passes a role's model on a spawn.
principles
Module-design vocabulary for architecture findings, and the checks built on it. Use when: 'what is a deep module', 'what is a seam', 'deep vs shallow module', 'what is the deletion test', 'leverage and locality', 'module design vocabulary', 'which word do we use for X in architecture findings'. Scanning a codebase for friction is /architecture:improve.
write
Structured five-field bug report (title, steps to reproduce, expected vs actual, justified severity, suggested fix location) from an informal description, read-only. Use when the user names a defect they observed, or asks for one written up ('report a bug', 'file a bug', 'write this up as a bug').