speckit-helper:analyze 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.
/speckit-helper:analyze
Perform a comprehensive read-only consistency analysis across all specification documents
for a given feature.
IMPORTANT: Read-Only Constraint
This command MUST NEVER modify any files. Only the Read, Glob, and Grep tools are
permitted. All findings are reported for human review. If changes are needed, suggest
the appropriate command (/speckit-helper:refine, /speckit-helper:tasks, etc.).
Workflow
Step 1: Resolve Feature Slug
Determine the feature-slug from the user request or explicit arguments.
- If
the user request or explicit arguments is non-empty, use the first positional argument as the feature-slug.
- If
the user request or explicit arguments is empty, use Glob to list directories under .speckit/:
- If exactly one feature directory exists, use it automatically.
- If multiple exist, list them and ask the user to choose:
"Multiple features found. Please specify a feature slug: [list]"
- If none exist, stop with:
"No specifications found. Run /speckit-helper:specify first to create one."
Step 2: Gather All Documents
Read every document in the feature's specification directory. Use Glob to discover files
and Read to load their contents.
Required documents:
.speckit/<feature-slug>/spec.md -- core specification (required; abort if missing)
.speckit/<feature-slug>/plan.md -- implementation plan (optional)
.speckit/<feature-slug>/tasks.md -- task list (optional)
.speckit/<feature-slug>/data-model.md -- entity definitions (optional)
Optional documents:
.speckit/<feature-slug>/contracts/*.md -- API contracts (zero or more)
.speckit/<feature-slug>/checklists/*.md -- quality checklists (zero or more)
Project-level documents:
.speckit/constitution.md -- project-level principles (optional)
For each document, note whether it was found or missing. Missing optional documents are
not errors but limit the scope of analysis. Record which documents were analyzed for the
report header.
Step 3: Run Analysis Checks
Execute all eight analysis checks against the gathered documents. Reference the skill at
skills/consistency-analysis/ for detailed rule definitions.
Check 1: Requirement Coverage
For each FR-XXX and NFR-XXX identifier found in spec.md:
- Use Grep to search
tasks.md for any reference to that requirement ID or its parent
section [Spec §X.Y].
- If no matching task exists, record a finding:
- CRITICAL if the requirement is P1 priority
- HIGH if the requirement is P2 priority
- MEDIUM if the requirement is P3 priority or no priority is stated
- If
tasks.md does not exist, record a single CRITICAL finding:
"No tasks.md found -- requirement coverage cannot be verified."
Check 2: Task Traceability
For each task line in tasks.md that contains a [Spec §X.Y] reference:
- Parse the section reference (e.g.,
§3.1 maps to section 3, subsection 1).
- Read the corresponding section in
spec.md.
- If the section does not exist, record a MEDIUM finding:
"T{ID} references [Spec §X.Y] but that section does not exist in spec.md."
- If the section exists but contains no relevant requirement, record a LOW finding:
"T{ID} references [Spec §X.Y] but the section content does not clearly relate to the task."
Check 3: Plan Alignment
If plan.md exists, compare its architectural decisions against tasks.md:
- Extract directory structure patterns from
plan.md (e.g., src/repositories/).
- Extract design patterns mentioned (e.g., "repository pattern", "middleware chain").
- For each pattern or path, search
tasks.md for tasks that create or modify files
in the expected locations.
- If a plan element has no corresponding task, record a HIGH finding:
"plan.md specifies '{element}' but no task in tasks.md implements it."
- If
plan.md does not exist, skip this check silently.
Check 4: Data Model Consistency
If data-model.md exists:
- Extract all entity names from
data-model.md.
- For each entity, search
tasks.md for a task that creates the corresponding model file.
- Check that entity attributes mentioned in
data-model.md are consistent with those
referenced in spec.md and contracts/*.md.
- If an entity has no creation task, record a MEDIUM finding:
"Entity '{name}' defined in data-model.md has no creation task in tasks.md."
- If
data-model.md does not exist, skip this check silently.
Check 5: Contract Coverage
If any contracts/*.md files exist:
- Extract all API endpoints (method + path) from each contract file.
- For each endpoint, search
tasks.md for a task that implements that endpoint.
- Also check that request/response schemas reference entities defined in
data-model.md.
- If an endpoint has no implementation task, record a HIGH finding:
"Endpoint '{METHOD} {path}' defined in contracts/{file} has no implementation task."
- If no contract files exist, skip this check silently.
Check 6: Constitution Compliance
If .speckit/constitution.md exists:
- Read the constitution and extract key principles, constraints, and quality thresholds.
- For each principle, check whether
plan.md and tasks.md comply:
- If the constitution mandates test coverage thresholds, count test-related tasks.
- If it mandates specific patterns, check plan alignment.
- If it mandates technology constraints, check spec and plan references.
- Record findings at the appropriate severity:
- CRITICAL if a core principle is violated by the plan architecture
- HIGH if a quality threshold is unlikely to be met based on task composition
- MEDIUM if a soft guideline is not reflected
- If no constitution exists, skip this check silently.
Check 7: Duplication Detection
Scan spec.md for semantically overlapping requirements:
- Compare each pair of FR-XXX descriptions for similar intent.
- Compare FR requirements against NFR requirements for overlap
(e.g., "hash passwords with bcrypt" in FR vs. "passwords must be encrypted" in NFR).
- Look for identical or near-identical acceptance criteria across different requirements.
- Record LOW findings for each detected duplication:
"FR-{X} and {NFR/FR}-{Y} appear to overlap -- consider consolidating."
Check 8: Ambiguity Detection
Scan all requirement text in spec.md for vague or unmeasurable language:
- Search for these ambiguous terms: "should", "might", "could", "may", "ideally",
"approximately", "etc.", "as needed", "as appropriate", "reasonable", "adequate",
"user-friendly", "fast", "efficient", "scalable".
- For each match, record a finding with the specific location:
- HIGH if the ambiguous term appears in a P1 requirement
- MEDIUM if it appears in a P2/P3 requirement
- LOW if it appears in assumptions or open questions sections
Step 4: Classify and Aggregate Findings
After all checks complete:
- Assign each finding a unique ID based on its check category:
- RC-001, RC-002, ... (Requirement Coverage)
- TT-001, TT-002, ... (Task Traceability)
- PA-001, PA-002, ... (Plan Alignment)
- DM-001, DM-002, ... (Data Model Consistency)
- CC-001, CC-002, ... (Contract Coverage)
- CP-001, CP-002, ... (Constitution Compliance)
- DD-001, DD-002, ... (Duplication Detection)
- AM-001, AM-002, ... (Ambiguity Detection)
- Count findings by severity: CRITICAL, HIGH, MEDIUM, LOW.
- Sort findings within each severity group by check category.
Step 5: Generate Report
Output the analysis report directly to the terminal (do NOT write it to a file).
## Consistency Analysis Report
**Feature:** <feature-slug>
**Date:** <current date>
**Documents Analyzed:** <comma-separated list of files found and read>
---
### Summary
| Severity | Count |
|----------|-------|
| CRITICAL | X |
| HIGH | Y |
| MEDIUM | Z |
| LOW | W |
| **Total**| **N** |
---
### Findings
#### CRITICAL
- **[RC-001]** FR-003 "rate limiting on login" has no corresponding task in tasks.md
*Category: Requirement Coverage | Location: spec.md §3.3*
#### HIGH
- **[PA-001]** plan.md specifies "src/repositories/" pattern but no task creates files
in that directory
*Category: Plan Alignment | Location: plan.md §Architecture*
#### MEDIUM
...
#### LOW
...
---
### Recommendations
1. <Actionable recommendation for each CRITICAL finding>
2. <Actionable recommendation for each HIGH finding>
3. <General recommendation for MEDIUM/LOW findings>
Step 6: Suggest Next Steps
Based on the findings, suggest the most appropriate next command:
Error Handling
spec.md Not Found
If .speckit/<feature-slug>/spec.md does not exist:
- Print: "Cannot analyze: spec.md not found at
.speckit/<feature-slug>/spec.md.
Run /speckit-helper:specify first."
- Abort the analysis. Do not attempt partial analysis without the core spec.
Feature Directory Not Found
If .speckit/<feature-slug>/ does not exist:
- Print: "Feature directory
.speckit/<feature-slug>/ not found. Available features: [list]"
- If no features exist at all: "No specifications found. Run
/speckit-helper:specify first."
Empty Documents
If a document exists but is empty or contains only whitespace:
- Record a HIGH finding: "{document} exists but is empty -- cannot analyze."
- Continue with remaining documents.
Notes
- This command is intentionally read-only. It inspects and reports but never changes files.
- The analysis depth is limited by which documents exist. A minimal analysis (spec.md only)
can still produce useful ambiguity and completeness findings.
- For best results, run this command after
/speckit-helper:tasks has generated a task list,
so that requirement coverage and task traceability checks can execute fully.
- Findings are printed to the terminal, not saved to a file. If the user wants to persist
the report, they should redirect output or copy it manually.
- Re-run this command after
/speckit-helper:refine to verify that findings were resolved.
1---2name: analyze-command3description: Run the `speckit-helper:analyze` workflow from the original Claude slash command. Use when the user asks to analyze specifications for consistency, gaps, and quality issues (read-only)4---56<!-- Generated by tools/generate-agent-marketplaces.py; edit the source command or agent-plugin.yaml instead. -->78# speckit-helper:analyze 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# /speckit-helper:analyze1718Perform a comprehensive read-only consistency analysis across all specification documents19for a given feature.2021---2223## IMPORTANT: Read-Only Constraint2425This command MUST NEVER modify any files. Only the Read, Glob, and Grep tools are26permitted. All findings are reported for human review. If changes are needed, suggest27the appropriate command (`/speckit-helper:refine`, `/speckit-helper:tasks`, etc.).2829---3031## Workflow3233### Step 1: Resolve Feature Slug3435Determine the feature-slug from `the user request or explicit arguments`.3637- If `the user request or explicit arguments` is non-empty, use the first positional argument as the feature-slug.38- If `the user request or explicit arguments` is empty, use Glob to list directories under `.speckit/`:39 - If exactly one feature directory exists, use it automatically.40 - If multiple exist, list them and ask the user to choose:41 > "Multiple features found. Please specify a feature slug: [list]"42 - If none exist, stop with:43 > "No specifications found. Run `/speckit-helper:specify` first to create one."4445### Step 2: Gather All Documents4647Read every document in the feature's specification directory. Use Glob to discover files48and Read to load their contents.4950**Required documents:**51- `.speckit/<feature-slug>/spec.md` -- core specification (required; abort if missing)52- `.speckit/<feature-slug>/plan.md` -- implementation plan (optional)53- `.speckit/<feature-slug>/tasks.md` -- task list (optional)54- `.speckit/<feature-slug>/data-model.md` -- entity definitions (optional)5556**Optional documents:**57- `.speckit/<feature-slug>/contracts/*.md` -- API contracts (zero or more)58- `.speckit/<feature-slug>/checklists/*.md` -- quality checklists (zero or more)5960**Project-level documents:**61- `.speckit/constitution.md` -- project-level principles (optional)6263For each document, note whether it was found or missing. Missing optional documents are64not errors but limit the scope of analysis. Record which documents were analyzed for the65report header.6667### Step 3: Run Analysis Checks6869Execute all eight analysis checks against the gathered documents. Reference the skill at70`skills/consistency-analysis/` for detailed rule definitions.7172#### Check 1: Requirement Coverage7374For each `FR-XXX` and `NFR-XXX` identifier found in `spec.md`:75761. Use Grep to search `tasks.md` for any reference to that requirement ID or its parent77 section `[Spec §X.Y]`.782. If no matching task exists, record a finding:79 - CRITICAL if the requirement is P1 priority80 - HIGH if the requirement is P2 priority81 - MEDIUM if the requirement is P3 priority or no priority is stated823. If `tasks.md` does not exist, record a single CRITICAL finding:83 "No tasks.md found -- requirement coverage cannot be verified."8485#### Check 2: Task Traceability8687For each task line in `tasks.md` that contains a `[Spec §X.Y]` reference:88891. Parse the section reference (e.g., `§3.1` maps to section 3, subsection 1).902. Read the corresponding section in `spec.md`.913. If the section does not exist, record a MEDIUM finding:92 "T{ID} references [Spec §X.Y] but that section does not exist in spec.md."934. If the section exists but contains no relevant requirement, record a LOW finding:94 "T{ID} references [Spec §X.Y] but the section content does not clearly relate to the task."9596#### Check 3: Plan Alignment9798If `plan.md` exists, compare its architectural decisions against `tasks.md`:991001. Extract directory structure patterns from `plan.md` (e.g., `src/repositories/`).1012. Extract design patterns mentioned (e.g., "repository pattern", "middleware chain").1023. For each pattern or path, search `tasks.md` for tasks that create or modify files103 in the expected locations.1044. If a plan element has no corresponding task, record a HIGH finding:105 "plan.md specifies '{element}' but no task in tasks.md implements it."1065. If `plan.md` does not exist, skip this check silently.107108#### Check 4: Data Model Consistency109110If `data-model.md` exists:1111121. Extract all entity names from `data-model.md`.1132. For each entity, search `tasks.md` for a task that creates the corresponding model file.1143. Check that entity attributes mentioned in `data-model.md` are consistent with those115 referenced in `spec.md` and `contracts/*.md`.1164. If an entity has no creation task, record a MEDIUM finding:117 "Entity '{name}' defined in data-model.md has no creation task in tasks.md."1185. If `data-model.md` does not exist, skip this check silently.119120#### Check 5: Contract Coverage121122If any `contracts/*.md` files exist:1231241. Extract all API endpoints (method + path) from each contract file.1252. For each endpoint, search `tasks.md` for a task that implements that endpoint.1263. Also check that request/response schemas reference entities defined in `data-model.md`.1274. If an endpoint has no implementation task, record a HIGH finding:128 "Endpoint '{METHOD} {path}' defined in contracts/{file} has no implementation task."1295. If no contract files exist, skip this check silently.130131#### Check 6: Constitution Compliance132133If `.speckit/constitution.md` exists:1341351. Read the constitution and extract key principles, constraints, and quality thresholds.1362. For each principle, check whether `plan.md` and `tasks.md` comply:137 - If the constitution mandates test coverage thresholds, count test-related tasks.138 - If it mandates specific patterns, check plan alignment.139 - If it mandates technology constraints, check spec and plan references.1403. Record findings at the appropriate severity:141 - CRITICAL if a core principle is violated by the plan architecture142 - HIGH if a quality threshold is unlikely to be met based on task composition143 - MEDIUM if a soft guideline is not reflected1444. If no constitution exists, skip this check silently.145146#### Check 7: Duplication Detection147148Scan `spec.md` for semantically overlapping requirements:1491501. Compare each pair of FR-XXX descriptions for similar intent.1512. Compare FR requirements against NFR requirements for overlap152 (e.g., "hash passwords with bcrypt" in FR vs. "passwords must be encrypted" in NFR).1533. Look for identical or near-identical acceptance criteria across different requirements.1544. Record LOW findings for each detected duplication:155 "FR-{X} and {NFR/FR}-{Y} appear to overlap -- consider consolidating."156157#### Check 8: Ambiguity Detection158159Scan all requirement text in `spec.md` for vague or unmeasurable language:1601611. Search for these ambiguous terms: "should", "might", "could", "may", "ideally",162 "approximately", "etc.", "as needed", "as appropriate", "reasonable", "adequate",163 "user-friendly", "fast", "efficient", "scalable".1642. For each match, record a finding with the specific location:165 - HIGH if the ambiguous term appears in a P1 requirement166 - MEDIUM if it appears in a P2/P3 requirement167 - LOW if it appears in assumptions or open questions sections168169### Step 4: Classify and Aggregate Findings170171After all checks complete:1721731. Assign each finding a unique ID based on its check category:174 - RC-001, RC-002, ... (Requirement Coverage)175 - TT-001, TT-002, ... (Task Traceability)176 - PA-001, PA-002, ... (Plan Alignment)177 - DM-001, DM-002, ... (Data Model Consistency)178 - CC-001, CC-002, ... (Contract Coverage)179 - CP-001, CP-002, ... (Constitution Compliance)180 - DD-001, DD-002, ... (Duplication Detection)181 - AM-001, AM-002, ... (Ambiguity Detection)1822. Count findings by severity: CRITICAL, HIGH, MEDIUM, LOW.1833. Sort findings within each severity group by check category.184185### Step 5: Generate Report186187Output the analysis report directly to the terminal (do NOT write it to a file).188189```190## Consistency Analysis Report191192**Feature:** <feature-slug>193**Date:** <current date>194**Documents Analyzed:** <comma-separated list of files found and read>195196---197198### Summary199200| Severity | Count |201|----------|-------|202| CRITICAL | X |203| HIGH | Y |204| MEDIUM | Z |205| LOW | W |206| **Total**| **N** |207208---209210### Findings211212#### CRITICAL213- **[RC-001]** FR-003 "rate limiting on login" has no corresponding task in tasks.md214 *Category: Requirement Coverage | Location: spec.md §3.3*215216#### HIGH217- **[PA-001]** plan.md specifies "src/repositories/" pattern but no task creates files218 in that directory219 *Category: Plan Alignment | Location: plan.md §Architecture*220221#### MEDIUM222...223224#### LOW225...226227---228229### Recommendations2302311. <Actionable recommendation for each CRITICAL finding>2322. <Actionable recommendation for each HIGH finding>2333. <General recommendation for MEDIUM/LOW findings>234```235236### Step 6: Suggest Next Steps237238Based on the findings, suggest the most appropriate next command:239240- If CRITICAL or HIGH findings exist:241 > "Run `/speckit-helper:refine <feature-slug>` to address critical and high-severity242 > findings before proceeding to implementation."243244- If only MEDIUM or LOW findings exist:245 > "Specification is in good shape. Consider running `/speckit-helper:implement <feature-slug>`246 > to begin implementation, or address medium/low findings with `/speckit-helper:refine`."247248- If zero findings:249 > "Specification is fully consistent across all documents. Ready for implementation250 > with `/speckit-helper:implement <feature-slug>`."251252---253254## Error Handling255256### spec.md Not Found257258If `.speckit/<feature-slug>/spec.md` does not exist:259- Print: "Cannot analyze: spec.md not found at `.speckit/<feature-slug>/spec.md`.260 Run `/speckit-helper:specify` first."261- Abort the analysis. Do not attempt partial analysis without the core spec.262263### Feature Directory Not Found264265If `.speckit/<feature-slug>/` does not exist:266- Print: "Feature directory `.speckit/<feature-slug>/` not found. Available features: [list]"267- If no features exist at all: "No specifications found. Run `/speckit-helper:specify` first."268269### Empty Documents270271If a document exists but is empty or contains only whitespace:272- Record a HIGH finding: "{document} exists but is empty -- cannot analyze."273- Continue with remaining documents.274275---276277## Notes278279- This command is intentionally read-only. It inspects and reports but never changes files.280- The analysis depth is limited by which documents exist. A minimal analysis (spec.md only)281 can still produce useful ambiguity and completeness findings.282- For best results, run this command after `/speckit-helper:tasks` has generated a task list,283 so that requirement coverage and task traceability checks can execute fully.284- Findings are printed to the terminal, not saved to a file. If the user wants to persist285 the report, they should redirect output or copy it manually.286- Re-run this command after `/speckit-helper:refine` to verify that findings were resolved.