|
| 1 | +--- |
| 2 | +description: Execute the implementation planning workflow using the plan template to generate design artifacts. |
| 3 | +handoffs: |
| 4 | + - label: Create Tasks |
| 5 | + agent: speckit.tasks |
| 6 | + prompt: Break the plan into tasks |
| 7 | + send: true |
| 8 | + - label: Create Checklist |
| 9 | + agent: speckit.checklist |
| 10 | + prompt: Create a checklist for the following domain... |
| 11 | +scripts: |
| 12 | + sh: scripts/bash/setup-plan.sh --json |
| 13 | + ps: scripts/powershell/setup-plan.ps1 -Json |
| 14 | +agent_scripts: |
| 15 | + sh: scripts/bash/update-agent-context.sh __AGENT__ |
| 16 | + ps: scripts/powershell/update-agent-context.ps1 -AgentType __AGENT__ |
| 17 | +--- |
| 18 | + |
| 19 | +## User Input |
| 20 | + |
| 21 | +```text |
| 22 | +$ARGUMENTS |
| 23 | +``` |
| 24 | + |
| 25 | +You **MUST** consider the user input before proceeding (if not empty). |
| 26 | + |
| 27 | +## Pre-Execution Checks |
| 28 | + |
| 29 | +**Check for extension hooks (before planning)**: |
| 30 | +- Check if `.specify/extensions.yml` exists in the project root. |
| 31 | +- If it exists, read it and look for entries under the `hooks.before_plan` key |
| 32 | +- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally |
| 33 | +- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default. |
| 34 | +- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions: |
| 35 | + - If the hook has no `condition` field, or it is null/empty, treat the hook as executable |
| 36 | + - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation |
| 37 | +- For each executable hook, output the following based on its `optional` flag: |
| 38 | + - **Optional hook** (`optional: true`): |
| 39 | + ``` |
| 40 | + ## Extension Hooks |
| 41 | +
|
| 42 | + **Optional Pre-Hook**: {extension} |
| 43 | + Command: `/{command}` |
| 44 | + Description: {description} |
| 45 | +
|
| 46 | + Prompt: {prompt} |
| 47 | + To execute: `/{command}` |
| 48 | + ``` |
| 49 | + - **Mandatory hook** (`optional: false`): |
| 50 | + ``` |
| 51 | + ## Extension Hooks |
| 52 | +
|
| 53 | + **Automatic Pre-Hook**: {extension} |
| 54 | + Executing: `/{command}` |
| 55 | + EXECUTE_COMMAND: {command} |
| 56 | +
|
| 57 | + Wait for the result of the hook command before proceeding to the Outline. |
| 58 | + ``` |
| 59 | +- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently |
| 60 | +
|
| 61 | +## Outline |
| 62 | +
|
| 63 | +1. **Setup**: Run `{SCRIPT}` from repo root and parse JSON for FEATURE_SPEC, IMPL_PLAN, SPECS_DIR, BRANCH. For single quotes in args like "I'm Groot", use escape syntax: e.g 'I'\''m Groot' (or double-quote if possible: "I'm Groot"). |
| 64 | +
|
| 65 | +2. **Load context**: Read FEATURE_SPEC and `/memory/constitution.md`. Load IMPL_PLAN template (already copied). |
| 66 | +
|
| 67 | +3. **Execute plan workflow**: Follow the structure in IMPL_PLAN template to: |
| 68 | + - Include a `## Table of Contents` section immediately after the title and initial metadata lines (Branch, Date, Spec, Input, Note) and before the `## Summary` section. List every `##`-level heading in the final document as a markdown anchor link using GitHub-style anchors (lowercase, spaces to hyphens, strip special characters). Do **not** include a self-referencing entry for `## Table of Contents` itself. Only include headings that actually appear in the final document. |
| 69 | + - Fill Technical Context (mark unknowns as "NEEDS CLARIFICATION") |
| 70 | + - Fill Constitution Check section from constitution |
| 71 | + - Evaluate gates (ERROR if violations unjustified) |
| 72 | + - Phase 0: Generate research.md (resolve all NEEDS CLARIFICATION) |
| 73 | + - Phase 1: Generate data-model.md, contracts/, quickstart.md |
| 74 | + - Phase 1: Update agent context by running the agent script |
| 75 | + - Re-evaluate Constitution Check post-design |
| 76 | +
|
| 77 | +4. **Stop and report**: Command ends after Phase 2 planning. Report branch, IMPL_PLAN path, and generated artifacts. |
| 78 | +
|
| 79 | +5. **Check for extension hooks**: After reporting, check if `.specify/extensions.yml` exists in the project root. |
| 80 | + - If it exists, read it and look for entries under the `hooks.after_plan` key |
| 81 | + - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally |
| 82 | + - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default. |
| 83 | + - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions: |
| 84 | + - If the hook has no `condition` field, or it is null/empty, treat the hook as executable |
| 85 | + - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation |
| 86 | + - For each executable hook, output the following based on its `optional` flag: |
| 87 | + - **Optional hook** (`optional: true`): |
| 88 | + ``` |
| 89 | + ## Extension Hooks |
| 90 | +
|
| 91 | + **Optional Hook**: {extension} |
| 92 | + Command: `/{command}` |
| 93 | + Description: {description} |
| 94 | +
|
| 95 | + Prompt: {prompt} |
| 96 | + To execute: `/{command}` |
| 97 | + ``` |
| 98 | + - **Mandatory hook** (`optional: false`): |
| 99 | + ``` |
| 100 | + ## Extension Hooks |
| 101 | +
|
| 102 | + **Automatic Hook**: {extension} |
| 103 | + Executing: `/{command}` |
| 104 | + EXECUTE_COMMAND: {command} |
| 105 | + ``` |
| 106 | + - If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently |
| 107 | +
|
| 108 | +## Phases |
| 109 | +
|
| 110 | +### Phase 0: Outline & Research |
| 111 | +
|
| 112 | +1. **Extract unknowns from Technical Context** above: |
| 113 | + - For each NEEDS CLARIFICATION → research task |
| 114 | + - For each dependency → best practices task |
| 115 | + - For each integration → patterns task |
| 116 | +
|
| 117 | +2. **Generate and dispatch research agents**: |
| 118 | +
|
| 119 | + ```text |
| 120 | + For each unknown in Technical Context: |
| 121 | + Task: "Research {unknown} for {feature context}" |
| 122 | + For each technology choice: |
| 123 | + Task: "Find best practices for {tech} in {domain}" |
| 124 | + ``` |
| 125 | + |
| 126 | +3. **Consolidate findings** in `research.md` using format: |
| 127 | + - Decision: [what was chosen] |
| 128 | + - Rationale: [why chosen] |
| 129 | + - Alternatives considered: [what else evaluated] |
| 130 | + |
| 131 | +**Output**: research.md with all NEEDS CLARIFICATION resolved |
| 132 | + |
| 133 | +### Phase 1: Design & Contracts |
| 134 | + |
| 135 | +**Prerequisites:** `research.md` complete |
| 136 | + |
| 137 | +1. **Extract entities from feature spec** → `data-model.md`: |
| 138 | + - Entity name, fields, relationships |
| 139 | + - Validation rules from requirements |
| 140 | + - State transitions if applicable |
| 141 | + |
| 142 | +2. **Define interface contracts** (if project has external interfaces) → `/contracts/`: |
| 143 | + - Identify what interfaces the project exposes to users or other systems |
| 144 | + - Document the contract format appropriate for the project type |
| 145 | + - Examples: public APIs for libraries, command schemas for CLI tools, endpoints for web services, grammars for parsers, UI contracts for applications |
| 146 | + - Skip if project is purely internal (build scripts, one-off tools, etc.) |
| 147 | + |
| 148 | +3. **Agent context update**: |
| 149 | + - Run `{AGENT_SCRIPT}` |
| 150 | + - These scripts detect which AI agent is in use |
| 151 | + - Update the appropriate agent-specific context file |
| 152 | + - Add only new technology from current plan |
| 153 | + - Preserve manual additions between markers |
| 154 | + |
| 155 | +**Output**: data-model.md, /contracts/*, quickstart.md, agent-specific file |
| 156 | + |
| 157 | +## Key rules |
| 158 | + |
| 159 | +- Use absolute paths |
| 160 | +- ERROR on gate failures or unresolved clarifications |
0 commit comments