Skip to content

Commit dc3bfcf

Browse files
committed
add gemini support
1 parent 9663c1e commit dc3bfcf

14 files changed

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

0 commit comments

Comments
 (0)