بنقرة واحدة
whyspec-plan
Use when planning a code change, capturing decisions before coding, or setting up the Decision Bridge.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Use when planning a code change, capturing decisions before coding, or setting up the Decision Bridge.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
| name | whyspec-plan |
| description | Use when planning a code change, capturing decisions before coding, or setting up the Decision Bridge. |
| argument-hint | <change-name-or-description> |
Plan a change — create intent.md, design.md, and tasks.md with the Decision Bridge.
When ready to implement, run /whyspec-execute
Input: A change name (kebab-case) or description of what to build via ARGUMENTS.
ACT FIRST, ASK ONLY WHEN STUCK. The user invoked /whyspec-plan with a description of what they want. Your job is to structure their intent into plan files — not to interview them.
Parse ARGUMENTS and infer intent
Read what the user typed. Derive a kebab-case name (e.g., "add user authentication" → add-user-auth).
If ARGUMENTS is empty or a single ambiguous word (e.g., just "plan" or "help"): Ask ONE question: "What change are you planning?" — then proceed.
If ARGUMENTS has any meaningful description (even brief): Proceed immediately. Do NOT ask forcing questions. The user told you what they want.
User: `/whyspec-plan add dark mode support` Agent: Creates change folder, writes intent.md capturing dark mode as the goal, design.md with CSS custom properties vs class-based approach trade-off, tasks.md with implementation steps. Why good: User stated what they want. Agent structured it into plan files without interrogation. User: `/whyspec-plan add dark mode support` Agent: "What problem does this solve? Who feels this pain today?" Why bad: The user literally just told you — they want dark mode. Asking "what problem does this solve" is patronizing checklist-walking. The answer is obvious from the input. User: `/whyspec-plan` Agent: "What change are you planning?" Why good: ARGUMENTS is empty. ONE question to get started is justified. User: `/whyspec-plan refactor auth middleware` Agent: "What constraints exist? What does success look like? How will you know it works?" Why bad: Three rounds of corporate interview questions. The user wants to refactor auth middleware — explore the codebase to understand constraints, don't ask generic questions.Create the change folder
whyspec plan --json "<name>"
Parse the JSON response:
path: The change directory (e.g., whyspec/changes/add-auth/)templates: Template content for intent.md, design.md, tasks.mdcontext: Project context from config.yaml (constraints for you — do NOT copy into files)rules: Project-specific rules (constraints for you — do NOT copy into files)If a change with that name already exists, ask: continue the existing change, or create a new one with a different name?
Explore codebase for context (if the change touches existing code)
Before writing plan files, read relevant code to understand:
Create intent.md
Write to <path>/intent.md. Here's a concrete filled-in example:
## Why This Change Exists
POST /api/users returns 500 under load because we have no rate limiting.
Production logs show 12k requests/min from a single IP during the March 28 incident.
## What It Enables
API stability under load. Prevents abuse without blocking legitimate traffic.
## Decisions to Make
- [ ] Rate limit storage: Redis (shared across 3 instances) vs in-memory (simpler, single-instance only)?
- [ ] Limit granularity: per-IP vs per-user-token vs both?
- [ ] Response on limit: 429 with Retry-After header vs 429 with custom error body?
These checkboxes form the "before" side of the Decision Bridge.
They will be resolved during /whyspec-capture after implementation.
## Constraints
- Must work with existing Express middleware chain (cors → helmet → bodyParser → routes)
- Redis (ioredis) already available at src/lib/redis.ts — prefer reuse over new dependency
- P99 latency budget: <5ms per request for rate limit check
## Success Looks Like
- `npm test` passes with rate limit integration tests
- Siege test: 1000 req/s returns 429 after threshold, Retry-After header present
- No latency regression visible in existing API benchmark
## Assumptions
- Redis is available in all environments (need to verify staging)
- Current ioredis client supports the rate limiting pattern we choose
IMPORTANT: The "Decisions to Make" checkboxes are the Decision Bridge. Every unsettled design choice MUST be listed here.
## Decisions to Make - [ ] Rate limit storage: Redis (shared across instances) vs in-memory (simpler, single-instance only)? - [ ] Limit granularity: per-IP vs per-user-token vs both? - [ ] Response on limit: 429 with Retry-After header vs 429 with custom error body? Why good: Specific, actionable decisions with concrete options derived from the codebase. ## Decisions to Make - [ ] What technology to use? - [ ] How to implement it? - [ ] What approach is best? Why bad: Vague decisions that could apply to literally any change. Not useful.Create design.md
Write to <path>/design.md. Skip the trade-off matrix for simple changes:
## Approach
[Chosen technical direction — 2-3 sentences grounded in the actual codebase]
## Trade-off Matrix
| Option | [Criterion 1] | [Criterion 2] | [Criterion 3] |
|--------|---------------|---------------|---------------|
| Option A | ... | ... | ... |
| Option B | ... | ... | ... |
## Architecture
[ASCII diagram showing the design — components, data flow, boundaries]
## Questions to Resolve
- [ ] [Open question needing an answer before or during coding]
## Risks & Unknowns
- [What could go wrong]
## Dependencies
- [External libraries, APIs, services]
Create tasks.md
Write to <path>/tasks.md. Define verification FIRST — goal-backward planning:
## Verification
What proves this change works — defined BEFORE tasks:
- [ ] [Verification criterion 1]
- [ ] [Verification criterion 2]
## Tasks
- [ ] Task 1: [description]
verify: [how to verify this specific task]
- [ ] Task 2: [description]
verify: [verification step]
Each task should be small enough for one atomic commit.
Show summary
## Plan Created: <name>
<path>/
intent.md — WHY: problem, constraints, success criteria
design.md — HOW: approach, trade-offs, decisions to make
tasks.md — WHAT: verification criteria + implementation checklist
Decisions to make: N pending
Tasks: N defined
Ready to implement? Run /whyspec-execute
| Tool | When to use | When NOT to use |
|---|---|---|
| Glob | Find files by pattern before writing plan (e.g., src/middleware/**/*.ts) | Don't glob blindly — know what area you're looking for |
| Grep | Search for patterns in code (e.g., existing rate limit logic, auth middleware) | Don't grep the whole repo — scope to relevant dirs |
| Read | Read specific files to understand architecture before planning | Don't read files unrelated to the change |
| Bash | Run whyspec plan --json (CLI-as-oracle). Run git log to understand recent changes | Don't run destructive commands |
| AskUserQuestion | ONLY when ARGUMENTS is empty or genuinely ambiguous (see format below) | Don't ask questions answerable by reading code |
Read the codebase BEFORE considering web search. Web search is justified ONLY when:
Never search the web for: architecture decisions, "best practices", or how to use a library already in the codebase.
When you MUST ask (ARGUMENTS empty, or genuinely stuck after codebase exploration):
<project> on <branch>"I found Express 4.18 with helmet middleware at src/middleware/index.ts, and an existing ioredis client at src/lib/redis.ts.
Should the rate limit apply globally (all routes) or only to /api/* routes? I'd suggest /api/* only — internal health checks shouldn't be rate-limited. Why good: Shows what was already found. Asks ONE specific question with a recommendation.
What problem does this solve? What constraints exist? How will you know it works? Why bad: Three generic questions. No codebase context. Classic checklist-walking.If you hit any of these, STOP and ask the user (max 3 attempts before escalating):
| Situation | Action |
|---|---|
| ARGUMENTS is genuinely ambiguous after codebase exploration | Ask ONE specific question, not a checklist |
| Multiple valid architectures with no clear winner | Present the trade-off matrix, ask user to pick |
| Change requires access or knowledge you don't have | State what you know, what you need, and ask |
| After 3 failed attempts to infer intent | Escalate: "I need more context. Here's what I've found so far: [findings]" |
/whyspec-execute.whyspec plan --json to create the folder. Don't create paths or generate IDs manually.context and rules as constraints — they guide your writing but must NOT appear in the output files.| If you catch yourself thinking... | Reality |
|---|---|
| "I should ask the user some clarifying questions first" | Read the codebase. Most "clarifying questions" can be answered by reading code. |
| "The user's description is too vague to plan" | Even "fix auth" is plannable — read the auth code, find the issues, plan the fix. |
| "I need to understand the full architecture before planning" | Plan the change, not the universe. Read what's relevant, skip what's not. |
| "I should create a comprehensive plan with all sections" | Scale to the change. A 1-line fix gets a 3-line plan. Don't over-engineer. |
| "Let me ask about success criteria" | Infer from the change. "Success = tests pass + the thing works." Write it yourself. |
| "I'll write generic placeholder text and the user can fill it in" | That's not planning. Populate every field with specific, codebase-grounded content. |
| If you're about to... | STOP — do this instead |
|---|---|
| Ask "What problem does this solve?" | Read ARGUMENTS — the user just told you |
| Ask "What constraints exist?" | Explore the codebase — find the constraints yourself |
| Ask "Who is this for?" | This is a code change, not a product pitch |
| Write a generic plan without reading code | Read the affected files first |
| Create a massive plan for a small fix | Scale the plan to match the change size |
| Skip Decisions to Make because "it's obvious" | If it's obvious, write it down — it takes 10 seconds |
Use after coding to preserve reasoning — resolves the Decision Bridge with actual outcomes.
Use when encountering any bug, test failure, or unexpected behavior — before proposing fixes.
Use when starting implementation, continuing work, or executing tasks from a WhySpec plan.
Use when looking for why something was built a certain way or finding past decisions.
Use when reviewing the full story of a change — intent, design, tasks, and Decision Bridge delta.