Skip to content

Commit 5229d07

Browse files
authored
Merge pull request #16 from ozankasikci/001-if-the-the
fix branch selection
2 parents 497d04f + 08cd6b9 commit 5229d07

24 files changed

+3347
-21
lines changed
Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
---
2+
description: Perform a non-destructive cross-artifact consistency and quality analysis across spec.md, plan.md, and tasks.md after task generation.
3+
---
4+
5+
## User Input
6+
7+
```text
8+
$ARGUMENTS
9+
```
10+
11+
You **MUST** consider the user input before proceeding (if not empty).
12+
13+
## Goal
14+
15+
Identify inconsistencies, duplications, ambiguities, and underspecified items across the three core artifacts (`spec.md`, `plan.md`, `tasks.md`) before implementation. This command MUST run only after `/tasks` has successfully produced a complete `tasks.md`.
16+
17+
## Operating Constraints
18+
19+
**STRICTLY READ-ONLY**: Do **not** modify any files. Output a structured analysis report. Offer an optional remediation plan (user must explicitly approve before any follow-up editing commands would be invoked manually).
20+
21+
**Constitution Authority**: The project constitution (`.specify/memory/constitution.md`) is **non-negotiable** within this analysis scope. Constitution conflicts are automatically CRITICAL and require adjustment of the spec, plan, or tasks—not dilution, reinterpretation, or silent ignoring of the principle. If a principle itself needs to change, that must occur in a separate, explicit constitution update outside `/analyze`.
22+
23+
## Execution Steps
24+
25+
### 1. Initialize Analysis Context
26+
27+
Run `.specify/scripts/bash/check-prerequisites.sh --json --require-tasks --include-tasks` once from repo root and parse JSON for FEATURE_DIR and AVAILABLE_DOCS. Derive absolute paths:
28+
29+
- SPEC = FEATURE_DIR/spec.md
30+
- PLAN = FEATURE_DIR/plan.md
31+
- TASKS = FEATURE_DIR/tasks.md
32+
33+
Abort with an error message if any required file is missing (instruct the user to run missing prerequisite command).
34+
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").
35+
36+
### 2. Load Artifacts (Progressive Disclosure)
37+
38+
Load only the minimal necessary context from each artifact:
39+
40+
**From spec.md:**
41+
42+
- Overview/Context
43+
- Functional Requirements
44+
- Non-Functional Requirements
45+
- User Stories
46+
- Edge Cases (if present)
47+
48+
**From plan.md:**
49+
50+
- Architecture/stack choices
51+
- Data Model references
52+
- Phases
53+
- Technical constraints
54+
55+
**From tasks.md:**
56+
57+
- Task IDs
58+
- Descriptions
59+
- Phase grouping
60+
- Parallel markers [P]
61+
- Referenced file paths
62+
63+
**From constitution:**
64+
65+
- Load `.specify/memory/constitution.md` for principle validation
66+
67+
### 3. Build Semantic Models
68+
69+
Create internal representations (do not include raw artifacts in output):
70+
71+
- **Requirements inventory**: Each functional + non-functional requirement with a stable key (derive slug based on imperative phrase; e.g., "User can upload file" → `user-can-upload-file`)
72+
- **User story/action inventory**: Discrete user actions with acceptance criteria
73+
- **Task coverage mapping**: Map each task to one or more requirements or stories (inference by keyword / explicit reference patterns like IDs or key phrases)
74+
- **Constitution rule set**: Extract principle names and MUST/SHOULD normative statements
75+
76+
### 4. Detection Passes (Token-Efficient Analysis)
77+
78+
Focus on high-signal findings. Limit to 50 findings total; aggregate remainder in overflow summary.
79+
80+
#### A. Duplication Detection
81+
82+
- Identify near-duplicate requirements
83+
- Mark lower-quality phrasing for consolidation
84+
85+
#### B. Ambiguity Detection
86+
87+
- Flag vague adjectives (fast, scalable, secure, intuitive, robust) lacking measurable criteria
88+
- Flag unresolved placeholders (TODO, TKTK, ???, `<placeholder>`, etc.)
89+
90+
#### C. Underspecification
91+
92+
- Requirements with verbs but missing object or measurable outcome
93+
- User stories missing acceptance criteria alignment
94+
- Tasks referencing files or components not defined in spec/plan
95+
96+
#### D. Constitution Alignment
97+
98+
- Any requirement or plan element conflicting with a MUST principle
99+
- Missing mandated sections or quality gates from constitution
100+
101+
#### E. Coverage Gaps
102+
103+
- Requirements with zero associated tasks
104+
- Tasks with no mapped requirement/story
105+
- Non-functional requirements not reflected in tasks (e.g., performance, security)
106+
107+
#### F. Inconsistency
108+
109+
- Terminology drift (same concept named differently across files)
110+
- Data entities referenced in plan but absent in spec (or vice versa)
111+
- Task ordering contradictions (e.g., integration tasks before foundational setup tasks without dependency note)
112+
- Conflicting requirements (e.g., one requires Next.js while other specifies Vue)
113+
114+
### 5. Severity Assignment
115+
116+
Use this heuristic to prioritize findings:
117+
118+
- **CRITICAL**: Violates constitution MUST, missing core spec artifact, or requirement with zero coverage that blocks baseline functionality
119+
- **HIGH**: Duplicate or conflicting requirement, ambiguous security/performance attribute, untestable acceptance criterion
120+
- **MEDIUM**: Terminology drift, missing non-functional task coverage, underspecified edge case
121+
- **LOW**: Style/wording improvements, minor redundancy not affecting execution order
122+
123+
### 6. Produce Compact Analysis Report
124+
125+
Output a Markdown report (no file writes) with the following structure:
126+
127+
## Specification Analysis Report
128+
129+
| ID | Category | Severity | Location(s) | Summary | Recommendation |
130+
|----|----------|----------|-------------|---------|----------------|
131+
| A1 | Duplication | HIGH | spec.md:L120-134 | Two similar requirements ... | Merge phrasing; keep clearer version |
132+
133+
(Add one row per finding; generate stable IDs prefixed by category initial.)
134+
135+
**Coverage Summary Table:**
136+
137+
| Requirement Key | Has Task? | Task IDs | Notes |
138+
|-----------------|-----------|----------|-------|
139+
140+
**Constitution Alignment Issues:** (if any)
141+
142+
**Unmapped Tasks:** (if any)
143+
144+
**Metrics:**
145+
146+
- Total Requirements
147+
- Total Tasks
148+
- Coverage % (requirements with >=1 task)
149+
- Ambiguity Count
150+
- Duplication Count
151+
- Critical Issues Count
152+
153+
### 7. Provide Next Actions
154+
155+
At end of report, output a concise Next Actions block:
156+
157+
- If CRITICAL issues exist: Recommend resolving before `/implement`
158+
- If only LOW/MEDIUM: User may proceed, but provide improvement suggestions
159+
- Provide explicit command suggestions: e.g., "Run /specify with refinement", "Run /plan to adjust architecture", "Manually edit tasks.md to add coverage for 'performance-metrics'"
160+
161+
### 8. Offer Remediation
162+
163+
Ask the user: "Would you like me to suggest concrete remediation edits for the top N issues?" (Do NOT apply them automatically.)
164+
165+
## Operating Principles
166+
167+
### Context Efficiency
168+
169+
- **Minimal high-signal tokens**: Focus on actionable findings, not exhaustive documentation
170+
- **Progressive disclosure**: Load artifacts incrementally; don't dump all content into analysis
171+
- **Token-efficient output**: Limit findings table to 50 rows; summarize overflow
172+
- **Deterministic results**: Rerunning without changes should produce consistent IDs and counts
173+
174+
### Analysis Guidelines
175+
176+
- **NEVER modify files** (this is read-only analysis)
177+
- **NEVER hallucinate missing sections** (if absent, report them accurately)
178+
- **Prioritize constitution violations** (these are always CRITICAL)
179+
- **Use examples over exhaustive rules** (cite specific instances, not generic patterns)
180+
- **Report zero issues gracefully** (emit success report with coverage statistics)
181+
182+
## Context
183+
184+
$ARGUMENTS

0 commit comments

Comments
 (0)