/spec-kitty.plan - Create Implementation Plan
Version: 0.11.0+
📍 WORKING DIRECTORY: Stay in planning repository
IMPORTANT: Plan works in the planning repository. NO worktrees created.
# Run from project root (same directory as /spec-kitty.specify):
# You should already be here if you just ran /spec-kitty.specify
# Creates:
# - kitty-specs/###-feature/plan.md → In planning repository
# - Commits to target branch
# - NO worktrees created
Do NOT cd anywhere. Stay in the planning repository root.
User Input
$ARGUMENTS
You MUST consider the user input before proceeding (if not empty).
Location Check (0.11.0+)
This command runs in the planning repository, not in a worktree.
- Resolve branch context from deterministic JSON output, not from
meta.json inspection:
- Run
spec-kitty agent feature setup-plan --feature <feature-slug> --json
- Use
target_branch / base_branch (and uppercase aliases) from that payload
- Ensure
git branch --show-current matches target_branch
- Planning artifacts live in
kitty-specs/###-feature/
- The plan template is committed to the target branch after generation
Path reference rule: When you mention directories or files, provide either the absolute path or a path relative to the project root (for example, kitty-specs/<feature>/tasks/). Never refer to a folder by name alone.
Planning Interrogation (mandatory)
Before executing any scripts or generating artifacts you must interrogate the specification and stakeholders.
Scope proportionality (CRITICAL): FIRST, assess the feature's complexity from the spec:
- Trivial/Test Features (hello world, simple static pages, basic demos): Ask 1-2 questions maximum about tech stack preference, then proceed with sensible defaults
- Simple Features (small components, minor API additions): Ask 2-3 questions about tech choices and constraints
- Complex Features (new subsystems, multi-component features): Ask 3-5 questions covering architecture, NFRs, integrations
- Platform/Critical Features (core infrastructure, security, payments): Full interrogation with 5+ questions
User signals to reduce questioning: If the user says "use defaults", "just make it simple", "skip to implementation", "vanilla HTML/CSS/JS" - recognize these as signals to minimize planning questions and use standard approaches.
First response rule:
- For TRIVIAL features: Ask ONE tech stack question, then if answer is simple (e.g., "vanilla HTML"), proceed directly to plan generation
- For other features: Ask a single architecture question and end with
WAITING_FOR_PLANNING_INPUT
If the user has not provided plan context, keep interrogating with one question at a time.
Conversational cadence: After each reply, assess if you have SUFFICIENT context for this feature's scope. For trivial features, knowing the basic stack is enough. Only continue if critical unknowns remain.
Planning requirements (scale to complexity):
- Maintain a Planning Questions table internally covering questions appropriate to the feature's complexity (1-2 for trivial, up to 5+ for platform-level). Track columns
#, Question, Why it matters, and Current insight. Do not render this table to the user.
- For trivial features, standard practices are acceptable (vanilla HTML, simple file structure, no build tools). Only probe if the user's request suggests otherwise.
- When you have sufficient context for the scope, summarize into an Engineering Alignment note and confirm.
- If user explicitly asks to skip questions or use defaults, acknowledge and proceed with best practices for that feature type.
Outline
Check planning discovery status:
- If any planning questions remain unanswered or the user has not confirmed the Engineering Alignment summary, stay in the one-question cadence, capture the user's response, update your internal table, and end with
WAITING_FOR_PLANNING_INPUT. Do not surface the table. Do not run the setup command yet.
- Once every planning question has a concrete answer and the alignment summary is confirmed by the user, continue.
Detect feature context (CRITICAL - prevents wrong feature selection):
Before running any commands, detect which feature you're working on:
a. Check git branch name:
- Run:
git rev-parse --abbrev-ref HEAD
- If branch matches pattern
###-feature-name or ###-feature-name-WP##, extract the feature slug (strip -WP## suffix if present)
- Example: Branch
020-my-feature or 020-my-feature-WP01 → Feature 020-my-feature
b. Check current directory:
- Look for
###-feature-name pattern in the current path
- Examples:
- Inside
kitty-specs/020-my-feature/ → Feature 020-my-feature
- Not in a worktree during planning (worktrees only used during implement): If detection runs from
.worktrees/020-my-feature-WP01/ → Feature 020-my-feature
c. Prioritize features without plan.md (if multiple exist):
- If multiple features exist and none detected from branch/path, list all features in
kitty-specs/
- Prefer features that don't have
plan.md yet (unplanned features)
- If ambiguous, ask the user which feature to plan
d. Extract feature slug:
- Feature slug format:
###-feature-name (e.g., 020-my-feature)
- You MUST pass this explicitly to the setup-plan command using
--feature flag
- DO NOT rely on auto-detection by the CLI (prevents wrong feature selection)
Setup: Run spec-kitty agent feature setup-plan --feature <feature-slug> --json from the repository root and parse JSON for:
result: "success" or error message
plan_file: Absolute path to the created plan.md
feature_dir: Absolute path to the feature directory
target_branch / base_branch (deterministic branch contract for downstream commands)
Example:
# If detected feature is 020-my-feature:
spec-kitty agent feature setup-plan --feature 020-my-feature --json
Error handling: If the command fails with "Cannot detect feature" or "Multiple features found", verify your feature detection logic in step 2 and ensure you're passing the correct feature slug.
Load context: Read FEATURE_SPEC and .kittify/memory/constitution.md if it exists. If the constitution file is missing, skip Constitution Check and note that it is absent. Load IMPL_PLAN template (already copied).
Execute plan workflow: Follow the structure in IMPL_PLAN template, using the validated planning answers as ground truth:
- Update Technical Context with explicit statements from the user or discovery research; mark
[NEEDS CLARIFICATION: …] only when the user deliberately postpones a decision
- If a constitution exists, fill Constitution Check section from it and challenge any conflicts directly with the user. If no constitution exists, mark the section as skipped.
- Evaluate gates (ERROR if violations unjustified or questions remain unanswered)
- Phase 0: Generate research.md (commission research to resolve every outstanding clarification)
- Phase 1: Generate data-model.md, contracts/, quickstart.md based on confirmed intent
- Phase 1: Update agent context by running the agent script
- Re-evaluate Constitution Check post-design, asking the user to resolve new gaps before proceeding
STOP and report: This command ends after Phase 1 planning. Report branch, IMPL_PLAN path, and generated artifacts.
⚠️ CRITICAL: DO NOT proceed to task generation! The user must explicitly run /spec-kitty.tasks to generate work packages. Your job is COMPLETE after reporting the planning artifacts.
Phases
Phase 0: Outline & Research
Extract unknowns from Technical Context above:
- For each NEEDS CLARIFICATION → research task
- For each dependency → best practices task
- For each integration → patterns task
Generate and dispatch research agents:
For each unknown in Technical Context:
Task: "Research {unknown} for {feature context}"
For each technology choice:
Task: "Find best practices for {tech} in {domain}"
Consolidate findings in research.md using format:
- Decision: [what was chosen]
- Rationale: [why chosen]
- Alternatives considered: [what else evaluated]
Output: research.md with all NEEDS CLARIFICATION resolved
Phase 1: Design & Contracts
Prerequisites: research.md complete
Extract entities from feature spec → data-model.md:
- Entity name, fields, relationships
- Validation rules from requirements
- State transitions if applicable
Generate API contracts from functional requirements:
- For each user action → endpoint
- Use standard REST/GraphQL patterns
- Output OpenAPI/GraphQL schema to
/contracts/
Agent context update:
- Run ``
- These scripts detect which AI agent is in use
- Update the appropriate agent-specific context file
- Add only new technology from current plan
- Preserve manual additions between markers
Output: data-model.md, /contracts/*, quickstart.md, agent-specific file
Key rules
- Use absolute paths
- ERROR on gate failures or unresolved clarifications
⛔ MANDATORY STOP POINT
This command is COMPLETE after generating planning artifacts.
After reporting:
plan.md path
research.md path (if generated)
data-model.md path (if generated)
contracts/ contents (if generated)
- Agent context file updated
YOU MUST STOP HERE.
Do NOT:
- ❌ Generate
tasks.md
- ❌ Create work package (WP) files
- ❌ Create
tasks/ subdirectories
- ❌ Proceed to implementation
The user will run /spec-kitty.tasks when they are ready to generate work packages.
Next suggested command: /spec-kitty.tasks (user must invoke this explicitly)
1---2name: spec-kitty-plan3description: Execute the implementation planning workflow using the plan template4---56# /spec-kitty.plan - Create Implementation Plan78**Version**: 0.11.0+910## 📍 WORKING DIRECTORY: Stay in planning repository1112**IMPORTANT**: Plan works in the planning repository. NO worktrees created.1314```bash15# Run from project root (same directory as /spec-kitty.specify):16# You should already be here if you just ran /spec-kitty.specify1718# Creates:19# - kitty-specs/###-feature/plan.md → In planning repository20# - Commits to target branch21# - NO worktrees created22```2324**Do NOT cd anywhere**. Stay in the planning repository root.2526## User Input2728```text29$ARGUMENTS30```3132You **MUST** consider the user input before proceeding (if not empty).3334## Location Check (0.11.0+)3536This command runs in the **planning repository**, not in a worktree.3738- Resolve branch context from deterministic JSON output, not from `meta.json` inspection:39 - Run `spec-kitty agent feature setup-plan --feature <feature-slug> --json`40 - Use `target_branch` / `base_branch` (and uppercase aliases) from that payload41 - Ensure `git branch --show-current` matches `target_branch`42- Planning artifacts live in `kitty-specs/###-feature/`43- The plan template is committed to the target branch after generation4445**Path reference rule:** When you mention directories or files, provide either the absolute path or a path relative to the project root (for example, `kitty-specs/<feature>/tasks/`). Never refer to a folder by name alone.4647## Planning Interrogation (mandatory)4849Before executing any scripts or generating artifacts you must interrogate the specification and stakeholders.5051- **Scope proportionality (CRITICAL)**: FIRST, assess the feature's complexity from the spec:52 - **Trivial/Test Features** (hello world, simple static pages, basic demos): Ask 1-2 questions maximum about tech stack preference, then proceed with sensible defaults53 - **Simple Features** (small components, minor API additions): Ask 2-3 questions about tech choices and constraints54 - **Complex Features** (new subsystems, multi-component features): Ask 3-5 questions covering architecture, NFRs, integrations55 - **Platform/Critical Features** (core infrastructure, security, payments): Full interrogation with 5+ questions5657- **User signals to reduce questioning**: If the user says "use defaults", "just make it simple", "skip to implementation", "vanilla HTML/CSS/JS" - recognize these as signals to minimize planning questions and use standard approaches.5859- **First response rule**:60 - For TRIVIAL features: Ask ONE tech stack question, then if answer is simple (e.g., "vanilla HTML"), proceed directly to plan generation61 - For other features: Ask a single architecture question and end with `WAITING_FOR_PLANNING_INPUT`6263- If the user has not provided plan context, keep interrogating with one question at a time.6465- **Conversational cadence**: After each reply, assess if you have SUFFICIENT context for this feature's scope. For trivial features, knowing the basic stack is enough. Only continue if critical unknowns remain.6667Planning requirements (scale to complexity):68691. Maintain a **Planning Questions** table internally covering questions appropriate to the feature's complexity (1-2 for trivial, up to 5+ for platform-level). Track columns `#`, `Question`, `Why it matters`, and `Current insight`. Do **not** render this table to the user.702. For trivial features, standard practices are acceptable (vanilla HTML, simple file structure, no build tools). Only probe if the user's request suggests otherwise.713. When you have sufficient context for the scope, summarize into an **Engineering Alignment** note and confirm.724. If user explicitly asks to skip questions or use defaults, acknowledge and proceed with best practices for that feature type.7374## Outline75761. **Check planning discovery status**:77 - If any planning questions remain unanswered or the user has not confirmed the **Engineering Alignment** summary, stay in the one-question cadence, capture the user's response, update your internal table, and end with `WAITING_FOR_PLANNING_INPUT`. Do **not** surface the table. Do **not** run the setup command yet.78 - Once every planning question has a concrete answer and the alignment summary is confirmed by the user, continue.79802. **Detect feature context** (CRITICAL - prevents wrong feature selection):8182 Before running any commands, detect which feature you're working on:8384 a. **Check git branch name**:85 - Run: `git rev-parse --abbrev-ref HEAD`86 - If branch matches pattern `###-feature-name` or `###-feature-name-WP##`, extract the feature slug (strip `-WP##` suffix if present)87 - Example: Branch `020-my-feature` or `020-my-feature-WP01` → Feature `020-my-feature`8889 b. **Check current directory**:90 - Look for `###-feature-name` pattern in the current path91 - Examples:92 - Inside `kitty-specs/020-my-feature/` → Feature `020-my-feature`93 - Not in a worktree during planning (worktrees only used during implement): If detection runs from `.worktrees/020-my-feature-WP01/` → Feature `020-my-feature`9495 c. **Prioritize features without plan.md** (if multiple exist):96 - If multiple features exist and none detected from branch/path, list all features in `kitty-specs/`97 - Prefer features that don't have `plan.md` yet (unplanned features)98 - If ambiguous, ask the user which feature to plan99100 d. **Extract feature slug**:101 - Feature slug format: `###-feature-name` (e.g., `020-my-feature`)102 - You MUST pass this explicitly to the setup-plan command using `--feature` flag103 - **DO NOT** rely on auto-detection by the CLI (prevents wrong feature selection)1041053. **Setup**: Run `spec-kitty agent feature setup-plan --feature <feature-slug> --json` from the repository root and parse JSON for:106 - `result`: "success" or error message107 - `plan_file`: Absolute path to the created plan.md108 - `feature_dir`: Absolute path to the feature directory109 - `target_branch` / `base_branch` (deterministic branch contract for downstream commands)110111 **Example**:112 ```bash113 # If detected feature is 020-my-feature:114 spec-kitty agent feature setup-plan --feature 020-my-feature --json115 ```116117 **Error handling**: If the command fails with "Cannot detect feature" or "Multiple features found", verify your feature detection logic in step 2 and ensure you're passing the correct feature slug.1181194. **Load context**: Read FEATURE_SPEC and `.kittify/memory/constitution.md` if it exists. If the constitution file is missing, skip Constitution Check and note that it is absent. Load IMPL_PLAN template (already copied).1201215. **Execute plan workflow**: Follow the structure in IMPL_PLAN template, using the validated planning answers as ground truth:122 - Update Technical Context with explicit statements from the user or discovery research; mark `[NEEDS CLARIFICATION: …]` only when the user deliberately postpones a decision123 - If a constitution exists, fill Constitution Check section from it and challenge any conflicts directly with the user. If no constitution exists, mark the section as skipped.124 - Evaluate gates (ERROR if violations unjustified or questions remain unanswered)125 - Phase 0: Generate research.md (commission research to resolve every outstanding clarification)126 - Phase 1: Generate data-model.md, contracts/, quickstart.md based on confirmed intent127 - Phase 1: Update agent context by running the agent script128 - Re-evaluate Constitution Check post-design, asking the user to resolve new gaps before proceeding1291306. **STOP and report**: This command ends after Phase 1 planning. Report branch, IMPL_PLAN path, and generated artifacts.131132 **⚠️ CRITICAL: DO NOT proceed to task generation!** The user must explicitly run `/spec-kitty.tasks` to generate work packages. Your job is COMPLETE after reporting the planning artifacts.133134## Phases135136### Phase 0: Outline & Research1371381. **Extract unknowns from Technical Context** above:139 - For each NEEDS CLARIFICATION → research task140 - For each dependency → best practices task141 - For each integration → patterns task1421432. **Generate and dispatch research agents**:144 ```145 For each unknown in Technical Context:146 Task: "Research {unknown} for {feature context}"147 For each technology choice:148 Task: "Find best practices for {tech} in {domain}"149 ```1501513. **Consolidate findings** in `research.md` using format:152 - Decision: [what was chosen]153 - Rationale: [why chosen]154 - Alternatives considered: [what else evaluated]155156**Output**: research.md with all NEEDS CLARIFICATION resolved157158### Phase 1: Design & Contracts159160**Prerequisites:** `research.md` complete1611621. **Extract entities from feature spec** → `data-model.md`:163 - Entity name, fields, relationships164 - Validation rules from requirements165 - State transitions if applicable1661672. **Generate API contracts** from functional requirements:168 - For each user action → endpoint169 - Use standard REST/GraphQL patterns170 - Output OpenAPI/GraphQL schema to `/contracts/`1711723. **Agent context update**:173 - Run ``174 - These scripts detect which AI agent is in use175 - Update the appropriate agent-specific context file176 - Add only new technology from current plan177 - Preserve manual additions between markers178179**Output**: data-model.md, /contracts/*, quickstart.md, agent-specific file180181## Key rules182183- Use absolute paths184- ERROR on gate failures or unresolved clarifications185186---187188## ⛔ MANDATORY STOP POINT189190**This command is COMPLETE after generating planning artifacts.**191192After reporting:193- `plan.md` path194- `research.md` path (if generated)195- `data-model.md` path (if generated)196- `contracts/` contents (if generated)197- Agent context file updated198199**YOU MUST STOP HERE.**200201Do NOT:202- ❌ Generate `tasks.md`203- ❌ Create work package (WP) files204- ❌ Create `tasks/` subdirectories205- ❌ Proceed to implementation206207The user will run `/spec-kitty.tasks` when they are ready to generate work packages.208209**Next suggested command**: `/spec-kitty.tasks` (user must invoke this explicitly)