@cognite/cli 0.5.2 → 0.6.0-alpha.8

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.
Files changed (46) hide show
  1. package/README.md +118 -33
  2. package/_templates/app/new/config/eslint.config.mjs.ejs.t +99 -0
  3. package/_templates/app/new/config/tsconfig.json.ejs.t +35 -0
  4. package/_templates/app/new/config/tsconfig.node.json.ejs.t +27 -0
  5. package/_templates/app/new/config/vite.config.ts.ejs.t +26 -0
  6. package/_templates/app/new/config/vitest.config.ts.ejs.t +14 -0
  7. package/_templates/app/new/config/vitest.setup.ts.ejs.t +4 -0
  8. package/_templates/app/new/cursor/data-modeling.mdc.ejs.t +1996 -0
  9. package/_templates/app/new/cursor/mcp.json.ejs.t +10 -0
  10. package/_templates/app/new/cursor/rules.mdc.ejs.t +10 -0
  11. package/_templates/app/new/github/ci.yml.ejs.t +36 -0
  12. package/_templates/app/new/prompt.js +49 -0
  13. package/_templates/app/new/root/.npmrc.ejs.t +4 -0
  14. package/_templates/app/new/root/AGENTS.md.ejs.t +215 -0
  15. package/_templates/app/new/root/SPEC.md.ejs.t +77 -0
  16. package/_templates/app/new/root/app.json.ejs.t +22 -0
  17. package/_templates/app/new/root/gitignore.ejs.t +21 -0
  18. package/_templates/app/new/root/index.html.ejs.t +36 -0
  19. package/_templates/app/new/root/package.json.ejs.t +67 -0
  20. package/_templates/app/new/src/App.test.tsx.ejs.t +45 -0
  21. package/_templates/app/new/src/App.tsx.ejs.t +265 -0
  22. package/_templates/app/new/src/lib/utils.ts.ejs.t +9 -0
  23. package/_templates/app/new/src/main.tsx.ejs.t +36 -0
  24. package/_templates/app/new/src/styles.css.ejs.t +12 -0
  25. package/_vendor/spec-kit/.version +4 -0
  26. package/_vendor/spec-kit/README.md +39 -0
  27. package/_vendor/spec-kit/commands/speckit.analyze.md +249 -0
  28. package/_vendor/spec-kit/commands/speckit.checklist.md +361 -0
  29. package/_vendor/spec-kit/commands/speckit.clarify.md +247 -0
  30. package/_vendor/spec-kit/commands/speckit.implement.md +198 -0
  31. package/_vendor/spec-kit/commands/speckit.plan.md +149 -0
  32. package/_vendor/spec-kit/commands/speckit.specify.md +327 -0
  33. package/_vendor/spec-kit/commands/speckit.tasks.md +200 -0
  34. package/_vendor/spec-kit/scripts/bash/check-prerequisites.sh +190 -0
  35. package/_vendor/spec-kit/scripts/bash/common.sh +645 -0
  36. package/_vendor/spec-kit/scripts/bash/setup-plan.sh +75 -0
  37. package/_vendor/spec-kit/templates/checklist-template.md +40 -0
  38. package/_vendor/spec-kit/templates/plan-template.md +104 -0
  39. package/_vendor/spec-kit/templates/spec-template.md +128 -0
  40. package/_vendor/spec-kit/templates/tasks-template.md +251 -0
  41. package/dist/chunk-GFMJ4MJZ.js +8 -0
  42. package/dist/cli/cli.js +347 -0
  43. package/dist/skills-4R3OUI44.js +2 -0
  44. package/package.json +25 -17
  45. package/index.js +0 -116
  46. package/operations.js +0 -113
@@ -0,0 +1,361 @@
1
+ ---
2
+ description: Generate a custom checklist for the current feature based on user requirements.
3
+ ---
4
+
5
+ ## Checklist Purpose: "Unit Tests for English"
6
+
7
+ **CRITICAL CONCEPT**: Checklists are **UNIT TESTS FOR REQUIREMENTS WRITING** - they validate the quality, clarity, and completeness of requirements in a given domain.
8
+
9
+ **NOT for verification/testing**:
10
+
11
+ - ❌ NOT "Verify the button clicks correctly"
12
+ - ❌ NOT "Test error handling works"
13
+ - ❌ NOT "Confirm the API returns 200"
14
+ - ❌ NOT checking if code/implementation matches the spec
15
+
16
+ **FOR requirements quality validation**:
17
+
18
+ - ✅ "Are visual hierarchy requirements defined for all card types?" (completeness)
19
+ - ✅ "Is 'prominent display' quantified with specific sizing/positioning?" (clarity)
20
+ - ✅ "Are hover state requirements consistent across all interactive elements?" (consistency)
21
+ - ✅ "Are accessibility requirements defined for keyboard navigation?" (coverage)
22
+ - ✅ "Does the spec define what happens when logo image fails to load?" (edge cases)
23
+
24
+ **Metaphor**: If your spec is code written in English, the checklist is its unit test suite. You're testing whether the requirements are well-written, complete, unambiguous, and ready for implementation - NOT whether the implementation works.
25
+
26
+ ## User Input
27
+
28
+ ```text
29
+ $ARGUMENTS
30
+ ```
31
+
32
+ You **MUST** consider the user input before proceeding (if not empty).
33
+
34
+ ## Pre-Execution Checks
35
+
36
+ **Check for extension hooks (before checklist generation)**:
37
+ - Check if `.specify/extensions.yml` exists in the project root.
38
+ - If it exists, read it and look for entries under the `hooks.before_checklist` key
39
+ - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
40
+ - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
41
+ - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
42
+ - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
43
+ - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
44
+ - For each executable hook, output the following based on its `optional` flag:
45
+ - **Optional hook** (`optional: true`):
46
+ ```
47
+ ## Extension Hooks
48
+
49
+ **Optional Pre-Hook**: {extension}
50
+ Command: `/{command}`
51
+ Description: {description}
52
+
53
+ Prompt: {prompt}
54
+ To execute: `/{command}`
55
+ ```
56
+ - **Mandatory hook** (`optional: false`):
57
+ ```
58
+ ## Extension Hooks
59
+
60
+ **Automatic Pre-Hook**: {extension}
61
+ Executing: `/{command}`
62
+ EXECUTE_COMMAND: {command}
63
+
64
+ Wait for the result of the hook command before proceeding to the Execution Steps.
65
+ ```
66
+ - If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
67
+
68
+ ## Execution Steps
69
+
70
+ 1. **Setup**: Run `.specify/scripts/bash/check-prerequisites.sh --json` from repo root and parse JSON for FEATURE_DIR and AVAILABLE_DOCS list.
71
+ - All file paths must be absolute.
72
+ - 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").
73
+
74
+ 2. **Clarify intent (dynamic)**: Derive up to THREE initial contextual clarifying questions (no pre-baked catalog). They MUST:
75
+ - Be generated from the user's phrasing + extracted signals from spec/plan/tasks
76
+ - Only ask about information that materially changes checklist content
77
+ - Be skipped individually if already unambiguous in `$ARGUMENTS`
78
+ - Prefer precision over breadth
79
+
80
+ Generation algorithm:
81
+ 1. Extract signals: feature domain keywords (e.g., auth, latency, UX, API), risk indicators ("critical", "must", "compliance"), stakeholder hints ("QA", "review", "security team"), and explicit deliverables ("a11y", "rollback", "contracts").
82
+ 2. Cluster signals into candidate focus areas (max 4) ranked by relevance.
83
+ 3. Identify probable audience & timing (author, reviewer, QA, release) if not explicit.
84
+ 4. Detect missing dimensions: scope breadth, depth/rigor, risk emphasis, exclusion boundaries, measurable acceptance criteria.
85
+ 5. Formulate questions chosen from these archetypes:
86
+ - Scope refinement (e.g., "Should this include integration touchpoints with X and Y or stay limited to local module correctness?")
87
+ - Risk prioritization (e.g., "Which of these potential risk areas should receive mandatory gating checks?")
88
+ - Depth calibration (e.g., "Is this a lightweight pre-commit sanity list or a formal release gate?")
89
+ - Audience framing (e.g., "Will this be used by the author only or peers during PR review?")
90
+ - Boundary exclusion (e.g., "Should we explicitly exclude performance tuning items this round?")
91
+ - Scenario class gap (e.g., "No recovery flows detected—are rollback / partial failure paths in scope?")
92
+
93
+ Question formatting rules:
94
+ - If presenting options, generate a compact table with columns: Option | Candidate | Why It Matters
95
+ - Limit to A–E options maximum; omit table if a free-form answer is clearer
96
+ - Never ask the user to restate what they already said
97
+ - Avoid speculative categories (no hallucination). If uncertain, ask explicitly: "Confirm whether X belongs in scope."
98
+
99
+ Defaults when interaction impossible:
100
+ - Depth: Standard
101
+ - Audience: Reviewer (PR) if code-related; Author otherwise
102
+ - Focus: Top 2 relevance clusters
103
+
104
+ Output the questions (label Q1/Q2/Q3). After answers: if ≥2 scenario classes (Alternate / Exception / Recovery / Non-Functional domain) remain unclear, you MAY ask up to TWO more targeted follow‑ups (Q4/Q5) with a one-line justification each (e.g., "Unresolved recovery path risk"). Do not exceed five total questions. Skip escalation if user explicitly declines more.
105
+
106
+ 3. **Understand user request**: Combine `$ARGUMENTS` + clarifying answers:
107
+ - Derive checklist theme (e.g., security, review, deploy, ux)
108
+ - Consolidate explicit must-have items mentioned by user
109
+ - Map focus selections to category scaffolding
110
+ - Infer any missing context from spec/plan/tasks (do NOT hallucinate)
111
+
112
+ 4. **Load feature context**: Read from FEATURE_DIR:
113
+ - spec.md: Feature requirements and scope
114
+ - plan.md (if exists): Technical details, dependencies
115
+ - tasks.md (if exists): Implementation tasks
116
+
117
+ **Context Loading Strategy**:
118
+ - Load only necessary portions relevant to active focus areas (avoid full-file dumping)
119
+ - Prefer summarizing long sections into concise scenario/requirement bullets
120
+ - Use progressive disclosure: add follow-on retrieval only if gaps detected
121
+ - If source docs are large, generate interim summary items instead of embedding raw text
122
+
123
+ 5. **Generate checklist** - Create "Unit Tests for Requirements":
124
+ - Create `FEATURE_DIR/checklists/` directory if it doesn't exist
125
+ - Generate unique checklist filename:
126
+ - Use short, descriptive name based on domain (e.g., `ux.md`, `api.md`, `security.md`)
127
+ - Format: `[domain].md`
128
+ - File handling behavior:
129
+ - If file does NOT exist: Create new file and number items starting from CHK001
130
+ - If file exists: Append new items to existing file, continuing from the last CHK ID (e.g., if last item is CHK015, start new items at CHK016)
131
+ - Never delete or replace existing checklist content - always preserve and append
132
+
133
+ **CORE PRINCIPLE - Test the Requirements, Not the Implementation**:
134
+ Every checklist item MUST evaluate the REQUIREMENTS THEMSELVES for:
135
+ - **Completeness**: Are all necessary requirements present?
136
+ - **Clarity**: Are requirements unambiguous and specific?
137
+ - **Consistency**: Do requirements align with each other?
138
+ - **Measurability**: Can requirements be objectively verified?
139
+ - **Coverage**: Are all scenarios/edge cases addressed?
140
+
141
+ **Category Structure** - Group items by requirement quality dimensions:
142
+ - **Requirement Completeness** (Are all necessary requirements documented?)
143
+ - **Requirement Clarity** (Are requirements specific and unambiguous?)
144
+ - **Requirement Consistency** (Do requirements align without conflicts?)
145
+ - **Acceptance Criteria Quality** (Are success criteria measurable?)
146
+ - **Scenario Coverage** (Are all flows/cases addressed?)
147
+ - **Edge Case Coverage** (Are boundary conditions defined?)
148
+ - **Non-Functional Requirements** (Performance, Security, Accessibility, etc. - are they specified?)
149
+ - **Dependencies & Assumptions** (Are they documented and validated?)
150
+ - **Ambiguities & Conflicts** (What needs clarification?)
151
+
152
+ **HOW TO WRITE CHECKLIST ITEMS - "Unit Tests for English"**:
153
+
154
+ ❌ **WRONG** (Testing implementation):
155
+ - "Verify landing page displays 3 episode cards"
156
+ - "Test hover states work on desktop"
157
+ - "Confirm logo click navigates home"
158
+
159
+ ✅ **CORRECT** (Testing requirements quality):
160
+ - "Are the exact number and layout of featured episodes specified?" [Completeness]
161
+ - "Is 'prominent display' quantified with specific sizing/positioning?" [Clarity]
162
+ - "Are hover state requirements consistent across all interactive elements?" [Consistency]
163
+ - "Are keyboard navigation requirements defined for all interactive UI?" [Coverage]
164
+ - "Is the fallback behavior specified when logo image fails to load?" [Edge Cases]
165
+ - "Are loading states defined for asynchronous episode data?" [Completeness]
166
+ - "Does the spec define visual hierarchy for competing UI elements?" [Clarity]
167
+
168
+ **ITEM STRUCTURE**:
169
+ Each item should follow this pattern:
170
+ - Question format asking about requirement quality
171
+ - Focus on what's WRITTEN (or not written) in the spec/plan
172
+ - Include quality dimension in brackets [Completeness/Clarity/Consistency/etc.]
173
+ - Reference spec section `[Spec §X.Y]` when checking existing requirements
174
+ - Use `[Gap]` marker when checking for missing requirements
175
+
176
+ **EXAMPLES BY QUALITY DIMENSION**:
177
+
178
+ Completeness:
179
+ - "Are error handling requirements defined for all API failure modes? [Gap]"
180
+ - "Are accessibility requirements specified for all interactive elements? [Completeness]"
181
+ - "Are mobile breakpoint requirements defined for responsive layouts? [Gap]"
182
+
183
+ Clarity:
184
+ - "Is 'fast loading' quantified with specific timing thresholds? [Clarity, Spec §NFR-2]"
185
+ - "Are 'related episodes' selection criteria explicitly defined? [Clarity, Spec §FR-5]"
186
+ - "Is 'prominent' defined with measurable visual properties? [Ambiguity, Spec §FR-4]"
187
+
188
+ Consistency:
189
+ - "Do navigation requirements align across all pages? [Consistency, Spec §FR-10]"
190
+ - "Are card component requirements consistent between landing and detail pages? [Consistency]"
191
+
192
+ Coverage:
193
+ - "Are requirements defined for zero-state scenarios (no episodes)? [Coverage, Edge Case]"
194
+ - "Are concurrent user interaction scenarios addressed? [Coverage, Gap]"
195
+ - "Are requirements specified for partial data loading failures? [Coverage, Exception Flow]"
196
+
197
+ Measurability:
198
+ - "Are visual hierarchy requirements measurable/testable? [Acceptance Criteria, Spec §FR-1]"
199
+ - "Can 'balanced visual weight' be objectively verified? [Measurability, Spec §FR-2]"
200
+
201
+ **Scenario Classification & Coverage** (Requirements Quality Focus):
202
+ - Check if requirements exist for: Primary, Alternate, Exception/Error, Recovery, Non-Functional scenarios
203
+ - For each scenario class, ask: "Are [scenario type] requirements complete, clear, and consistent?"
204
+ - If scenario class missing: "Are [scenario type] requirements intentionally excluded or missing? [Gap]"
205
+ - Include resilience/rollback when state mutation occurs: "Are rollback requirements defined for migration failures? [Gap]"
206
+
207
+ **Traceability Requirements**:
208
+ - MINIMUM: ≥80% of items MUST include at least one traceability reference
209
+ - Each item should reference: spec section `[Spec §X.Y]`, or use markers: `[Gap]`, `[Ambiguity]`, `[Conflict]`, `[Assumption]`
210
+ - If no ID system exists: "Is a requirement & acceptance criteria ID scheme established? [Traceability]"
211
+
212
+ **Surface & Resolve Issues** (Requirements Quality Problems):
213
+ Ask questions about the requirements themselves:
214
+ - Ambiguities: "Is the term 'fast' quantified with specific metrics? [Ambiguity, Spec §NFR-1]"
215
+ - Conflicts: "Do navigation requirements conflict between §FR-10 and §FR-10a? [Conflict]"
216
+ - Assumptions: "Is the assumption of 'always available podcast API' validated? [Assumption]"
217
+ - Dependencies: "Are external podcast API requirements documented? [Dependency, Gap]"
218
+ - Missing definitions: "Is 'visual hierarchy' defined with measurable criteria? [Gap]"
219
+
220
+ **Content Consolidation**:
221
+ - Soft cap: If raw candidate items > 40, prioritize by risk/impact
222
+ - Merge near-duplicates checking the same requirement aspect
223
+ - If >5 low-impact edge cases, create one item: "Are edge cases X, Y, Z addressed in requirements? [Coverage]"
224
+
225
+ **🚫 ABSOLUTELY PROHIBITED** - These make it an implementation test, not a requirements test:
226
+ - ❌ Any item starting with "Verify", "Test", "Confirm", "Check" + implementation behavior
227
+ - ❌ References to code execution, user actions, system behavior
228
+ - ❌ "Displays correctly", "works properly", "functions as expected"
229
+ - ❌ "Click", "navigate", "render", "load", "execute"
230
+ - ❌ Test cases, test plans, QA procedures
231
+ - ❌ Implementation details (frameworks, APIs, algorithms)
232
+
233
+ **✅ REQUIRED PATTERNS** - These test requirements quality:
234
+ - ✅ "Are [requirement type] defined/specified/documented for [scenario]?"
235
+ - ✅ "Is [vague term] quantified/clarified with specific criteria?"
236
+ - ✅ "Are requirements consistent between [section A] and [section B]?"
237
+ - ✅ "Can [requirement] be objectively measured/verified?"
238
+ - ✅ "Are [edge cases/scenarios] addressed in requirements?"
239
+ - ✅ "Does the spec define [missing aspect]?"
240
+
241
+ 6. **Structure Reference**: Generate the checklist following the canonical template in `.specify/templates/checklist-template.md` for title, meta section, category headings, and ID formatting. If template is unavailable, use: H1 title, purpose/created meta lines, `##` category sections containing `- [ ] CHK### <requirement item>` lines with globally incrementing IDs starting at CHK001.
242
+
243
+ 7. **Report**: Output full path to checklist file, item count, and summarize whether the run created a new file or appended to an existing one. Summarize:
244
+ - Focus areas selected
245
+ - Depth level
246
+ - Actor/timing
247
+ - Any explicit user-specified must-have items incorporated
248
+
249
+ **Important**: Each `/speckit.checklist` command invocation uses a short, descriptive checklist filename and either creates a new file or appends to an existing one. This allows:
250
+
251
+ - Multiple checklists of different types (e.g., `ux.md`, `test.md`, `security.md`)
252
+ - Simple, memorable filenames that indicate checklist purpose
253
+ - Easy identification and navigation in the `checklists/` folder
254
+
255
+ To avoid clutter, use descriptive types and clean up obsolete checklists when done.
256
+
257
+ ## Example Checklist Types & Sample Items
258
+
259
+ **UX Requirements Quality:** `ux.md`
260
+
261
+ Sample items (testing the requirements, NOT the implementation):
262
+
263
+ - "Are visual hierarchy requirements defined with measurable criteria? [Clarity, Spec §FR-1]"
264
+ - "Is the number and positioning of UI elements explicitly specified? [Completeness, Spec §FR-1]"
265
+ - "Are interaction state requirements (hover, focus, active) consistently defined? [Consistency]"
266
+ - "Are accessibility requirements specified for all interactive elements? [Coverage, Gap]"
267
+ - "Is fallback behavior defined when images fail to load? [Edge Case, Gap]"
268
+ - "Can 'prominent display' be objectively measured? [Measurability, Spec §FR-4]"
269
+
270
+ **API Requirements Quality:** `api.md`
271
+
272
+ Sample items:
273
+
274
+ - "Are error response formats specified for all failure scenarios? [Completeness]"
275
+ - "Are rate limiting requirements quantified with specific thresholds? [Clarity]"
276
+ - "Are authentication requirements consistent across all endpoints? [Consistency]"
277
+ - "Are retry/timeout requirements defined for external dependencies? [Coverage, Gap]"
278
+ - "Is versioning strategy documented in requirements? [Gap]"
279
+
280
+ **Performance Requirements Quality:** `performance.md`
281
+
282
+ Sample items:
283
+
284
+ - "Are performance requirements quantified with specific metrics? [Clarity]"
285
+ - "Are performance targets defined for all critical user journeys? [Coverage]"
286
+ - "Are performance requirements under different load conditions specified? [Completeness]"
287
+ - "Can performance requirements be objectively measured? [Measurability]"
288
+ - "Are degradation requirements defined for high-load scenarios? [Edge Case, Gap]"
289
+
290
+ **Security Requirements Quality:** `security.md`
291
+
292
+ Sample items:
293
+
294
+ - "Are authentication requirements specified for all protected resources? [Coverage]"
295
+ - "Are data protection requirements defined for sensitive information? [Completeness]"
296
+ - "Is the threat model documented and requirements aligned to it? [Traceability]"
297
+ - "Are security requirements consistent with compliance obligations? [Consistency]"
298
+ - "Are security failure/breach response requirements defined? [Gap, Exception Flow]"
299
+
300
+ ## Anti-Examples: What NOT To Do
301
+
302
+ **❌ WRONG - These test implementation, not requirements:**
303
+
304
+ ```markdown
305
+ - [ ] CHK001 - Verify landing page displays 3 episode cards [Spec §FR-001]
306
+ - [ ] CHK002 - Test hover states work correctly on desktop [Spec §FR-003]
307
+ - [ ] CHK003 - Confirm logo click navigates to home page [Spec §FR-010]
308
+ - [ ] CHK004 - Check that related episodes section shows 3-5 items [Spec §FR-005]
309
+ ```
310
+
311
+ **✅ CORRECT - These test requirements quality:**
312
+
313
+ ```markdown
314
+ - [ ] CHK001 - Are the number and layout of featured episodes explicitly specified? [Completeness, Spec §FR-001]
315
+ - [ ] CHK002 - Are hover state requirements consistently defined for all interactive elements? [Consistency, Spec §FR-003]
316
+ - [ ] CHK003 - Are navigation requirements clear for all clickable brand elements? [Clarity, Spec §FR-010]
317
+ - [ ] CHK004 - Is the selection criteria for related episodes documented? [Gap, Spec §FR-005]
318
+ - [ ] CHK005 - Are loading state requirements defined for asynchronous episode data? [Gap]
319
+ - [ ] CHK006 - Can "visual hierarchy" requirements be objectively measured? [Measurability, Spec §FR-001]
320
+ ```
321
+
322
+ **Key Differences:**
323
+
324
+ - Wrong: Tests if the system works correctly
325
+ - Correct: Tests if the requirements are written correctly
326
+ - Wrong: Verification of behavior
327
+ - Correct: Validation of requirement quality
328
+ - Wrong: "Does it do X?"
329
+ - Correct: "Is X clearly specified?"
330
+
331
+ ## Post-Execution Checks
332
+
333
+ **Check for extension hooks (after checklist generation)**:
334
+ Check if `.specify/extensions.yml` exists in the project root.
335
+ - If it exists, read it and look for entries under the `hooks.after_checklist` key
336
+ - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
337
+ - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
338
+ - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
339
+ - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
340
+ - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
341
+ - For each executable hook, output the following based on its `optional` flag:
342
+ - **Optional hook** (`optional: true`):
343
+ ```
344
+ ## Extension Hooks
345
+
346
+ **Optional Hook**: {extension}
347
+ Command: `/{command}`
348
+ Description: {description}
349
+
350
+ Prompt: {prompt}
351
+ To execute: `/{command}`
352
+ ```
353
+ - **Mandatory hook** (`optional: false`):
354
+ ```
355
+ ## Extension Hooks
356
+
357
+ **Automatic Hook**: {extension}
358
+ Executing: `/{command}`
359
+ EXECUTE_COMMAND: {command}
360
+ ```
361
+ - If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
@@ -0,0 +1,247 @@
1
+ ---
2
+ description: Identify underspecified areas in the current feature spec by asking up to 5 highly targeted clarification questions and encoding answers back into the spec.
3
+ handoffs:
4
+ - label: Build Technical Plan
5
+ agent: speckit.plan
6
+ prompt: Create a plan for the spec. I am building with...
7
+ ---
8
+
9
+ ## User Input
10
+
11
+ ```text
12
+ $ARGUMENTS
13
+ ```
14
+
15
+ You **MUST** consider the user input before proceeding (if not empty).
16
+
17
+ ## Pre-Execution Checks
18
+
19
+ **Check for extension hooks (before clarification)**:
20
+ - Check if `.specify/extensions.yml` exists in the project root.
21
+ - If it exists, read it and look for entries under the `hooks.before_clarify` key
22
+ - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
23
+ - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
24
+ - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
25
+ - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
26
+ - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
27
+ - For each executable hook, output the following based on its `optional` flag:
28
+ - **Optional hook** (`optional: true`):
29
+ ```
30
+ ## Extension Hooks
31
+
32
+ **Optional Pre-Hook**: {extension}
33
+ Command: `/{command}`
34
+ Description: {description}
35
+
36
+ Prompt: {prompt}
37
+ To execute: `/{command}`
38
+ ```
39
+ - **Mandatory hook** (`optional: false`):
40
+ ```
41
+ ## Extension Hooks
42
+
43
+ **Automatic Pre-Hook**: {extension}
44
+ Executing: `/{command}`
45
+ EXECUTE_COMMAND: {command}
46
+
47
+ Wait for the result of the hook command before proceeding to the Outline.
48
+ ```
49
+ - If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
50
+
51
+ ## Outline
52
+
53
+ Goal: Detect and reduce ambiguity or missing decision points in the active feature specification and record the clarifications directly in the spec file.
54
+
55
+ Note: This clarification workflow is expected to run (and be completed) BEFORE invoking `/speckit.plan`. If the user explicitly states they are skipping clarification (e.g., exploratory spike), you may proceed, but must warn that downstream rework risk increases.
56
+
57
+ Execution steps:
58
+
59
+ 1. Run `.specify/scripts/bash/check-prerequisites.sh --json --paths-only` from repo root **once** (combined `--json --paths-only` mode / `-Json -PathsOnly`). Parse minimal JSON payload fields:
60
+ - `FEATURE_DIR`
61
+ - `FEATURE_SPEC`
62
+ - (Optionally capture `IMPL_PLAN`, `TASKS` for future chained flows.)
63
+ - If JSON parsing fails, abort and instruct user to re-run `/speckit.specify` or verify feature branch environment.
64
+ - 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").
65
+
66
+ 2. Load the current spec file. Perform a structured ambiguity & coverage scan using this taxonomy. For each category, mark status: Clear / Partial / Missing. Produce an internal coverage map used for prioritization (do not output raw map unless no questions will be asked).
67
+
68
+ Functional Scope & Behavior:
69
+ - Core user goals & success criteria
70
+ - Explicit out-of-scope declarations
71
+ - User roles / personas differentiation
72
+
73
+ Domain & Data Model:
74
+ - Entities, attributes, relationships
75
+ - Identity & uniqueness rules
76
+ - Lifecycle/state transitions
77
+ - Data volume / scale assumptions
78
+
79
+ Interaction & UX Flow:
80
+ - Critical user journeys / sequences
81
+ - Error/empty/loading states
82
+ - Accessibility or localization notes
83
+
84
+ Non-Functional Quality Attributes:
85
+ - Performance (latency, throughput targets)
86
+ - Scalability (horizontal/vertical, limits)
87
+ - Reliability & availability (uptime, recovery expectations)
88
+ - Observability (logging, metrics, tracing signals)
89
+ - Security & privacy (authN/Z, data protection, threat assumptions)
90
+ - Compliance / regulatory constraints (if any)
91
+
92
+ Integration & External Dependencies:
93
+ - External services/APIs and failure modes
94
+ - Data import/export formats
95
+ - Protocol/versioning assumptions
96
+
97
+ Edge Cases & Failure Handling:
98
+ - Negative scenarios
99
+ - Rate limiting / throttling
100
+ - Conflict resolution (e.g., concurrent edits)
101
+
102
+ Constraints & Tradeoffs:
103
+ - Technical constraints (language, storage, hosting)
104
+ - Explicit tradeoffs or rejected alternatives
105
+
106
+ Terminology & Consistency:
107
+ - Canonical glossary terms
108
+ - Avoided synonyms / deprecated terms
109
+
110
+ Completion Signals:
111
+ - Acceptance criteria testability
112
+ - Measurable Definition of Done style indicators
113
+
114
+ Misc / Placeholders:
115
+ - TODO markers / unresolved decisions
116
+ - Ambiguous adjectives ("robust", "intuitive") lacking quantification
117
+
118
+ For each category with Partial or Missing status, add a candidate question opportunity unless:
119
+ - Clarification would not materially change implementation or validation strategy
120
+ - Information is better deferred to planning phase (note internally)
121
+
122
+ 3. Generate (internally) a prioritized queue of candidate clarification questions (maximum 5). Do NOT output them all at once. Apply these constraints:
123
+ - Maximum of 5 total questions across the whole session.
124
+ - Each question must be answerable with EITHER:
125
+ - A short multiple‑choice selection (2–5 distinct, mutually exclusive options), OR
126
+ - A one-word / short‑phrase answer (explicitly constrain: "Answer in <=5 words").
127
+ - Only include questions whose answers materially impact architecture, data modeling, task decomposition, test design, UX behavior, operational readiness, or compliance validation.
128
+ - Ensure category coverage balance: attempt to cover the highest impact unresolved categories first; avoid asking two low-impact questions when a single high-impact area (e.g., security posture) is unresolved.
129
+ - Exclude questions already answered, trivial stylistic preferences, or plan-level execution details (unless blocking correctness).
130
+ - Favor clarifications that reduce downstream rework risk or prevent misaligned acceptance tests.
131
+ - If more than 5 categories remain unresolved, select the top 5 by (Impact * Uncertainty) heuristic.
132
+
133
+ 4. Sequential questioning loop (interactive):
134
+ - Present EXACTLY ONE question at a time.
135
+ - For multiple‑choice questions:
136
+ - **Analyze all options** and determine the **most suitable option** based on:
137
+ - Best practices for the project type
138
+ - Common patterns in similar implementations
139
+ - Risk reduction (security, performance, maintainability)
140
+ - Alignment with any explicit project goals or constraints visible in the spec
141
+ - Present your **recommended option prominently** at the top with clear reasoning (1-2 sentences explaining why this is the best choice).
142
+ - Format as: `**Recommended:** Option [X] - <reasoning>`
143
+ - Then render all options as a Markdown table:
144
+
145
+ | Option | Description |
146
+ |--------|-------------|
147
+ | A | <Option A description> |
148
+ | B | <Option B description> |
149
+ | C | <Option C description> (add D/E as needed up to 5) |
150
+ | Short | Provide a different short answer (<=5 words) (Include only if free-form alternative is appropriate) |
151
+
152
+ - After the table, add: `You can reply with the option letter (e.g., "A"), accept the recommendation by saying "yes" or "recommended", or provide your own short answer.`
153
+ - For short‑answer style (no meaningful discrete options):
154
+ - Provide your **suggested answer** based on best practices and context.
155
+ - Format as: `**Suggested:** <your proposed answer> - <brief reasoning>`
156
+ - Then output: `Format: Short answer (<=5 words). You can accept the suggestion by saying "yes" or "suggested", or provide your own answer.`
157
+ - After the user answers:
158
+ - If the user replies with "yes", "recommended", or "suggested", use your previously stated recommendation/suggestion as the answer.
159
+ - Otherwise, validate the answer maps to one option or fits the <=5 word constraint.
160
+ - If ambiguous, ask for a quick disambiguation (count still belongs to same question; do not advance).
161
+ - Once satisfactory, record it in working memory (do not yet write to disk) and move to the next queued question.
162
+ - Stop asking further questions when:
163
+ - All critical ambiguities resolved early (remaining queued items become unnecessary), OR
164
+ - User signals completion ("done", "good", "no more"), OR
165
+ - You reach 5 asked questions.
166
+ - Never reveal future queued questions in advance.
167
+ - If no valid questions exist at start, immediately report no critical ambiguities.
168
+
169
+ 5. Integration after EACH accepted answer (incremental update approach):
170
+ - Maintain in-memory representation of the spec (loaded once at start) plus the raw file contents.
171
+ - For the first integrated answer in this session:
172
+ - Ensure a `## Clarifications` section exists (create it just after the highest-level contextual/overview section per the spec template if missing).
173
+ - Under it, create (if not present) a `### Session YYYY-MM-DD` subheading for today.
174
+ - Append a bullet line immediately after acceptance: `- Q: <question> → A: <final answer>`.
175
+ - Then immediately apply the clarification to the most appropriate section(s):
176
+ - Functional ambiguity → Update or add a bullet in Functional Requirements.
177
+ - User interaction / actor distinction → Update User Stories or Actors subsection (if present) with clarified role, constraint, or scenario.
178
+ - Data shape / entities → Update Data Model (add fields, types, relationships) preserving ordering; note added constraints succinctly.
179
+ - Non-functional constraint → Add/modify measurable criteria in Success Criteria > Measurable Outcomes (convert vague adjective to metric or explicit target).
180
+ - Edge case / negative flow → Add a new bullet under Edge Cases / Error Handling (or create such subsection if template provides placeholder for it).
181
+ - Terminology conflict → Normalize term across spec; retain original only if necessary by adding `(formerly referred to as "X")` once.
182
+ - If the clarification invalidates an earlier ambiguous statement, replace that statement instead of duplicating; leave no obsolete contradictory text.
183
+ - Save the spec file AFTER each integration to minimize risk of context loss (atomic overwrite).
184
+ - Preserve formatting: do not reorder unrelated sections; keep heading hierarchy intact.
185
+ - Keep each inserted clarification minimal and testable (avoid narrative drift).
186
+
187
+ 6. Validation (performed after EACH write plus final pass):
188
+ - Clarifications session contains exactly one bullet per accepted answer (no duplicates).
189
+ - Total asked (accepted) questions ≤ 5.
190
+ - Updated sections contain no lingering vague placeholders the new answer was meant to resolve.
191
+ - No contradictory earlier statement remains (scan for now-invalid alternative choices removed).
192
+ - Markdown structure valid; only allowed new headings: `## Clarifications`, `### Session YYYY-MM-DD`.
193
+ - Terminology consistency: same canonical term used across all updated sections.
194
+
195
+ 7. Write the updated spec back to `FEATURE_SPEC`.
196
+
197
+ 8. Report completion (after questioning loop ends or early termination):
198
+ - Number of questions asked & answered.
199
+ - Path to updated spec.
200
+ - Sections touched (list names).
201
+ - Coverage summary table listing each taxonomy category with Status: Resolved (was Partial/Missing and addressed), Deferred (exceeds question quota or better suited for planning), Clear (already sufficient), Outstanding (still Partial/Missing but low impact).
202
+ - If any Outstanding or Deferred remain, recommend whether to proceed to `/speckit.plan` or run `/speckit.clarify` again later post-plan.
203
+ - Suggested next command.
204
+
205
+ Behavior rules:
206
+
207
+ - If no meaningful ambiguities found (or all potential questions would be low-impact), respond: "No critical ambiguities detected worth formal clarification." and suggest proceeding.
208
+ - If spec file missing, instruct user to run `/speckit.specify` first (do not create a new spec here).
209
+ - Never exceed 5 total asked questions (clarification retries for a single question do not count as new questions).
210
+ - Avoid speculative tech stack questions unless the absence blocks functional clarity.
211
+ - Respect user early termination signals ("stop", "done", "proceed").
212
+ - If no questions asked due to full coverage, output a compact coverage summary (all categories Clear) then suggest advancing.
213
+ - If quota reached with unresolved high-impact categories remaining, explicitly flag them under Deferred with rationale.
214
+
215
+ Context for prioritization: $ARGUMENTS
216
+
217
+ ## Post-Execution Checks
218
+
219
+ **Check for extension hooks (after clarification)**:
220
+ Check if `.specify/extensions.yml` exists in the project root.
221
+ - If it exists, read it and look for entries under the `hooks.after_clarify` key
222
+ - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
223
+ - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
224
+ - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
225
+ - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
226
+ - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
227
+ - For each executable hook, output the following based on its `optional` flag:
228
+ - **Optional hook** (`optional: true`):
229
+ ```
230
+ ## Extension Hooks
231
+
232
+ **Optional Hook**: {extension}
233
+ Command: `/{command}`
234
+ Description: {description}
235
+
236
+ Prompt: {prompt}
237
+ To execute: `/{command}`
238
+ ```
239
+ - **Mandatory hook** (`optional: false`):
240
+ ```
241
+ ## Extension Hooks
242
+
243
+ **Automatic Hook**: {extension}
244
+ Executing: `/{command}`
245
+ EXECUTE_COMMAND: {command}
246
+ ```
247
+ - If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently