speckit-helper:plan Command Workflow
Codex Adaptation
- Treat the user request or explicitly supplied text as the command arguments.
- Use the available Codex file, search, terminal, and clarification capabilities that match the workflow.
- Do not depend on Claude-only slash command variables or tool names.
/plan — Generate Technical Design & Planning Documents
Transform a specification into actionable technical design documents including
architecture overview, component design, data models, API contracts, and a
quickstart guide.
Step 1: Setup
1.1 Resolve Feature Slug
- If an argument is provided, use it as the
<feature-slug>.
- If no argument is provided:
- Scan
.speckit/*/spec.md for all existing specifications.
- Select the most recently modified
spec.md.
- Extract its parent directory name as the
<feature-slug>.
- If no spec.md files exist anywhere, abort with an error (see Error Handling).
1.2 Read the Specification
- Read
.speckit/<feature-slug>/spec.md.
- If the file does not exist, abort immediately:
"No specification found at .speckit/<feature-slug>/spec.md. Run /speckit-helper:spec <feature-slug> first."
1.3 Read the Constitution (Optional)
- Check if
.speckit/constitution.md exists.
- If it does, read it and store the principles for compliance verification in Step 4.
- If it does not exist, skip constitution checking and note this in the final summary.
1.4 Detect Project Tech Stack
Scan the project root for technology indicator files:
| File |
Stack / Language |
package.json |
Node.js / JavaScript |
tsconfig.json |
TypeScript |
pyproject.toml |
Python |
requirements.txt |
Python |
go.mod |
Go |
Cargo.toml |
Rust |
pom.xml |
Java (Maven) |
build.gradle |
Java / Kotlin (Gradle) |
Gemfile |
Ruby |
composer.json |
PHP |
mix.exs |
Elixir |
*.csproj |
C# / .NET |
- Read detected config files to extract version numbers, dependencies, and framework choices.
- Build a tech stack summary object containing: language, framework, package manager,
test framework, and notable libraries.
- If no tech stack files are found, prompt the user (see Error Handling).
1.5 Identify Existing Project Architecture
Scan for key directories and catalog what exists:
src/, lib/, app/, pkg/, internal/, cmd/
tests/, test/, __tests__/, spec/
docs/, config/, scripts/, migrations/
components/, pages/, routes/, api/, services/
For each directory found:
- List top-level files and subdirectories.
- Note naming conventions (camelCase, kebab-case, snake_case).
- Identify patterns (MVC, hexagonal, feature-based, layer-based).
Store findings as the architectural context for design decisions.
Step 2: Phase 0 — Research (generate research.md)
2.1 Identify Open Questions
- Parse
spec.md for any [Clarification needed] markers.
- For each marker:
- Attempt to resolve it using context from the spec, tech stack, and architecture.
- If resolvable, note the resolution and rationale.
- If not resolvable, flag it as an open question requiring user input.
2.2 Technology Decisions
For each technology decision implied or required by the spec:
- Identify 2-3 viable alternatives.
- For each alternative, evaluate:
- Pros: performance, ecosystem, community support, learning curve.
- Cons: complexity, licensing, maintenance burden, lock-in risk.
- Compatibility: with existing tech stack and architecture.
- Make a recommendation with clear rationale.
- Note any alternatives that were considered but rejected, and why.
2.3 Risk Evaluation
Assess risks across three categories:
- Technical Complexity: areas of the spec that are hard to implement, novel
algorithms, or unfamiliar patterns.
- Third-Party Dependency Risk: external services, APIs, or libraries that
could become unavailable, change, or introduce breaking updates.
- Security Concerns: authentication/authorization requirements, data
sensitivity, input validation needs, known vulnerability patterns.
For each risk, assign a severity (Low / Medium / High) and suggest a mitigation
strategy.
2.4 Write Research Output
Write .speckit/<feature-slug>/research.md with the following structure:
# Research: <Feature Name>
## Open Questions
- [ ] Question 1 — Status: Resolved / Unresolved
- Resolution: ...
## Technology Decisions
### Decision 1: <Topic>
| Alternative | Pros | Cons | Verdict |
|------------|------|------|---------|
| Option A | ... | ... | Chosen |
| Option B | ... | ... | Rejected|
## Risk Assessment
| Risk | Category | Severity | Mitigation |
|------|----------|----------|------------|
| ... | ... | ... | ... |
Step 3: Phase 1 — Design (generate plan.md and supporting docs)
3.1 Architecture Overview
- Define the high-level system components and their responsibilities.
- Describe interactions between components (data flow, control flow).
- Create a component diagram in text/ASCII or Mermaid format.
- Map components to the existing directory structure (or propose new directories).
3.2 Component Design
For each major component identified in the architecture:
- Interface: public API surface (functions, methods, events, hooks).
- Implementation approach: algorithms, patterns, data structures.
- Dependencies: other components, external libraries, services.
- Error handling: failure modes and recovery strategies.
- Testing strategy: unit test scope, mocks needed, edge cases.
3.3 Data Model (conditional)
If the feature involves data storage, persistence, or entity management:
- Generate
.speckit/<feature-slug>/data-model.md containing:
- Entity definitions with attributes and types.
- Relationships between entities (one-to-one, one-to-many, many-to-many).
- Indexes and constraints.
- Migration strategy (if modifying existing data).
- Example data for illustration.
3.4 API Contracts (conditional)
If the feature involves HTTP APIs, RPCs, or inter-service communication:
- For each endpoint group, generate
.speckit/<feature-slug>/contracts/<endpoint-group>.md:
- Endpoint definition: method, path, description.
- Request schema: headers, query params, body (with types and validation rules).
- Response schema: success body, status codes.
- Error codes: code, HTTP status, message, resolution.
- Example request/response pairs.
- Rate limiting or throttling notes (if applicable).
3.5 Quickstart Guide
Generate .speckit/<feature-slug>/quickstart.md containing:
- Prerequisites (runtime versions, tools, accounts).
- Setup steps (install dependencies, configure environment, seed data).
- Integration guide (how this feature connects to the existing codebase).
- Verification steps (how to confirm the feature works after setup).
3.6 Write Plan Output
Write .speckit/<feature-slug>/plan.md with the full design:
# Technical Plan: <Feature Name>
## Tech Stack
- Language: ...
- Framework: ...
## Architecture Overview
...
## Component Design
### Component 1: <Name>
- Responsibility: ...
- Interface: ...
- Implementation: ...
## Directory Structure
...
## Implementation Notes
...
## Open Items
...
Step 4: Constitution Check
4.1 Verify Compliance
If constitution.md was loaded in Step 1.3:
- For each principle defined in the constitution:
- Check whether the plan adheres to it.
- Note compliance status: PASS, WARN, or FAIL.
- Compile results into a compliance table.
4.2 Flag Violations
- For any principle with status WARN or FAIL:
- Describe the specific conflict between the plan and the principle.
- Suggest a modification to bring the plan into compliance.
- If compliance is impossible without changing the spec, flag it clearly.
4.3 Append to Plan
Add a "Constitution Compliance" section at the end of plan.md:
## Constitution Compliance
| Principle | Status | Notes |
|-----------|--------|-------|
| ... | PASS | ... |
Step 5: Summary
5.1 Print Generated Files
List every file created or updated during this command:
Generated files:
.speckit/<feature-slug>/research.md — Technology research and risk assessment
.speckit/<feature-slug>/plan.md — Full technical design document
.speckit/<feature-slug>/data-model.md — Entity definitions and relationships (if applicable)
.speckit/<feature-slug>/contracts/ — API endpoint contracts (if applicable)
.speckit/<feature-slug>/quickstart.md — Setup and integration guide
5.2 Suggest Next Step
Print the following:
Next step: Run /speckit-helper:tasks <feature-slug> to decompose this plan
into executable, dependency-ordered tasks.
Error Handling
spec.md Not Found
If .speckit/<feature-slug>/spec.md does not exist:
- Print: "Specification not found at
.speckit/<feature-slug>/spec.md."
- Suggest: "Run
/speckit-helper:spec <feature-slug> to create a specification first."
- Abort the command.
No Tech Stack Detected
If no technology indicator files are found in the project root:
- Print: "Could not detect project tech stack automatically."
- Ask the user: "Please specify your primary language and framework (e.g., TypeScript + Next.js, Python + FastAPI)."
- Wait for user input before proceeding.
Conflicting Constitution Principles
If two or more constitution principles conflict with each other in the context
of the current plan:
- Flag both principles and describe the conflict.
- Ask the user to clarify which principle takes precedence.
- Document the resolution in
plan.md under the Constitution Compliance section.
1---2name: plan-command3description: Run the `speckit-helper:plan` workflow from the original Claude slash command. Use when the user asks to generate technical design and planning documents from specification4---56<!-- Generated by tools/generate-agent-marketplaces.py; edit the source command or agent-plugin.yaml instead. -->78# speckit-helper:plan Command Workflow910## Codex Adaptation1112- Treat the user request or explicitly supplied text as the command arguments.13- Use the available Codex file, search, terminal, and clarification capabilities that match the workflow.14- Do not depend on Claude-only slash command variables or tool names.1516# /plan — Generate Technical Design & Planning Documents1718Transform a specification into actionable technical design documents including19architecture overview, component design, data models, API contracts, and a20quickstart guide.2122---2324## Step 1: Setup2526### 1.1 Resolve Feature Slug2728- If an argument is provided, use it as the `<feature-slug>`.29- If no argument is provided:30 - Scan `.speckit/*/spec.md` for all existing specifications.31 - Select the most recently modified `spec.md`.32 - Extract its parent directory name as the `<feature-slug>`.33 - If no spec.md files exist anywhere, abort with an error (see Error Handling).3435### 1.2 Read the Specification3637- Read `.speckit/<feature-slug>/spec.md`.38- If the file does not exist, abort immediately:39 > "No specification found at `.speckit/<feature-slug>/spec.md`. Run `/speckit-helper:spec <feature-slug>` first."4041### 1.3 Read the Constitution (Optional)4243- Check if `.speckit/constitution.md` exists.44- If it does, read it and store the principles for compliance verification in Step 4.45- If it does not exist, skip constitution checking and note this in the final summary.4647### 1.4 Detect Project Tech Stack4849Scan the project root for technology indicator files:5051| File | Stack / Language |52|---------------------|------------------------|53| `package.json` | Node.js / JavaScript |54| `tsconfig.json` | TypeScript |55| `pyproject.toml` | Python |56| `requirements.txt` | Python |57| `go.mod` | Go |58| `Cargo.toml` | Rust |59| `pom.xml` | Java (Maven) |60| `build.gradle` | Java / Kotlin (Gradle) |61| `Gemfile` | Ruby |62| `composer.json` | PHP |63| `mix.exs` | Elixir |64| `*.csproj` | C# / .NET |6566- Read detected config files to extract version numbers, dependencies, and framework choices.67- Build a tech stack summary object containing: language, framework, package manager,68 test framework, and notable libraries.69- If no tech stack files are found, prompt the user (see Error Handling).7071### 1.5 Identify Existing Project Architecture7273Scan for key directories and catalog what exists:7475- `src/`, `lib/`, `app/`, `pkg/`, `internal/`, `cmd/`76- `tests/`, `test/`, `__tests__/`, `spec/`77- `docs/`, `config/`, `scripts/`, `migrations/`78- `components/`, `pages/`, `routes/`, `api/`, `services/`7980For each directory found:81- List top-level files and subdirectories.82- Note naming conventions (camelCase, kebab-case, snake_case).83- Identify patterns (MVC, hexagonal, feature-based, layer-based).8485Store findings as the architectural context for design decisions.8687---8889## Step 2: Phase 0 — Research (generate `research.md`)9091### 2.1 Identify Open Questions9293- Parse `spec.md` for any `[Clarification needed]` markers.94- For each marker:95 - Attempt to resolve it using context from the spec, tech stack, and architecture.96 - If resolvable, note the resolution and rationale.97 - If not resolvable, flag it as an open question requiring user input.9899### 2.2 Technology Decisions100101For each technology decision implied or required by the spec:102103- Identify 2-3 viable alternatives.104- For each alternative, evaluate:105 - **Pros**: performance, ecosystem, community support, learning curve.106 - **Cons**: complexity, licensing, maintenance burden, lock-in risk.107 - **Compatibility**: with existing tech stack and architecture.108- Make a recommendation with clear rationale.109- Note any alternatives that were considered but rejected, and why.110111### 2.3 Risk Evaluation112113Assess risks across three categories:1141151. **Technical Complexity**: areas of the spec that are hard to implement, novel116 algorithms, or unfamiliar patterns.1172. **Third-Party Dependency Risk**: external services, APIs, or libraries that118 could become unavailable, change, or introduce breaking updates.1193. **Security Concerns**: authentication/authorization requirements, data120 sensitivity, input validation needs, known vulnerability patterns.121122For each risk, assign a severity (Low / Medium / High) and suggest a mitigation123strategy.124125### 2.4 Write Research Output126127Write `.speckit/<feature-slug>/research.md` with the following structure:128129```markdown130# Research: <Feature Name>131132## Open Questions133- [ ] Question 1 — Status: Resolved / Unresolved134 - Resolution: ...135136## Technology Decisions137### Decision 1: <Topic>138| Alternative | Pros | Cons | Verdict |139|------------|------|------|---------|140| Option A | ... | ... | Chosen |141| Option B | ... | ... | Rejected|142143## Risk Assessment144| Risk | Category | Severity | Mitigation |145|------|----------|----------|------------|146| ... | ... | ... | ... |147```148149---150151## Step 3: Phase 1 — Design (generate `plan.md` and supporting docs)152153### 3.1 Architecture Overview154155- Define the high-level system components and their responsibilities.156- Describe interactions between components (data flow, control flow).157- Create a component diagram in text/ASCII or Mermaid format.158- Map components to the existing directory structure (or propose new directories).159160### 3.2 Component Design161162For each major component identified in the architecture:163164- **Interface**: public API surface (functions, methods, events, hooks).165- **Implementation approach**: algorithms, patterns, data structures.166- **Dependencies**: other components, external libraries, services.167- **Error handling**: failure modes and recovery strategies.168- **Testing strategy**: unit test scope, mocks needed, edge cases.169170### 3.3 Data Model (conditional)171172If the feature involves data storage, persistence, or entity management:173174- Generate `.speckit/<feature-slug>/data-model.md` containing:175 - Entity definitions with attributes and types.176 - Relationships between entities (one-to-one, one-to-many, many-to-many).177 - Indexes and constraints.178 - Migration strategy (if modifying existing data).179 - Example data for illustration.180181### 3.4 API Contracts (conditional)182183If the feature involves HTTP APIs, RPCs, or inter-service communication:184185- For each endpoint group, generate `.speckit/<feature-slug>/contracts/<endpoint-group>.md`:186 - Endpoint definition: method, path, description.187 - Request schema: headers, query params, body (with types and validation rules).188 - Response schema: success body, status codes.189 - Error codes: code, HTTP status, message, resolution.190 - Example request/response pairs.191 - Rate limiting or throttling notes (if applicable).192193### 3.5 Quickstart Guide194195Generate `.speckit/<feature-slug>/quickstart.md` containing:196197- Prerequisites (runtime versions, tools, accounts).198- Setup steps (install dependencies, configure environment, seed data).199- Integration guide (how this feature connects to the existing codebase).200- Verification steps (how to confirm the feature works after setup).201202### 3.6 Write Plan Output203204Write `.speckit/<feature-slug>/plan.md` with the full design:205206```markdown207# Technical Plan: <Feature Name>208209## Tech Stack210- Language: ...211- Framework: ...212213## Architecture Overview214...215216## Component Design217### Component 1: <Name>218- Responsibility: ...219- Interface: ...220- Implementation: ...221222## Directory Structure223...224225## Implementation Notes226...227228## Open Items229...230```231232---233234## Step 4: Constitution Check235236### 4.1 Verify Compliance237238If `constitution.md` was loaded in Step 1.3:239240- For each principle defined in the constitution:241 - Check whether the plan adheres to it.242 - Note compliance status: PASS, WARN, or FAIL.243- Compile results into a compliance table.244245### 4.2 Flag Violations246247- For any principle with status WARN or FAIL:248 - Describe the specific conflict between the plan and the principle.249 - Suggest a modification to bring the plan into compliance.250 - If compliance is impossible without changing the spec, flag it clearly.251252### 4.3 Append to Plan253254Add a "Constitution Compliance" section at the end of `plan.md`:255256```markdown257## Constitution Compliance258| Principle | Status | Notes |259|-----------|--------|-------|260| ... | PASS | ... |261```262263---264265## Step 5: Summary266267### 5.1 Print Generated Files268269List every file created or updated during this command:270271```272Generated files:273 .speckit/<feature-slug>/research.md — Technology research and risk assessment274 .speckit/<feature-slug>/plan.md — Full technical design document275 .speckit/<feature-slug>/data-model.md — Entity definitions and relationships (if applicable)276 .speckit/<feature-slug>/contracts/ — API endpoint contracts (if applicable)277 .speckit/<feature-slug>/quickstart.md — Setup and integration guide278```279280### 5.2 Suggest Next Step281282Print the following:283284> Next step: Run `/speckit-helper:tasks <feature-slug>` to decompose this plan285> into executable, dependency-ordered tasks.286287---288289## Error Handling290291### spec.md Not Found292293If `.speckit/<feature-slug>/spec.md` does not exist:294- Print: "Specification not found at `.speckit/<feature-slug>/spec.md`."295- Suggest: "Run `/speckit-helper:spec <feature-slug>` to create a specification first."296- Abort the command.297298### No Tech Stack Detected299300If no technology indicator files are found in the project root:301- Print: "Could not detect project tech stack automatically."302- Ask the user: "Please specify your primary language and framework (e.g., TypeScript + Next.js, Python + FastAPI)."303- Wait for user input before proceeding.304305### Conflicting Constitution Principles306307If two or more constitution principles conflict with each other in the context308of the current plan:309- Flag both principles and describe the conflict.310- Ask the user to clarify which principle takes precedence.311- Document the resolution in `plan.md` under the Constitution Compliance section.