/plan-feature:plan-featurefrom plan-feature
Guides users through requirements clarification, codebase exploration, and produces a plan.md with architecture diagrams, issue links, and verification steps before any code is written. Use at the start of non-trivial feature work.
Ships in plan-feature. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Most failed AI-coding sessions don't fail because the model is incapable. They fail because the human didn't give it enough context. This skill turns the user into Claude's product manager for ~15 minutes before any code gets written, dramatically increasing the success rate of the actual implementation.
The output is a plan.md file that captures everything a competent engineer would need to ship the feature without ambiguity — including a diagram of the proposed design, because an implementer grasps the intended shape far faster from a picture than from a prose description.
plan.md is also the input the pr-prepare skill reads when the work is ready for review. It looks there for issue identifiers (to name the branch and link the PR), the leaf/core classification, the acceptance conditions and setup a reviewer needs to reproduce verification, and the evidence plan (screenshots, performance report). Deciding these now is cheap; reconstructing them from a finished diff is guesswork. The template below is shaped so each section maps onto a section of the PR body.
Use whenever the user asks to build something non-trivial. Triggers include:
Do not use for: typo fixes, single-line config changes, simple renames, or when the user has already provided a complete spec.
Follow these in order. Stop at the user-approval step before drafting code.
Ask the user, in 1-3 questions:
Also capture any tracking issue: a GitHub/Gitea issue (#123 or an issue URL) or a Jira key (GAIA-5375). Take identifiers only from what the user says or pastes — never guess one from a similar title — and if there is none, record N/A rather than asking repeatedly. pr-prepare builds the branch name and PR links from this field.
Do not move on until you have a one-paragraph problem statement that the user has confirmed.
Look around before designing. Use Read, Grep, and Glob to:
core code (auth, payment, schema, shared frameworks) vs leaf code (the feature itself)If the codebase is large or unfamiliar, ask the user pointed questions: "Where does auth happen?", "Show me an existing feature similar to X."
Produce two lists, validated with the user:
If the feature would naturally touch core code, surface that explicitly and discuss whether the change should be split into a human-led core change plus a leaf-node feature change.
Record the resulting classification in the plan, using the stricter category that applies:
If the blast radius is unclear, ask: "If this code is buggy, how far would the failure spread?" The classification decides how many reviewers the PR needs, so it belongs in the plan rather than being re-derived later. Also flag when the feature changes auth, payment, permission, or an external interface — those need a security review before merge, and the reviewer should know that from the start.
Before any code is written, agree on how correctness will be checked. Write it so that a reviewer who has never seen this conversation could reproduce it — that is exactly what the PR will later need to show.
Then decide the evidence plan — what a reviewer will need to see beyond passing tests, because a UI change can't be judged from text and a performance claim can't be judged without numbers. Apply every row that matches:
| Signal in the goal / scope | Evidence to plan |
|---|---|
| UI components, templates, styles, user-visible copy, or layout | Before/after screenshots: which pages, which states, desktop 1280×800 (plus mobile 390×844 if responsive), and the data/role used |
| A performance goal or constraint (latency, throughput, memory, bundle size), or work on hot paths, queries/indexes, caching, concurrency | Performance report: which benchmark or workload, which metrics (median, p95), dataset size, base vs head |
| Pure backend logic, docs, CI, or a dependency bump with no performance claim | N/A with a one-line reason |
Any numeric constraint you put in the plan (say, "latency < 500ms") is a claim someone will have to prove, so pair it with how it will be measured. If no measurement method exists, either plan one or drop the number.
Verification design comes BEFORE implementation design — this is the "verifiable checkpoints" principle.
By now you know the goal, the surrounding code, and the scope — enough to draw how the feature will fit together before any of it exists. Drawing it makes the proposed design reviewable: a wrong boundary or a missing call is easy to catch in a diagram, easy to miss in a paragraph. Draw it as a Mermaid diagram so it renders natively inside plan.md on GitHub/Gitea, travels with the plan, and diffs cleanly as the design evolves.
Pick the diagram type from what the feature mainly is:
| The feature is mainly about… | Use | Mermaid header |
|---|---|---|
| Interactions/handshakes over time (auth flow, request lifecycle, calls between services / client↔server) | Sequence diagram | sequenceDiagram |
| Control flow, decision logic, or a pipeline (branching, data transform, job steps) | Flowchart | flowchart TD |
| New or rewired modules / packages / services (structural dependencies) | Component diagram | flowchart LR with one subgraph per module |
| A state machine (status transitions, token / job lifecycle) | State diagram | stateDiagram-v2 |
Rules that keep the diagram honest and renderable:
style NewSvc fill:#dff0d8,stroke:#3c763d, and draw the existing code the feature plugs into in the default style so the boundary is obvious. Per-node style lines work; %%{init: ...}%% theme directives do not — GitHub strips them.TD over LR when wide. GitHub renders inside the markdown column; wide diagrams force horizontal scroll. Group related nodes in subgraph blocks so they wrap.click handlers / interactivity — GitHub renders a static SVG and ignores them.If the feature is genuinely trivial, skip the diagram and say so — don't draw a one-box graph. The user confirms the diagram during plan review (Step 7).
Write the plan to plan.md in the working directory using this template. Be concrete, not abstract.
plan.md is a working document for the author and the executing session, not part of the change: do not commit it or add it to the scope list. pr-prepare summarizes its goal and scope into the PR body's "Plan reference" section instead. If the repository's .gitignore doesn't already cover it, mention that to the user so it isn't staged by accident.
# Plan: <feature name>
## Goal
<1-paragraph problem statement, who uses it, what done looks like>
## Related issues
- Jira: <GAIA-5375, or N/A>
- GitHub/Gitea: <#123 or issue URL, or N/A>
## Architecture / flow
<Mermaid diagram of the proposed design. Omit this section for trivial features.>
```mermaid
flowchart TD
Req[GET /reports/active-users] --> Auth[admin auth middleware]
Auth --> Svc[reports/active-users service.ts]
Svc --> Q[query: logins last 7d by channel]
Q --> DB[(users / sessions tables)]
Svc --> Resp[JSON: channel, count, last_seen]
style Req fill:#dff0d8,stroke:#3c763d
style Svc fill:#dff0d8,stroke:#3c763d
style Q fill:#dff0d8,stroke:#3c763d
style Resp fill:#dff0d8,stroke:#3c763d
```
## Scope
### May modify
- src/path/to/file.ts
- src/path/to/dir/
### Must not modify
- src/auth/*
- src/db/schema.ts
## Change classification
- Leaf | Core: <one, with a one-line blast-radius reason>
- Security review needed: <yes — what auth/payment/permission/external interface changes | no>
## Existing patterns to follow
- Mirror the structure of `src/reports/revenue.ts`:
- `service.ts` for queries
- `route.ts` for HTTP handler
- `*.test.ts` for tests
## Constraints
- No new third-party dependencies
- Query latency < 500ms (measured as described in Evidence plan)
- Must use existing admin auth middleware
## Verification
### Setup
- Prerequisites: <services, config/env var names, test data, account roles>
- Start: <exact commands from the repo, and the signal that it's ready>
### Automated checks
- `<repo command>` — <what it covers>
- `<repo command>` — <what it covers>
### Acceptance scenarios
1. Happy path — <name>
- Starting state: <data, role, config>
- Action: <concrete request / command / UI steps with real inputs>
- Expected: <observable result>
2. Error case — <name>
- Starting state: …
- Action: …
- Expected: …
3. Error case — <name>
- Starting state: …
- Action: …
- Expected: …
- Stress / soak test: <if applicable, or N/A>
- Manual verification: <if applicable, or N/A>
## Evidence plan
- Screenshots: <pages, states, viewports, data/role — or N/A with reason>
- Performance report: <benchmark/workload, metrics, dataset size, base vs head — or N/A with reason>
## Done definition
- [ ] All automated checks and acceptance scenarios pass
- [ ] Evidence in the Evidence plan is captured (or marked Not run with a reason)
- [ ] No changes outside the "may modify" list
- [ ] <other domain-specific criteria>
- [ ] PR opened with `pr-prepare` (AI authorship disclosed, classification and verification carried over from this plan)
## Risks & rollback
- Risk: <what could go wrong>
- Rollback: <how to revert>
## Open questions
- <anything still ambiguous>
Show the plan to the user and ask: "Does this look right? Anything to add or remove?" Walk through the diagram with them explicitly — a wrong arrow or a missing module is far cheaper to fix here than after the code is written.
Do not skip this step. The plan is only useful if the user has actually read it and corrected any drift.
If the user wants to write the code right now in this conversation, that's fine — but the plan is still the contract. Refer back to it.
After approval, recommend the user:
/pr-prepare. It reads plan.md for the issue identifiers, classification, verification, and evidence plan, so the PR body reflects what was agreed here instead of what's reconstructable from the diff.This separation matters: the planning conversation often fills 80k+ tokens of exploration. Compacting drops that down to a few thousand and gives the executing conversation a clean focus.
Remind the user that plan.md stays out of the commit.
## Goal
Internal ops team needs a daily report of users who logged in within
the last 7 days, broken out by signup channel. Done means: an admin-
only endpoint at GET /reports/active-users that returns JSON with
{channel, count, last_seen} rows, sortable by count.
## Goal
Active users report.
(Too short. The implementer cannot tell who uses it, what "active" means, or what fields to return.)
End the skill when:
plan.md exists, the user has approved it, and the handoff recommendation has been given, ORWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub appleboy/skills --plugin plan-featureOther plugins' skills for the same job