@x0rium/devkit-cli 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,163 @@
1
+ ---
2
+ description: Execute the implementation plan by processing and executing all tasks defined in tasks.md
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
+ ## Outline
14
+
15
+ 1. Run `.specify/scripts/bash/check-prerequisites.sh --json --require-tasks --include-tasks` from repo root and parse FEATURE_DIR and AVAILABLE_DOCS list. All paths must be absolute. 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").
16
+
17
+ 2. **Check checklists status** (if FEATURE_DIR/checklists/ exists):
18
+ - Scan all checklist files in the checklists/ directory
19
+ - For each checklist, count:
20
+ - Total items: All lines matching `- [ ]` or `- [X]` or `- [x]`
21
+ - Completed items: Lines matching `- [X]` or `- [x]`
22
+ - Incomplete items: Lines matching `- [ ]`
23
+ - Create a status table:
24
+
25
+ ```text
26
+ | Checklist | Total | Completed | Incomplete | Status |
27
+ |-----------|-------|-----------|------------|--------|
28
+ | ux.md | 12 | 12 | 0 | ✓ PASS |
29
+ | test.md | 8 | 5 | 3 | ✗ FAIL |
30
+ | security.md | 6 | 6 | 0 | ✓ PASS |
31
+ ```
32
+
33
+ - Calculate overall status:
34
+ - **PASS**: All checklists have 0 incomplete items
35
+ - **FAIL**: One or more checklists have incomplete items
36
+
37
+ - **If any checklist is incomplete**:
38
+ - Display the table with incomplete item counts
39
+ - **STOP** and ask: "Some checklists are incomplete. Do you want to proceed with implementation anyway? (yes/no)"
40
+ - Wait for user response before continuing
41
+ - If user says "no" or "wait" or "stop", halt execution
42
+ - If user says "yes" or "proceed" or "continue", proceed to step 3
43
+
44
+ - **If all checklists are complete**:
45
+ - Display the table showing all checklists passed
46
+ - Automatically proceed to step 3
47
+
48
+ 3. Load and analyze the implementation context:
49
+ - **REQUIRED**: Read tasks.md for the complete task list and execution plan
50
+ - **REQUIRED**: Read plan.md for tech stack, architecture, and file structure
51
+ - **IF EXISTS**: Read data-model.md for entities and relationships
52
+ - **IF EXISTS**: Read contracts/ for API specifications and test requirements
53
+ - **IF EXISTS**: Read research.md for technical decisions and constraints
54
+ - **IF EXISTS**: Read quickstart.md for integration scenarios
55
+
56
+ 4. **Project Setup Verification**:
57
+ - **REQUIRED**: Create/verify ignore files based on actual project setup:
58
+
59
+ **Detection & Creation Logic**:
60
+ - Check if the following command succeeds to determine if the repository is a git repo (create/verify .gitignore if so):
61
+
62
+ ```sh
63
+ git rev-parse --git-dir 2>/dev/null
64
+ ```
65
+
66
+ - Check if Dockerfile* exists or Docker in plan.md → create/verify .dockerignore
67
+ - Check if .eslintrc* exists → create/verify .eslintignore
68
+ - Check if eslint.config.* exists → ensure the config's `ignores` entries cover required patterns
69
+ - Check if .prettierrc* exists → create/verify .prettierignore
70
+ - Check if .npmrc or package.json exists → create/verify .npmignore (if publishing)
71
+ - Check if terraform files (*.tf) exist → create/verify .terraformignore
72
+ - Check if .helmignore needed (helm charts present) → create/verify .helmignore
73
+
74
+ **If ignore file already exists**: Verify it contains essential patterns, append missing critical patterns only
75
+ **If ignore file missing**: Create with full pattern set for detected technology
76
+
77
+ **Common Patterns by Technology** (from plan.md tech stack):
78
+ - **Node.js/JavaScript/TypeScript**: `node_modules/`, `dist/`, `build/`, `*.log`, `.env*`
79
+ - **Python**: `__pycache__/`, `*.pyc`, `.venv/`, `venv/`, `dist/`, `*.egg-info/`
80
+ - **Java**: `target/`, `*.class`, `*.jar`, `.gradle/`, `build/`
81
+ - **C#/.NET**: `bin/`, `obj/`, `*.user`, `*.suo`, `packages/`
82
+ - **Go**: `*.exe`, `*.test`, `vendor/`, `*.out`
83
+ - **Ruby**: `.bundle/`, `log/`, `tmp/`, `*.gem`, `vendor/bundle/`
84
+ - **PHP**: `vendor/`, `*.log`, `*.cache`, `*.env`
85
+ - **Rust**: `target/`, `debug/`, `release/`, `*.rs.bk`, `*.rlib`, `*.prof*`, `.idea/`, `*.log`, `.env*`
86
+ - **Kotlin**: `build/`, `out/`, `.gradle/`, `.idea/`, `*.class`, `*.jar`, `*.iml`, `*.log`, `.env*`
87
+ - **C++**: `build/`, `bin/`, `obj/`, `out/`, `*.o`, `*.so`, `*.a`, `*.exe`, `*.dll`, `.idea/`, `*.log`, `.env*`
88
+ - **C**: `build/`, `bin/`, `obj/`, `out/`, `*.o`, `*.a`, `*.so`, `*.exe`, `Makefile`, `config.log`, `.idea/`, `*.log`, `.env*`
89
+ - **Swift**: `.build/`, `DerivedData/`, `*.swiftpm/`, `Packages/`
90
+ - **R**: `.Rproj.user/`, `.Rhistory`, `.RData`, `.Ruserdata`, `*.Rproj`, `packrat/`, `renv/`
91
+ - **Universal**: `.DS_Store`, `Thumbs.db`, `*.tmp`, `*.swp`, `.vscode/`, `.idea/`
92
+
93
+ **Tool-Specific Patterns**:
94
+ - **Docker**: `node_modules/`, `.git/`, `Dockerfile*`, `.dockerignore`, `*.log*`, `.env*`, `coverage/`
95
+ - **ESLint**: `node_modules/`, `dist/`, `build/`, `coverage/`, `*.min.js`
96
+ - **Prettier**: `node_modules/`, `dist/`, `build/`, `coverage/`, `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`
97
+ - **Terraform**: `.terraform/`, `*.tfstate*`, `*.tfvars`, `.terraform.lock.hcl`
98
+ - **Kubernetes/k8s**: `*.secret.yaml`, `secrets/`, `.kube/`, `kubeconfig*`, `*.key`, `*.crt`
99
+
100
+ 5. Parse tasks.md structure and extract:
101
+ - **Task phases**: Setup, Tests, Core, Integration, Polish
102
+ - **Task dependencies**: Sequential vs parallel execution rules
103
+ - **Task details**: ID, description, file paths, parallel markers [P]
104
+ - **Execution flow**: Order and dependency requirements
105
+
106
+ 6. Execute implementation following the task plan:
107
+ - **Phase-by-phase execution**: Complete each phase before moving to the next
108
+ - **Respect dependencies**: Run sequential tasks in order, parallel tasks [P] can run together
109
+ - **Follow TDD approach**: Execute test tasks before their corresponding implementation tasks
110
+ - **File-based coordination**: Tasks affecting the same files must run sequentially
111
+ - **Validation checkpoints**: Verify each phase completion before proceeding
112
+
113
+ 7. Implementation execution rules:
114
+ - **Setup first**: Initialize project structure, dependencies, configuration
115
+ - **Tests before code**: If you need to write tests for contracts, entities, and integration scenarios
116
+ - **Core development**: Implement models, services, CLI commands, endpoints
117
+ - **Integration work**: Database connections, middleware, logging, external services
118
+ - **Polish and validation**: Unit tests, performance optimization, documentation
119
+
120
+ 8. Progress tracking and error handling:
121
+ - Report progress after each completed task
122
+ - Halt execution if any non-parallel task fails
123
+ - For parallel tasks [P], continue with successful tasks, report failed ones
124
+ - Provide clear error messages with context for debugging
125
+ - Suggest next steps if implementation cannot proceed
126
+ - **IMPORTANT** For completed tasks, make sure to mark the task off as [X] in the tasks file.
127
+
128
+ 9. Completion validation:
129
+ - Verify all required tasks are completed
130
+ - Check that implemented features match the original specification
131
+ - Validate that tests pass and coverage meets requirements
132
+ - Confirm the implementation follows the technical plan
133
+ - Report final status with summary of completed work
134
+
135
+ <!-- DEVKIT:START:phase-guards -->
136
+ 10. **DevKit Phase Guards** — integrate DevKit checks into implementation:
137
+
138
+ a. **Before architecture-impacting tasks**: Run impact analysis:
139
+ ```bash
140
+ devkit impact "<task description>"
141
+ ```
142
+ If risk is HIGH, pause and suggest `devkit rfc` before proceeding.
143
+
144
+ b. **After completing each phase**: Run validation:
145
+ ```bash
146
+ devkit validate
147
+ ```
148
+ If validation fails, halt phase progression and report the issues.
149
+
150
+ c. **On implementation failure**: If a task fails in a way that suggests a broken assumption:
151
+ ```bash
152
+ devkit investigate "<description of the failure and broken assumption>"
153
+ ```
154
+ This creates an Investigation record linking back to relevant ADRs.
155
+
156
+ d. **After final phase**: Run full coverage check:
157
+ ```bash
158
+ devkit coverage
159
+ ```
160
+ Include coverage summary in the implementation completion report.
161
+ <!-- DEVKIT:END:phase-guards -->
162
+
163
+ Note: This command assumes a complete task breakdown exists in tasks.md. If tasks are incomplete or missing, suggest running `/speckit.tasks` first to regenerate the task list.
@@ -0,0 +1,119 @@
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
+ ---
12
+
13
+ ## User Input
14
+
15
+ ```text
16
+ $ARGUMENTS
17
+ ```
18
+
19
+ You **MUST** consider the user input before proceeding (if not empty).
20
+
21
+ ## Outline
22
+
23
+ <!-- DEVKIT:START:constitution-precheck -->
24
+ **DevKit Pre-Planning Validation**:
25
+
26
+ Before starting the planning workflow, run:
27
+ ```bash
28
+ devkit validate
29
+ ```
30
+ If validation fails with errors, resolve them before proceeding. Cross-reference the plan against invariants I1-I8 (technical) and U1-U6 (UX) from `.devkit/arch/invariants.md` and `.devkit/product/ux_invariants.md`. Any architectural decision in the plan that conflicts with an invariant must be justified or trigger `devkit rfc`.
31
+ <!-- DEVKIT:END:constitution-precheck -->
32
+
33
+ 1. **Setup**: Run `.specify/scripts/bash/setup-plan.sh --json` 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").
34
+
35
+ 2. **Load context**: Read FEATURE_SPEC and `.specify/memory/constitution.md`. Load IMPL_PLAN template (already copied).
36
+
37
+ 3. **Execute plan workflow**: Follow the structure in IMPL_PLAN template to:
38
+ - Fill Technical Context (mark unknowns as "NEEDS CLARIFICATION")
39
+ - Fill Constitution Check section from constitution
40
+ - Evaluate gates (ERROR if violations unjustified)
41
+ - Phase 0: Generate research.md (resolve all NEEDS CLARIFICATION)
42
+ - Phase 1: Generate data-model.md, contracts/, quickstart.md
43
+ - Phase 1: Update agent context by running the agent script
44
+ - Re-evaluate Constitution Check post-design
45
+
46
+ 4. **Stop and report**: Command ends after Phase 2 planning. Report branch, IMPL_PLAN path, and generated artifacts.
47
+
48
+ ## Phases
49
+
50
+ ### Phase 0: Outline & Research
51
+
52
+ 1. **Extract unknowns from Technical Context** above:
53
+ - For each NEEDS CLARIFICATION → research task
54
+ - For each dependency → best practices task
55
+ - For each integration → patterns task
56
+
57
+ 2. **Generate and dispatch research agents**:
58
+
59
+ ```text
60
+ For each unknown in Technical Context:
61
+ Task: "Research {unknown} for {feature context}"
62
+ For each technology choice:
63
+ Task: "Find best practices for {tech} in {domain}"
64
+ ```
65
+
66
+ 3. **Consolidate findings** in `research.md` using format:
67
+ - Decision: [what was chosen]
68
+ - Rationale: [why chosen]
69
+ - Alternatives considered: [what else evaluated]
70
+
71
+ **Output**: research.md with all NEEDS CLARIFICATION resolved
72
+
73
+ ### Phase 1: Design & Contracts
74
+
75
+ **Prerequisites:** `research.md` complete
76
+
77
+ 1. **Extract entities from feature spec** → `data-model.md`:
78
+ - Entity name, fields, relationships
79
+ - Validation rules from requirements
80
+ - State transitions if applicable
81
+
82
+ 2. **Generate API contracts** from functional requirements:
83
+ - For each user action → endpoint
84
+ - Use standard REST/GraphQL patterns
85
+ - Output OpenAPI/GraphQL schema to `/contracts/`
86
+
87
+ 3. **Agent context update**:
88
+ - Run `.specify/scripts/bash/update-agent-context.sh claude`
89
+ - These scripts detect which AI agent is in use
90
+ - Update the appropriate agent-specific context file
91
+ - Add only new technology from current plan
92
+ - Preserve manual additions between markers
93
+
94
+ **Output**: data-model.md, /contracts/*, quickstart.md, agent-specific file
95
+
96
+ <!-- DEVKIT:START:plan-postcheck -->
97
+ **DevKit Post-Planning Validation**:
98
+
99
+ After plan generation is complete:
100
+
101
+ 1. **Run validation**:
102
+ ```bash
103
+ devkit validate
104
+ ```
105
+
106
+ 2. **Run impact analysis** on the plan:
107
+ ```bash
108
+ devkit impact "<feature name>: plan generated with tech stack <key technologies>"
109
+ ```
110
+
111
+ 3. If risk is HIGH, recommend running `devkit rfc` before proceeding to task generation.
112
+
113
+ 4. Include DevKit validation status and impact risk level in the plan completion report.
114
+ <!-- DEVKIT:END:plan-postcheck -->
115
+
116
+ ## Key rules
117
+
118
+ - Use absolute paths
119
+ - ERROR on gate failures or unresolved clarifications
@@ -0,0 +1,298 @@
1
+ ---
2
+ description: Create or update the feature specification from a natural language feature description.
3
+ handoffs:
4
+ - label: Build Technical Plan
5
+ agent: speckit.plan
6
+ prompt: Create a plan for the spec. I am building with...
7
+ - label: Clarify Spec Requirements
8
+ agent: speckit.clarify
9
+ prompt: Clarify specification requirements
10
+ send: true
11
+ ---
12
+
13
+ ## User Input
14
+
15
+ ```text
16
+ $ARGUMENTS
17
+ ```
18
+
19
+ You **MUST** consider the user input before proceeding (if not empty).
20
+
21
+ ## Outline
22
+
23
+ The text the user typed after `/speckit.specify` in the triggering message **is** the feature description. Assume you always have it available in this conversation even if `$ARGUMENTS` appears literally below. Do not ask the user to repeat it unless they provided an empty command.
24
+
25
+ Given that feature description, do this:
26
+
27
+ 1. **Generate a concise short name** (2-4 words) for the branch:
28
+ - Analyze the feature description and extract the most meaningful keywords
29
+ - Create a 2-4 word short name that captures the essence of the feature
30
+ - Use action-noun format when possible (e.g., "add-user-auth", "fix-payment-bug")
31
+ - Preserve technical terms and acronyms (OAuth2, API, JWT, etc.)
32
+ - Keep it concise but descriptive enough to understand the feature at a glance
33
+ - Examples:
34
+ - "I want to add user authentication" → "user-auth"
35
+ - "Implement OAuth2 integration for the API" → "oauth2-api-integration"
36
+ - "Create a dashboard for analytics" → "analytics-dashboard"
37
+ - "Fix payment processing timeout bug" → "fix-payment-timeout"
38
+
39
+ 2. **Check for existing branches before creating new one**:
40
+
41
+ a. First, fetch all remote branches to ensure we have the latest information:
42
+
43
+ ```bash
44
+ git fetch --all --prune
45
+ ```
46
+
47
+ b. Find the highest feature number across all sources for the short-name:
48
+ - Remote branches: `git ls-remote --heads origin | grep -E 'refs/heads/[0-9]+-<short-name>$'`
49
+ - Local branches: `git branch | grep -E '^[* ]*[0-9]+-<short-name>$'`
50
+ - Specs directories: Check for directories matching `specs/[0-9]+-<short-name>`
51
+
52
+ c. Determine the next available number:
53
+ - Extract all numbers from all three sources
54
+ - Find the highest number N
55
+ - Use N+1 for the new branch number
56
+
57
+ d. Run the script `.specify/scripts/bash/create-new-feature.sh --json "$ARGUMENTS"` with the calculated number and short-name:
58
+ - Pass `--number N+1` and `--short-name "your-short-name"` along with the feature description
59
+ - Bash example: `.specify/scripts/bash/create-new-feature.sh --json "$ARGUMENTS" --json --number 5 --short-name "user-auth" "Add user authentication"`
60
+ - PowerShell example: `.specify/scripts/bash/create-new-feature.sh --json "$ARGUMENTS" -Json -Number 5 -ShortName "user-auth" "Add user authentication"`
61
+
62
+ **IMPORTANT**:
63
+ - Check all three sources (remote branches, local branches, specs directories) to find the highest number
64
+ - Only match branches/directories with the exact short-name pattern
65
+ - If no existing branches/directories found with this short-name, start with number 1
66
+ - You must only ever run this script once per feature
67
+ - The JSON is provided in the terminal as output - always refer to it to get the actual content you're looking for
68
+ - The JSON output will contain BRANCH_NAME and SPEC_FILE paths
69
+ - 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")
70
+
71
+ 3. Load `.specify/templates/spec-template.md` to understand required sections.
72
+
73
+ 4. Follow this execution flow:
74
+
75
+ 1. Parse user description from Input
76
+ If empty: ERROR "No feature description provided"
77
+ 2. Extract key concepts from description
78
+ Identify: actors, actions, data, constraints
79
+ 3. For unclear aspects:
80
+ - Make informed guesses based on context and industry standards
81
+ - Only mark with [NEEDS CLARIFICATION: specific question] if:
82
+ - The choice significantly impacts feature scope or user experience
83
+ - Multiple reasonable interpretations exist with different implications
84
+ - No reasonable default exists
85
+ - **LIMIT: Maximum 3 [NEEDS CLARIFICATION] markers total**
86
+ - Prioritize clarifications by impact: scope > security/privacy > user experience > technical details
87
+ 4. Fill User Scenarios & Testing section
88
+ If no clear user flow: ERROR "Cannot determine user scenarios"
89
+ 5. Generate Functional Requirements
90
+ Each requirement must be testable
91
+ Use reasonable defaults for unspecified details (document assumptions in Assumptions section)
92
+ 6. Define Success Criteria
93
+ Create measurable, technology-agnostic outcomes
94
+ Include both quantitative metrics (time, performance, volume) and qualitative measures (user satisfaction, task completion)
95
+ Each criterion must be verifiable without implementation details
96
+ 7. Identify Key Entities (if data involved)
97
+ 8. Return: SUCCESS (spec ready for planning)
98
+
99
+ 5. Write the specification to SPEC_FILE using the template structure, replacing placeholders with concrete details derived from the feature description (arguments) while preserving section order and headings.
100
+
101
+ 6. **Specification Quality Validation**: After writing the initial spec, validate it against quality criteria:
102
+
103
+ a. **Create Spec Quality Checklist**: Generate a checklist file at `FEATURE_DIR/checklists/requirements.md` using the checklist template structure with these validation items:
104
+
105
+ ```markdown
106
+ # Specification Quality Checklist: [FEATURE NAME]
107
+
108
+ **Purpose**: Validate specification completeness and quality before proceeding to planning
109
+ **Created**: [DATE]
110
+ **Feature**: [Link to spec.md]
111
+
112
+ ## Content Quality
113
+
114
+ - [ ] No implementation details (languages, frameworks, APIs)
115
+ - [ ] Focused on user value and business needs
116
+ - [ ] Written for non-technical stakeholders
117
+ - [ ] All mandatory sections completed
118
+
119
+ ## Requirement Completeness
120
+
121
+ - [ ] No [NEEDS CLARIFICATION] markers remain
122
+ - [ ] Requirements are testable and unambiguous
123
+ - [ ] Success criteria are measurable
124
+ - [ ] Success criteria are technology-agnostic (no implementation details)
125
+ - [ ] All acceptance scenarios are defined
126
+ - [ ] Edge cases are identified
127
+ - [ ] Scope is clearly bounded
128
+ - [ ] Dependencies and assumptions identified
129
+
130
+ ## Feature Readiness
131
+
132
+ - [ ] All functional requirements have clear acceptance criteria
133
+ - [ ] User scenarios cover primary flows
134
+ - [ ] Feature meets measurable outcomes defined in Success Criteria
135
+ - [ ] No implementation details leak into specification
136
+
137
+ ## Notes
138
+
139
+ - Items marked incomplete require spec updates before `/speckit.clarify` or `/speckit.plan`
140
+ ```
141
+
142
+ b. **Run Validation Check**: Review the spec against each checklist item:
143
+ - For each item, determine if it passes or fails
144
+ - Document specific issues found (quote relevant spec sections)
145
+
146
+ c. **Handle Validation Results**:
147
+
148
+ - **If all items pass**: Mark checklist complete and proceed to step 6
149
+
150
+ - **If items fail (excluding [NEEDS CLARIFICATION])**:
151
+ 1. List the failing items and specific issues
152
+ 2. Update the spec to address each issue
153
+ 3. Re-run validation until all items pass (max 3 iterations)
154
+ 4. If still failing after 3 iterations, document remaining issues in checklist notes and warn user
155
+
156
+ - **If [NEEDS CLARIFICATION] markers remain**:
157
+ 1. Extract all [NEEDS CLARIFICATION: ...] markers from the spec
158
+ 2. **LIMIT CHECK**: If more than 3 markers exist, keep only the 3 most critical (by scope/security/UX impact) and make informed guesses for the rest
159
+ 3. For each clarification needed (max 3), present options to user in this format:
160
+
161
+ ```markdown
162
+ ## Question [N]: [Topic]
163
+
164
+ **Context**: [Quote relevant spec section]
165
+
166
+ **What we need to know**: [Specific question from NEEDS CLARIFICATION marker]
167
+
168
+ **Suggested Answers**:
169
+
170
+ | Option | Answer | Implications |
171
+ |--------|--------|--------------|
172
+ | A | [First suggested answer] | [What this means for the feature] |
173
+ | B | [Second suggested answer] | [What this means for the feature] |
174
+ | C | [Third suggested answer] | [What this means for the feature] |
175
+ | Custom | Provide your own answer | [Explain how to provide custom input] |
176
+
177
+ **Your choice**: _[Wait for user response]_
178
+ ```
179
+
180
+ 4. **CRITICAL - Table Formatting**: Ensure markdown tables are properly formatted:
181
+ - Use consistent spacing with pipes aligned
182
+ - Each cell should have spaces around content: `| Content |` not `|Content|`
183
+ - Header separator must have at least 3 dashes: `|--------|`
184
+ - Test that the table renders correctly in markdown preview
185
+ 5. Number questions sequentially (Q1, Q2, Q3 - max 3 total)
186
+ 6. Present all questions together before waiting for responses
187
+ 7. Wait for user to respond with their choices for all questions (e.g., "Q1: A, Q2: Custom - [details], Q3: B")
188
+ 8. Update the spec by replacing each [NEEDS CLARIFICATION] marker with the user's selected or provided answer
189
+ 9. Re-run validation after all clarifications are resolved
190
+
191
+ d. **Update Checklist**: After each validation iteration, update the checklist file with current pass/fail status
192
+
193
+ <!-- DEVKIT:START:invariant-guard -->
194
+ 7. **DevKit Invariant Guard** — after the spec is written and validated:
195
+
196
+ a. **Load invariants**: Read `.devkit/arch/invariants.md` and `.devkit/product/ux_invariants.md` (if they exist).
197
+
198
+ b. **Map feature to invariants**: For each invariant (I1-I8, U1-U6 or whatever IDs exist), determine whether this feature TOUCHES, DEPENDS ON, or is UNRELATED to that invariant.
199
+
200
+ c. **Append `## Invariant Coverage` section** to the spec file (before any closing notes):
201
+
202
+ ```markdown
203
+ ## Invariant Coverage
204
+
205
+ > Auto-generated by DevKit. Maps this spec to project invariants.
206
+
207
+ **Technical invariants** (from `.devkit/arch/invariants.md`):
208
+ | ID | Name | Relation | Notes |
209
+ |----|------|----------|-------|
210
+ | I1 | ... | TOUCHES / DEPENDS / — | ... |
211
+
212
+ **UX invariants** (from `.devkit/product/ux_invariants.md`):
213
+ | ID | Name | Relation | Notes |
214
+ |----|------|----------|-------|
215
+ | U1 | ... | TOUCHES / DEPENDS / — | ... |
216
+ ```
217
+
218
+ Only include rows where Relation is TOUCHES or DEPENDS (skip unrelated).
219
+
220
+ d. **Run impact analysis**:
221
+ ```bash
222
+ devkit impact "<feature short name>: touches <list of touched invariant IDs>"
223
+ ```
224
+ - If risk is HIGH or CRITICAL: **WARN** the user before proceeding. Suggest running `devkit rfc` if the feature may need to deviate from an invariant.
225
+ - If risk is LOW or MEDIUM: note it in the report and proceed.
226
+
227
+ e. **Run validation**:
228
+ ```bash
229
+ devkit validate
230
+ ```
231
+ <!-- DEVKIT:END:invariant-guard -->
232
+
233
+ 8. Report completion with branch name, spec file path, checklist results, invariant coverage summary, impact risk level, and readiness for the next phase (`/speckit.clarify` or `/speckit.plan`).
234
+
235
+ **NOTE:** The script creates and checks out the new branch and initializes the spec file before writing.
236
+
237
+ ## General Guidelines
238
+
239
+ ## Quick Guidelines
240
+
241
+ - Focus on **WHAT** users need and **WHY**.
242
+ - Avoid HOW to implement (no tech stack, APIs, code structure).
243
+ - Written for business stakeholders, not developers.
244
+ - DO NOT create any checklists that are embedded in the spec. That will be a separate command.
245
+
246
+ ### Section Requirements
247
+
248
+ - **Mandatory sections**: Must be completed for every feature
249
+ - **Optional sections**: Include only when relevant to the feature
250
+ - When a section doesn't apply, remove it entirely (don't leave as "N/A")
251
+
252
+ ### For AI Generation
253
+
254
+ When creating this spec from a user prompt:
255
+
256
+ 1. **Make informed guesses**: Use context, industry standards, and common patterns to fill gaps
257
+ 2. **Document assumptions**: Record reasonable defaults in the Assumptions section
258
+ 3. **Limit clarifications**: Maximum 3 [NEEDS CLARIFICATION] markers - use only for critical decisions that:
259
+ - Significantly impact feature scope or user experience
260
+ - Have multiple reasonable interpretations with different implications
261
+ - Lack any reasonable default
262
+ 4. **Prioritize clarifications**: scope > security/privacy > user experience > technical details
263
+ 5. **Think like a tester**: Every vague requirement should fail the "testable and unambiguous" checklist item
264
+ 6. **Common areas needing clarification** (only if no reasonable default exists):
265
+ - Feature scope and boundaries (include/exclude specific use cases)
266
+ - User types and permissions (if multiple conflicting interpretations possible)
267
+ - Security/compliance requirements (when legally/financially significant)
268
+
269
+ **Examples of reasonable defaults** (don't ask about these):
270
+
271
+ - Data retention: Industry-standard practices for the domain
272
+ - Performance targets: Standard web/mobile app expectations unless specified
273
+ - Error handling: User-friendly messages with appropriate fallbacks
274
+ - Authentication method: Standard session-based or OAuth2 for web apps
275
+ - Integration patterns: RESTful APIs unless specified otherwise
276
+
277
+ ### Success Criteria Guidelines
278
+
279
+ Success criteria must be:
280
+
281
+ 1. **Measurable**: Include specific metrics (time, percentage, count, rate)
282
+ 2. **Technology-agnostic**: No mention of frameworks, languages, databases, or tools
283
+ 3. **User-focused**: Describe outcomes from user/business perspective, not system internals
284
+ 4. **Verifiable**: Can be tested/validated without knowing implementation details
285
+
286
+ **Good examples**:
287
+
288
+ - "Users can complete checkout in under 3 minutes"
289
+ - "System supports 10,000 concurrent users"
290
+ - "95% of searches return results in under 1 second"
291
+ - "Task completion rate improves by 40%"
292
+
293
+ **Bad examples** (implementation-focused):
294
+
295
+ - "API response time is under 200ms" (too technical, use "Users see results instantly")
296
+ - "Database can handle 1000 TPS" (implementation detail, use user-facing metric)
297
+ - "React components render efficiently" (framework-specific)
298
+ - "Redis cache hit rate above 80%" (technology-specific)