codexspec 0.2.2__tar.gz → 0.3.0__tar.gz

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 (44) hide show
  1. {codexspec-0.2.2 → codexspec-0.3.0}/PKG-INFO +81 -19
  2. {codexspec-0.2.2 → codexspec-0.3.0}/README.md +80 -18
  3. {codexspec-0.2.2 → codexspec-0.3.0}/pyproject.toml +1 -1
  4. codexspec-0.3.0/templates/commands/clarify.md +235 -0
  5. codexspec-0.3.0/templates/commands/constitution.md +170 -0
  6. codexspec-0.3.0/templates/commands/generate-spec.md +104 -0
  7. codexspec-0.3.0/templates/commands/implement-tasks.md +118 -0
  8. codexspec-0.3.0/templates/commands/plan-to-tasks.md +270 -0
  9. codexspec-0.3.0/templates/commands/review-plan.md +253 -0
  10. codexspec-0.3.0/templates/commands/review-spec.md +192 -0
  11. codexspec-0.3.0/templates/commands/review-tasks.md +302 -0
  12. codexspec-0.3.0/templates/commands/spec-to-plan.md +283 -0
  13. codexspec-0.3.0/templates/commands/specify.md +66 -0
  14. codexspec-0.2.2/templates/commands/clarify.md +0 -129
  15. codexspec-0.2.2/templates/commands/constitution.md +0 -90
  16. codexspec-0.2.2/templates/commands/generate-spec.md +0 -66
  17. codexspec-0.2.2/templates/commands/implement-tasks.md +0 -131
  18. codexspec-0.2.2/templates/commands/plan-to-tasks.md +0 -136
  19. codexspec-0.2.2/templates/commands/review-plan.md +0 -127
  20. codexspec-0.2.2/templates/commands/review-spec.md +0 -107
  21. codexspec-0.2.2/templates/commands/review-tasks.md +0 -136
  22. codexspec-0.2.2/templates/commands/spec-to-plan.md +0 -135
  23. codexspec-0.2.2/templates/commands/specify.md +0 -109
  24. {codexspec-0.2.2 → codexspec-0.3.0}/.gitignore +0 -0
  25. {codexspec-0.2.2 → codexspec-0.3.0}/LICENSE +0 -0
  26. {codexspec-0.2.2 → codexspec-0.3.0}/scripts/bash/check-prerequisites.sh +0 -0
  27. {codexspec-0.2.2 → codexspec-0.3.0}/scripts/bash/common.sh +0 -0
  28. {codexspec-0.2.2 → codexspec-0.3.0}/scripts/bash/create-new-feature.sh +0 -0
  29. {codexspec-0.2.2 → codexspec-0.3.0}/scripts/powershell/check-prerequisites.ps1 +0 -0
  30. {codexspec-0.2.2 → codexspec-0.3.0}/scripts/powershell/common.ps1 +0 -0
  31. {codexspec-0.2.2 → codexspec-0.3.0}/scripts/powershell/create-new-feature.ps1 +0 -0
  32. {codexspec-0.2.2 → codexspec-0.3.0}/src/codexspec/__init__.py +0 -0
  33. {codexspec-0.2.2 → codexspec-0.3.0}/src/codexspec/i18n.py +0 -0
  34. {codexspec-0.2.2 → codexspec-0.3.0}/templates/commands/analyze.md +0 -0
  35. {codexspec-0.2.2 → codexspec-0.3.0}/templates/commands/checklist.md +0 -0
  36. {codexspec-0.2.2 → codexspec-0.3.0}/templates/commands/tasks-to-issues.md +0 -0
  37. {codexspec-0.2.2 → codexspec-0.3.0}/templates/docs/checklist-template.md +0 -0
  38. {codexspec-0.2.2 → codexspec-0.3.0}/templates/docs/constitution-template.md +0 -0
  39. {codexspec-0.2.2 → codexspec-0.3.0}/templates/docs/plan-template-detailed.md +0 -0
  40. {codexspec-0.2.2 → codexspec-0.3.0}/templates/docs/plan-template-simple.md +0 -0
  41. {codexspec-0.2.2 → codexspec-0.3.0}/templates/docs/spec-template-detailed.md +0 -0
  42. {codexspec-0.2.2 → codexspec-0.3.0}/templates/docs/spec-template-simple.md +0 -0
  43. {codexspec-0.2.2 → codexspec-0.3.0}/templates/docs/tasks-template-detailed.md +0 -0
  44. {codexspec-0.2.2 → codexspec-0.3.0}/templates/docs/tasks-template-simple.md +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codexspec
3
- Version: 0.2.2
3
+ Version: 0.3.0
4
4
  Summary: CodexSpec - A Spec-Driven Development (SDD) toolkit for Claude Code
5
5
  Project-URL: Homepage, https://github.com/Zts0hg/codexspec
6
6
  Project-URL: Repository, https://github.com/Zts0hg/codexspec
@@ -165,22 +165,30 @@ Use the `/codexspec.constitution` command to create your project's governing pri
165
165
  /codexspec.constitution Create principles focused on code quality, testing standards, and clean architecture
166
166
  ```
167
167
 
168
- ### 3. Create a Specification
168
+ ### 3. Clarify Requirements
169
169
 
170
- Use `/codexspec.specify` to define what you want to build:
170
+ Use `/codexspec.specify` to **explore and clarify** your requirements through interactive Q&A:
171
171
 
172
172
  ```
173
- /codexspec.specify Build a task management application with the following features: create tasks, assign to users, set due dates, and track progress
173
+ /codexspec.specify I want to build a task management application
174
174
  ```
175
175
 
176
- ### 4. Clarify Requirements (Optional but Recommended)
176
+ This command will:
177
+ - Ask clarifying questions to understand your idea
178
+ - Explore edge cases you might not have considered
179
+ - Co-create high-quality requirements through dialogue
180
+ - **NOT** generate files automatically - you stay in control
177
181
 
178
- Use `/codexspec.clarify` to resolve ambiguities before planning:
182
+ ### 4. Generate Specification Document
183
+
184
+ Once requirements are clarified, use `/codexspec.generate-spec` to create the `spec.md` document:
179
185
 
180
186
  ```
181
- /codexspec.clarify
187
+ /codexspec.generate-spec
182
188
  ```
183
189
 
190
+ This command acts as a "requirement compiler" that transforms your clarified requirements into a structured specification document.
191
+
184
192
  ### 5. Create a Technical Plan
185
193
 
186
194
  Use `/codexspec.spec-to-plan` to define how to implement it:
@@ -252,8 +260,8 @@ After initialization, these slash commands are available in Claude Code:
252
260
  | Command | Description |
253
261
  |---------|-------------|
254
262
  | `/codexspec.constitution` | Create or update project governing principles |
255
- | `/codexspec.specify` | Define what you want to build (requirements) |
256
- | `/codexspec.generate-spec` | Generate detailed specification from requirements |
263
+ | `/codexspec.specify` | **Clarify** requirements through interactive Q&A (no file generation) |
264
+ | `/codexspec.generate-spec` | **Generate** `spec.md` document after requirements are clarified |
257
265
  | `/codexspec.spec-to-plan` | Convert specification to technical plan |
258
266
  | `/codexspec.plan-to-tasks` | Break down plan into actionable tasks |
259
267
  | `/codexspec.implement-tasks` | Execute tasks according to breakdown |
@@ -270,7 +278,7 @@ After initialization, these slash commands are available in Claude Code:
270
278
 
271
279
  | Command | Description |
272
280
  |---------|-------------|
273
- | `/codexspec.clarify` | Clarify underspecified areas before planning |
281
+ | `/codexspec.clarify` | Scan existing spec.md for ambiguities and update with clarifications |
274
282
  | `/codexspec.analyze` | Cross-artifact consistency analysis |
275
283
  | `/codexspec.checklist` | Generate quality checklists for requirements |
276
284
  | `/codexspec.tasks-to-issues` | Convert tasks to GitHub issues |
@@ -285,35 +293,88 @@ After initialization, these slash commands are available in Claude Code:
285
293
  │ 1. Constitution ──► Define project principles │
286
294
  │ │ │
287
295
  │ ▼ │
288
- │ 2. Specify ───────► Create feature specification
296
+ │ 2. Specify ───────► Interactive Q&A to clarify
297
+ │ │ requirements (no file created) │
289
298
  │ │ │
290
299
  │ ▼ │
291
- │ 3. Clarify ───────► Resolve ambiguities (optional)
300
+ │ 3. Generate Spec ─► Create spec.md document
301
+ │ │ (user calls explicitly) │
292
302
  │ │ │
293
303
  │ ▼ │
294
304
  │ 4. Review Spec ───► Validate specification │
295
305
  │ │ │
296
306
  │ ▼ │
297
- │ 5. Spec to Plan ──► Create technical plan
307
+ │ 5. Clarify ───────► Resolve ambiguities (optional)
298
308
  │ │ │
299
309
  │ ▼ │
300
- │ 6. Review Plan ───► Validate technical plan
310
+ │ 6. Spec to Plan ──► Create technical plan
301
311
  │ │ │
302
312
  │ ▼ │
303
- │ 7. Plan to Tasks ─► Generate task breakdown
313
+ │ 7. Review Plan ───► Validate technical plan
304
314
  │ │ │
305
315
  │ ▼ │
306
- │ 8. Analyze ───────► Cross-artifact consistency (optional)
316
+ │ 8. Plan to Tasks ─► Generate task breakdown
307
317
  │ │ │
308
318
  │ ▼ │
309
- │ 9. Review Tasks ──► Validate task breakdown
319
+ │ 9. Analyze ───────► Cross-artifact consistency (optional)
310
320
  │ │ │
311
321
  │ ▼ │
312
- │ 10. Implement ─────► Execute implementation
322
+ │ 10. Review Tasks ─► Validate task breakdown
323
+ │ │ │
324
+ │ ▼ │
325
+ │ 11. Implement ─────► Execute implementation │
313
326
  │ │
314
327
  └──────────────────────────────────────────────────────────────┘
315
328
  ```
316
329
 
330
+ ### Key Concept: Requirement Clarification Workflow
331
+
332
+ CodexSpec provides **two distinct clarification commands** for different stages of the workflow:
333
+
334
+ #### specify vs clarify: When to Use Which?
335
+
336
+ | Aspect | `/codexspec.specify` | `/codexspec.clarify` |
337
+ |--------|----------------------|----------------------|
338
+ | **Purpose** | Initial requirement exploration | Iterative refinement of existing spec |
339
+ | **When to Use** | Starting with a new idea, no spec.md exists | spec.md exists, need to fill gaps |
340
+ | **Input** | Your initial idea or requirement | Existing spec.md file |
341
+ | **Output** | None (dialogue only) | Updates spec.md with clarifications |
342
+ | **Method** | Open-ended Q&A | Structured ambiguity scan (6 categories) |
343
+ | **Question Limit** | Unlimited | Maximum 5 questions |
344
+ | **Typical Use** | "I want to build a todo app" | "The spec is missing error handling details" |
345
+
346
+ #### Two-Phase Specification
347
+
348
+ Before generating any documentation:
349
+
350
+ | Phase | Command | Purpose | Output |
351
+ |-------|---------|---------|--------|
352
+ | **Explore** | `/codexspec.specify` | Interactive Q&A to explore and refine requirements | None (dialogue only) |
353
+ | **Generate** | `/codexspec.generate-spec` | Compile clarified requirements into structured document | `spec.md` |
354
+
355
+ #### Iterative Clarification
356
+
357
+ After spec.md is created:
358
+
359
+ ```
360
+ spec.md ──► /codexspec.clarify ──► Updated spec.md (with Clarifications section)
361
+
362
+ └── Scans for ambiguities in 6 categories:
363
+ • Functional Scope & Behavior
364
+ • Domain & Data Model
365
+ • Interaction & UX Flow
366
+ • Non-Functional Quality Attributes
367
+ • Edge Cases & Failure Handling
368
+ • Conflict Resolution
369
+ ```
370
+
371
+ #### Benefits of This Design
372
+
373
+ - **Human-AI collaboration**: You actively participate in requirement discovery
374
+ - **Explicit control**: Files are only created when you decide
375
+ - **Quality focus**: Requirements are thoroughly explored before documentation
376
+ - **Iterative refinement**: Specs can be improved incrementally as understanding deepens
377
+
317
378
  ## Project Structure
318
379
 
319
380
  After initialization, your project will have this structure:
@@ -485,7 +546,8 @@ CodexSpec is inspired by GitHub's spec-kit but with some key differences:
485
546
  | CLI Name | `specify` | `codexspec` |
486
547
  | Primary AI | Multi-agent support | Claude Code focused |
487
548
  | Command Prefix | `/speckit.*` | `/codexspec.*` |
488
- | Workflow | specify → plan → tasks → implement | constitution → specify → clarify → plan → tasks → analyze → implement |
549
+ | Workflow | specify → plan → tasks → implement | constitution → specify → generate-spec → plan → tasks → analyze → implement |
550
+ | Two-Phase Spec | No | Yes (clarify + generate) |
489
551
  | Review Steps | Optional | Built-in review commands |
490
552
  | Clarify Command | Yes | Yes |
491
553
  | Analyze Command | Yes | Yes |
@@ -132,22 +132,30 @@ Use the `/codexspec.constitution` command to create your project's governing pri
132
132
  /codexspec.constitution Create principles focused on code quality, testing standards, and clean architecture
133
133
  ```
134
134
 
135
- ### 3. Create a Specification
135
+ ### 3. Clarify Requirements
136
136
 
137
- Use `/codexspec.specify` to define what you want to build:
137
+ Use `/codexspec.specify` to **explore and clarify** your requirements through interactive Q&A:
138
138
 
139
139
  ```
140
- /codexspec.specify Build a task management application with the following features: create tasks, assign to users, set due dates, and track progress
140
+ /codexspec.specify I want to build a task management application
141
141
  ```
142
142
 
143
- ### 4. Clarify Requirements (Optional but Recommended)
143
+ This command will:
144
+ - Ask clarifying questions to understand your idea
145
+ - Explore edge cases you might not have considered
146
+ - Co-create high-quality requirements through dialogue
147
+ - **NOT** generate files automatically - you stay in control
144
148
 
145
- Use `/codexspec.clarify` to resolve ambiguities before planning:
149
+ ### 4. Generate Specification Document
150
+
151
+ Once requirements are clarified, use `/codexspec.generate-spec` to create the `spec.md` document:
146
152
 
147
153
  ```
148
- /codexspec.clarify
154
+ /codexspec.generate-spec
149
155
  ```
150
156
 
157
+ This command acts as a "requirement compiler" that transforms your clarified requirements into a structured specification document.
158
+
151
159
  ### 5. Create a Technical Plan
152
160
 
153
161
  Use `/codexspec.spec-to-plan` to define how to implement it:
@@ -219,8 +227,8 @@ After initialization, these slash commands are available in Claude Code:
219
227
  | Command | Description |
220
228
  |---------|-------------|
221
229
  | `/codexspec.constitution` | Create or update project governing principles |
222
- | `/codexspec.specify` | Define what you want to build (requirements) |
223
- | `/codexspec.generate-spec` | Generate detailed specification from requirements |
230
+ | `/codexspec.specify` | **Clarify** requirements through interactive Q&A (no file generation) |
231
+ | `/codexspec.generate-spec` | **Generate** `spec.md` document after requirements are clarified |
224
232
  | `/codexspec.spec-to-plan` | Convert specification to technical plan |
225
233
  | `/codexspec.plan-to-tasks` | Break down plan into actionable tasks |
226
234
  | `/codexspec.implement-tasks` | Execute tasks according to breakdown |
@@ -237,7 +245,7 @@ After initialization, these slash commands are available in Claude Code:
237
245
 
238
246
  | Command | Description |
239
247
  |---------|-------------|
240
- | `/codexspec.clarify` | Clarify underspecified areas before planning |
248
+ | `/codexspec.clarify` | Scan existing spec.md for ambiguities and update with clarifications |
241
249
  | `/codexspec.analyze` | Cross-artifact consistency analysis |
242
250
  | `/codexspec.checklist` | Generate quality checklists for requirements |
243
251
  | `/codexspec.tasks-to-issues` | Convert tasks to GitHub issues |
@@ -252,35 +260,88 @@ After initialization, these slash commands are available in Claude Code:
252
260
  │ 1. Constitution ──► Define project principles │
253
261
  │ │ │
254
262
  │ ▼ │
255
- │ 2. Specify ───────► Create feature specification
263
+ │ 2. Specify ───────► Interactive Q&A to clarify
264
+ │ │ requirements (no file created) │
256
265
  │ │ │
257
266
  │ ▼ │
258
- │ 3. Clarify ───────► Resolve ambiguities (optional)
267
+ │ 3. Generate Spec ─► Create spec.md document
268
+ │ │ (user calls explicitly) │
259
269
  │ │ │
260
270
  │ ▼ │
261
271
  │ 4. Review Spec ───► Validate specification │
262
272
  │ │ │
263
273
  │ ▼ │
264
- │ 5. Spec to Plan ──► Create technical plan
274
+ │ 5. Clarify ───────► Resolve ambiguities (optional)
265
275
  │ │ │
266
276
  │ ▼ │
267
- │ 6. Review Plan ───► Validate technical plan
277
+ │ 6. Spec to Plan ──► Create technical plan
268
278
  │ │ │
269
279
  │ ▼ │
270
- │ 7. Plan to Tasks ─► Generate task breakdown
280
+ │ 7. Review Plan ───► Validate technical plan
271
281
  │ │ │
272
282
  │ ▼ │
273
- │ 8. Analyze ───────► Cross-artifact consistency (optional)
283
+ │ 8. Plan to Tasks ─► Generate task breakdown
274
284
  │ │ │
275
285
  │ ▼ │
276
- │ 9. Review Tasks ──► Validate task breakdown
286
+ │ 9. Analyze ───────► Cross-artifact consistency (optional)
277
287
  │ │ │
278
288
  │ ▼ │
279
- │ 10. Implement ─────► Execute implementation
289
+ │ 10. Review Tasks ─► Validate task breakdown
290
+ │ │ │
291
+ │ ▼ │
292
+ │ 11. Implement ─────► Execute implementation │
280
293
  │ │
281
294
  └──────────────────────────────────────────────────────────────┘
282
295
  ```
283
296
 
297
+ ### Key Concept: Requirement Clarification Workflow
298
+
299
+ CodexSpec provides **two distinct clarification commands** for different stages of the workflow:
300
+
301
+ #### specify vs clarify: When to Use Which?
302
+
303
+ | Aspect | `/codexspec.specify` | `/codexspec.clarify` |
304
+ |--------|----------------------|----------------------|
305
+ | **Purpose** | Initial requirement exploration | Iterative refinement of existing spec |
306
+ | **When to Use** | Starting with a new idea, no spec.md exists | spec.md exists, need to fill gaps |
307
+ | **Input** | Your initial idea or requirement | Existing spec.md file |
308
+ | **Output** | None (dialogue only) | Updates spec.md with clarifications |
309
+ | **Method** | Open-ended Q&A | Structured ambiguity scan (6 categories) |
310
+ | **Question Limit** | Unlimited | Maximum 5 questions |
311
+ | **Typical Use** | "I want to build a todo app" | "The spec is missing error handling details" |
312
+
313
+ #### Two-Phase Specification
314
+
315
+ Before generating any documentation:
316
+
317
+ | Phase | Command | Purpose | Output |
318
+ |-------|---------|---------|--------|
319
+ | **Explore** | `/codexspec.specify` | Interactive Q&A to explore and refine requirements | None (dialogue only) |
320
+ | **Generate** | `/codexspec.generate-spec` | Compile clarified requirements into structured document | `spec.md` |
321
+
322
+ #### Iterative Clarification
323
+
324
+ After spec.md is created:
325
+
326
+ ```
327
+ spec.md ──► /codexspec.clarify ──► Updated spec.md (with Clarifications section)
328
+
329
+ └── Scans for ambiguities in 6 categories:
330
+ • Functional Scope & Behavior
331
+ • Domain & Data Model
332
+ • Interaction & UX Flow
333
+ • Non-Functional Quality Attributes
334
+ • Edge Cases & Failure Handling
335
+ • Conflict Resolution
336
+ ```
337
+
338
+ #### Benefits of This Design
339
+
340
+ - **Human-AI collaboration**: You actively participate in requirement discovery
341
+ - **Explicit control**: Files are only created when you decide
342
+ - **Quality focus**: Requirements are thoroughly explored before documentation
343
+ - **Iterative refinement**: Specs can be improved incrementally as understanding deepens
344
+
284
345
  ## Project Structure
285
346
 
286
347
  After initialization, your project will have this structure:
@@ -452,7 +513,8 @@ CodexSpec is inspired by GitHub's spec-kit but with some key differences:
452
513
  | CLI Name | `specify` | `codexspec` |
453
514
  | Primary AI | Multi-agent support | Claude Code focused |
454
515
  | Command Prefix | `/speckit.*` | `/codexspec.*` |
455
- | Workflow | specify → plan → tasks → implement | constitution → specify → clarify → plan → tasks → analyze → implement |
516
+ | Workflow | specify → plan → tasks → implement | constitution → specify → generate-spec → plan → tasks → analyze → implement |
517
+ | Two-Phase Spec | No | Yes (clarify + generate) |
456
518
  | Review Steps | Optional | Built-in review commands |
457
519
  | Clarify Command | Yes | Yes |
458
520
  | Analyze Command | Yes | Yes |
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "codexspec"
3
- version = "0.2.2"
3
+ version = "0.3.0"
4
4
  description = "CodexSpec - A Spec-Driven Development (SDD) toolkit for Claude Code"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -0,0 +1,235 @@
1
+ ---
2
+ description: Identify underspecified areas in the current feature spec by asking targeted clarification questions and encoding answers back into the spec
3
+ argument-hint: "[path_to_spec.md] (optional, defaults to .codexspec/specs/{feature-id}/)"
4
+ handoffs:
5
+ - agent: claude
6
+ step: Ask clarification questions and update spec
7
+ scripts:
8
+ sh: .codexspec/scripts/check-prerequisites.sh --json --paths-only
9
+ ps: .codexspec/scripts/check-prerequisites.ps1 -Json -PathsOnly
10
+ ---
11
+
12
+ # Specification Clarifier
13
+
14
+ ## Language Preference
15
+
16
+ **IMPORTANT**: Before proceeding, read the project's language configuration from `.codexspec/config.yml`.
17
+ - If `language.output` is set to a language other than "en", respond and generate all content in that language
18
+ - If not configured or set to "en", use English as default
19
+ - Technical terms (e.g., API, JWT, OAuth) may remain in English when appropriate
20
+ - All user-facing messages, questions, and generated documents should use the configured language
21
+
22
+ ## User Input
23
+
24
+ $ARGUMENTS
25
+
26
+ ## Role
27
+
28
+ You are a **Specification Quality Specialist** with expertise in:
29
+ - Requirement analysis and decomposition
30
+ - Ambiguity detection and resolution
31
+ - Acceptance criteria formulation
32
+ - Cross-functional requirement identification
33
+
34
+ Your responsibility is to identify gaps and ambiguities in existing specifications and resolve them through targeted clarification questions.
35
+
36
+ ## When to Use This Command
37
+
38
+ **Use `/codexspec.clarify` when:**
39
+ - A `spec.md` already exists and needs incremental improvement
40
+ - You want to address specific issues identified during review
41
+ - You need to refine requirements before technical planning
42
+ - New information requires updating the specification
43
+
44
+ **Do NOT use this command for:**
45
+ - Initial requirement gathering → Use `/codexspec.specify`
46
+ - Document generation from scratch → Use `/codexspec.generate-spec`
47
+ - Quality assessment without modification → Use `/codexspec.review-spec`
48
+
49
+ ## Instructions
50
+
51
+ ### File Resolution
52
+
53
+ - **With argument**: Treat the argument as the path to `spec.md`
54
+ - **Without argument**: Run `{SCRIPT}` from repo root and parse JSON for:
55
+ - `FEATURE_DIR` - The feature directory path
56
+ - `FEATURE_SPEC` - Path to spec.md
57
+
58
+ If no valid spec.md is found, abort and instruct user to run `/codexspec.generate-spec` first.
59
+
60
+ ### Execution Steps
61
+
62
+ #### 1. Initialize Context & Load Review Findings
63
+
64
+ Load and analyze:
65
+ - The feature specification from the located path
66
+
67
+ **Review-Spec Integration** (if `review-spec.md` exists in the same directory as `spec.md`):
68
+ - Read the review findings
69
+ - Prioritize questions based on issues marked as "Critical" or "Warning"
70
+ - Reference the review in your introduction: "Based on recent review findings..."
71
+
72
+ This ensures clarification addresses known quality issues first.
73
+
74
+ #### 2. Ambiguity & Coverage Scan
75
+
76
+ Scan the specification using these **4 focused categories**:
77
+
78
+ | Category | What to Look For |
79
+ |----------|-----------------|
80
+ | **Completeness Gaps** | Missing sections, empty content, unnumbered requirements, absent acceptance criteria |
81
+ | **Specificity Issues** | Vague terms ("fast", "scalable", "user-friendly"), undefined technical terms, missing constraints or boundaries |
82
+ | **Behavioral Clarity** | Error handling gaps, undefined state transitions, edge cases without expected behavior |
83
+ | **Measurability Problems** | Non-functional requirements without metrics, untestable acceptance criteria, subjective quality standards |
84
+
85
+ #### 3. Generate Clarification Questions
86
+
87
+ Create a prioritized queue of **maximum 5 questions**:
88
+ - Questions must be answerable with multiple-choice (2-4 options) OR a short answer (≤5 words)
89
+ - Only include questions whose answers materially impact implementation
90
+ - Ensure category coverage balance
91
+ - Prioritize questions addressing Critical/Warning issues from review-spec.md (if exists)
92
+
93
+ #### 4. Sequential Questioning Loop
94
+
95
+ Present **EXACTLY ONE** question at a time.
96
+
97
+ **For Multiple-Choice Questions:**
98
+
99
+ ```markdown
100
+ ## Question [N/M]: [Category]
101
+
102
+ **Context**: [Quote the relevant section from spec.md that needs clarification]
103
+
104
+ **Question**: [Clear, specific question]
105
+
106
+ | Option | Description | Impact |
107
+ |--------|-------------|--------|
108
+ | A | [Option description] | [How this choice affects implementation] |
109
+ | B | [Option description] | [How this choice affects implementation] |
110
+ | Custom | Provide a different answer | - |
111
+
112
+ **Recommendation**: Option [X] - [Brief reasoning for recommendation]
113
+ ```
114
+
115
+ Note: Use only as many options (A, B, C, D) as needed (2-4), plus "Custom".
116
+
117
+ **For Short-Answer Questions:**
118
+
119
+ ```markdown
120
+ ## Question [N/M]: [Category]
121
+
122
+ **Context**: [Quote the relevant section from spec.md that needs clarification]
123
+
124
+ **Question**: [Clear, specific question]
125
+
126
+ **Format**: Short answer, maximum 5 words
127
+
128
+ **Suggestion**: [Proposed answer with reasoning]
129
+ ```
130
+
131
+ #### 5. Integration After Each Answer
132
+
133
+ After the user provides an answer:
134
+
135
+ 1. **Update Clarifications Section** in spec.md:
136
+ ```markdown
137
+ ## Clarifications
138
+
139
+ ### Session [YYYY-MM-DD HH:MM]
140
+
141
+ **Q1**: [Question asked]
142
+ **A1**: [User's answer]
143
+ **Impact**: [Which requirements/sections are affected]
144
+
145
+ ---
146
+ ```
147
+
148
+ 2. **Apply to Relevant Sections**: Update Functional Requirements, Non-Functional Requirements, Edge Cases, etc. based on the answer
149
+
150
+ 3. **Save Immediately**: Write all changes to `spec.md`
151
+
152
+ #### 6. User Control Commands
153
+
154
+ During questioning, support these commands:
155
+ | Command | Action | Saved Answers |
156
+ |---------|--------|---------------|
157
+ | `skip` | Skip current question, move to next | Already saved |
158
+ | `done` | End session early, generate report | Already saved |
159
+ | `stop` | End session immediately, no report | Already saved |
160
+
161
+ All previously answered questions are saved to spec.md regardless of how the session ends.
162
+
163
+ #### 7. Completion Report
164
+
165
+ After the session ends (all questions answered, or user used `done`), output this report to the console (do NOT save to a file):
166
+
167
+ ```markdown
168
+ # Clarification Session Report
169
+
170
+ ## Summary
171
+ - **Specification**: {feature-id}/spec.md
172
+ - **Session Date**: {YYYY-MM-DD HH:MM}
173
+ - **Questions Asked**: X/5
174
+ - **Questions Answered**: Y
175
+ - **Questions Skipped**: Z
176
+
177
+ ## Modifications
178
+
179
+ | Section | Changes Made | Requirements Affected |
180
+ |---------|--------------|----------------------|
181
+ | [Section name] | [Brief description] | REQ-001, REQ-002 |
182
+ | [Section name] | [Brief description] | NFR-001 |
183
+
184
+ ## Requirements Impact
185
+
186
+ ### Added
187
+ - [REQ-XXX]: [New requirement description]
188
+
189
+ ### Modified
190
+ - [REQ-XXX]: [What changed]
191
+
192
+ ### Clarified (No structural change)
193
+ - [REQ-XXX]: [What was clarified]
194
+
195
+ ## Quality Improvement
196
+
197
+ | Metric | Before | After |
198
+ |--------|--------|-------|
199
+ | Completeness | X% | Y% |
200
+ | Specificity | X% | Y% |
201
+ | Behavioral Clarity | X% | Y% |
202
+ | Measurability | X% | Y% |
203
+
204
+ ## Deferred Items
205
+
206
+ The following areas were identified but not addressed (question quota reached):
207
+ - [ ] [Category]: [Specific issue description]
208
+ - [ ] [Category]: [Specific issue description]
209
+
210
+ ## Available Follow-up Commands
211
+
212
+ Based on the clarification session, the user may consider:
213
+ - `/codexspec.review-spec` - to validate the improvements made
214
+ - `/codexspec.spec-to-plan` - to proceed with technical planning
215
+ - `/codexspec.clarify` - to address deferred items in another session
216
+ ```
217
+
218
+ ## Behavior Rules
219
+
220
+ 1. **Maximum 5 Questions**: Never exceed the question limit
221
+ 2. **Save After Each Answer**: Immediately persist all changes to `spec.md` - the Clarifications section and any updated requirement sections
222
+ 3. **No Meaningful Ambiguities**: If scan finds no critical issues, output: "No critical ambiguities detected. The specification appears sufficiently clear for technical planning." and suggest `/codexspec.spec-to-plan`
223
+ 4. **Deferred Tracking**: If quota is reached with unresolved high-impact items, list them in the completion report under Deferred Items
224
+ 5. **Review Integration**: If review-spec.md exists, always mention it in your introduction and prioritize its Critical/Warning issues
225
+
226
+ ## Workflow Position
227
+
228
+ ```
229
+ specify → generate-spec → [clarify] → review-spec → spec-to-plan
230
+ ↑______________|
231
+ (iterative)
232
+ ```
233
+
234
+ > [!NOTE]
235
+ > This command is designed to run AFTER `/codexspec.generate-spec` and BEFORE `/codexspec.spec-to-plan`. It incrementally improves existing specifications rather than creating new ones.