aw-spec-cli 0.1.1 → 0.1.3

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 (71) hide show
  1. package/assets/.agents/skills/aw-spec-addcomponent/SKILL.md +18 -5
  2. package/assets/.agents/skills/aw-spec-analyze/SKILL.md +4 -0
  3. package/assets/.agents/skills/aw-spec-clarify/SKILL.md +4 -0
  4. package/assets/.agents/skills/aw-spec-constitution/SKILL.md +4 -0
  5. package/assets/.agents/skills/aw-spec-fast-implement/SKILL.md +268 -0
  6. package/assets/.agents/skills/aw-spec-foundation/SKILL.md +219 -49
  7. package/assets/.agents/skills/aw-spec-implement/SKILL.md +11 -0
  8. package/assets/.agents/skills/aw-spec-minimal-implementation/SKILL.md +209 -0
  9. package/assets/.agents/skills/aw-spec-plan/SKILL.md +4 -0
  10. package/assets/.agents/skills/aw-spec-specify/SKILL.md +4 -0
  11. package/assets/.agents/skills/aw-spec-tasks/SKILL.md +4 -0
  12. package/assets/.claude/skills/aw-spec-addcomponent/SKILL.md +18 -5
  13. package/assets/.claude/skills/aw-spec-analyze/SKILL.md +4 -0
  14. package/assets/.claude/skills/aw-spec-clarify/SKILL.md +4 -0
  15. package/assets/.claude/skills/aw-spec-constitution/SKILL.md +4 -0
  16. package/assets/.claude/skills/aw-spec-fast-implement/SKILL.md +268 -0
  17. package/assets/.claude/skills/aw-spec-foundation/SKILL.md +219 -49
  18. package/assets/.claude/skills/aw-spec-implement/SKILL.md +11 -0
  19. package/assets/.claude/skills/aw-spec-minimal-implementation/SKILL.md +209 -0
  20. package/assets/.claude/skills/aw-spec-plan/SKILL.md +4 -0
  21. package/assets/.claude/skills/aw-spec-specify/SKILL.md +4 -0
  22. package/assets/.claude/skills/aw-spec-tasks/SKILL.md +4 -0
  23. package/assets/.kilocode/rules/specify-rules.md +4 -0
  24. package/assets/.kilocode/workflows/aw-spec-addcomponent.md +129 -0
  25. package/assets/.kilocode/workflows/aw-spec-agent-context.update.md +31 -0
  26. package/assets/.kilocode/workflows/aw-spec-analyze.md +296 -0
  27. package/assets/.kilocode/workflows/aw-spec-checklist.md +374 -0
  28. package/assets/.kilocode/workflows/aw-spec-clarify.md +320 -0
  29. package/assets/.kilocode/workflows/aw-spec-constitution.md +194 -0
  30. package/assets/.kilocode/workflows/aw-spec-fast-implement.md +263 -0
  31. package/assets/.kilocode/workflows/aw-spec-foundation.md +358 -0
  32. package/assets/.kilocode/workflows/aw-spec-implement.md +279 -0
  33. package/assets/.kilocode/workflows/aw-spec-minimal-implementation.md +204 -0
  34. package/assets/.kilocode/workflows/aw-spec-plan.md +221 -0
  35. package/assets/.kilocode/workflows/aw-spec-select-domain.md +73 -0
  36. package/assets/.kilocode/workflows/aw-spec-specify.md +382 -0
  37. package/assets/.kilocode/workflows/aw-spec-tasks.md +259 -0
  38. package/assets/.kilocode/workflows/aw-spec-taskstoissues.md +107 -0
  39. package/assets/docs/ModularMonolith/ModularMonolith.Reference.pack.txt +25248 -0
  40. package/assets/docs/ModularMonolith/ModularMonolith.pack.txt +5726 -0
  41. package/assets/docs/ModularMonolith/pack-foundation.ps1 +145 -0
  42. package/assets/docs/ModularMonolith/pack-foundation.sh +196 -0
  43. package/assets/docs/ModularMonolith/pack-reference-foundation.ps1 +157 -0
  44. package/assets/docs/ModularMonolith/pack-reference-foundation.sh +209 -0
  45. package/assets/docs/ModularMonolith/unpack-foundation.ps1 +126 -0
  46. package/assets/docs/ModularMonolith/unpack-foundation.sh +217 -0
  47. package/assets/docs/ModularMonolith/unpack-reference-foundation.ps1 +129 -0
  48. package/assets/docs/ModularMonolith/unpack-reference-foundation.sh +218 -0
  49. package/assets/docs/VerticalSlice/VerticalSlice.Reference.pack.txt +19318 -0
  50. package/assets/docs/VerticalSlice/pack-reference-foundation.ps1 +157 -0
  51. package/assets/docs/VerticalSlice/pack-reference-foundation.sh +209 -0
  52. package/assets/docs/VerticalSlice/unpack-reference-foundation.ps1 +129 -0
  53. package/assets/docs/VerticalSlice/unpack-reference-foundation.sh +218 -0
  54. package/assets/docs/components/Email/README.md +7 -0
  55. package/assets/docs/components/Email/ReferenceEndpoints/SendEmailEndpoint.cs +84 -0
  56. package/assets/docs/components/Email/integration.md +57 -17
  57. package/assets/docs/components/Jobs/integration.md +29 -15
  58. package/assets/docs/components/QrGenerator/README.md +7 -0
  59. package/assets/docs/components/QrGenerator/ReferenceEndpoints/GenerateQrEndpoint.cs +57 -0
  60. package/assets/docs/components/QrGenerator/integration.md +51 -6
  61. package/assets/docs/components/README.md +19 -2
  62. package/assets/docs/domainspecs/healthcare/comandrulemap.md +47 -0
  63. package/assets/docs/domainspecs/pharma/comandrulemap.md +50 -0
  64. package/dist/commands/init.d.ts.map +1 -1
  65. package/dist/commands/init.js +3 -2
  66. package/dist/commands/init.js.map +1 -1
  67. package/dist/utils/copy-assets.d.ts +8 -1
  68. package/dist/utils/copy-assets.d.ts.map +1 -1
  69. package/dist/utils/copy-assets.js +1 -0
  70. package/dist/utils/copy-assets.js.map +1 -1
  71. package/package.json +5 -2
@@ -0,0 +1,296 @@
1
+ ---
2
+ name: "aw-spec-analyze"
3
+ description: "Perform a non-destructive cross-artifact consistency and quality analysis across spec.md, plan.md, and tasks.md after task generation."
4
+ argument-hint: "Optional focus areas for analysis"
5
+ compatibility: "Requires aw-spec project structure with .aw-spec/ directory"
6
+ metadata:
7
+ author: "github-aw-spec"
8
+ source: "templates/commands/analyze.md"
9
+ user-invocable: true
10
+ disable-model-invocation: false
11
+ ---
12
+
13
+
14
+ ## User Input
15
+
16
+ ```text
17
+ $ARGUMENTS
18
+ ```
19
+
20
+ You **MUST** consider the user input before proceeding (if not empty).
21
+
22
+ ## Context Reuse (cross-command dedup)
23
+
24
+ **Skip Read-ing any file already in this conversation.** Before loading a standards/domain/template/spec file this command names, check whether it is already in context (loaded earlier here or by a prior `/aw-spec-*` command). If present and unchanged, reuse it and **skip the Read** — only Read files not yet loaded. A file already in context still counts as loaded; this just avoids the redundant re-read.
25
+
26
+ ## Auto-Loaded Engineering Standards (Required Context)
27
+
28
+ **Before doing anything else in this command, load the project engineering-standards files listed below into context using the Read tool.** These were previously supplied manually as `@docs/...` mentions; they are now loaded automatically so the user does not need to pass them. Rules:
29
+
30
+ - Read each file below **before** starting the Pre-Execution Checks / analysis. Treat their contents as authoritative engineering standards for this command, second only to `.aw-spec/memory/constitution.md`.
31
+ - If a listed file does not exist, skip it silently and continue — do **not** error and do **not** ask the user to provide it.
32
+ - This is the **domain-agnostic technical** set, so the framework is reusable across domains. Domain-specific rule files (e.g. healthcare FHIR/HL7/PHI) are **not** part of this set — they are offered separately in the **Domain Rule-File Selection** section below (sourced from `comandrulemap.md`). You can also add any extra file directly with an `@` mention.
33
+
34
+ Standards for `/aw-spec-analyze`:
35
+ - docs/security/auditing.md
36
+ - docs/governance/coding-standards.md
37
+ - docs/glossary/ai-rules.md
38
+
39
+ ## Domain Rule-File Selection (interactive)
40
+
41
+ After the technical standards above are loaded, and **before** the Pre-Execution Checks, resolve the active domain and ask the user which **domain** rule files to load for this command:
42
+
43
+ 1. **Resolve the active domain.** Read `.aw-spec/domain.json` and take its `domain` value — the active domain-specs folder name. The candidate domain rule files are the bullet list under the `## /aw-spec-analyze` heading in `docs/domainspecs/<domain>/comandrulemap.md`.
44
+ 2. **Domain gate (missing domain or rules).** If `.aw-spec/domain.json` is absent or its `domain` is empty, **or** `docs/domainspecs/<domain>/comandrulemap.md` does not exist:
45
+ - Ask one single-select question with the AskUserQuestion tool — *"Domain is not set or its rule files are missing (state which: no domain set / domain '<domain>' has no comandrulemap.md). Continue without domain rules?"* — with options **"Continue (technical only)"** and **"Exit"**.
46
+ - **Continue (technical only)** → skip steps 3-5 and proceed with only the auto-loaded technical standards (plus any `@`-mentioned files).
47
+ - **Exit** → stop the command **immediately** with no side effects: do **not** run the Pre-Execution Checks, hooks, Outline, or any later step, and create/modify nothing. Tell the user to run `/aw-spec-select-domain` (or fix the domain folder) and re-run.
48
+ - If interactive questions cannot be asked (non-interactive/automated run), default to **Continue (technical only)**.
49
+ - Exception: if `comandrulemap.md` exists but has **no entries under this command's heading**, this is **not** a gate trigger — load no domain files for this command and continue normally to the Pre-Execution Checks.
50
+ 3. **Show a selection box** using the AskUserQuestion tool:
51
+ - Ask one single-select question — *"Domain rule files for /aw-spec-analyze:"* — with options **"Select all (recommended)"**, **"Pick a subset"**, and **"None (technical only)"**.
52
+ - If the user chooses **"Pick a subset"**, follow up with **multi-select** questions whose options are the individual candidate files so the user can tick the ones they want. AskUserQuestion allows ≤4 options per question and ≤4 questions per call, so split the candidates into groups of ≤4 (by category: architecture overlays, clinical domain, security overlays, governance overlays, glossary) across as many calls as needed.
53
+ - If interactive questions cannot be asked (non-interactive or automated run), skip the prompt and default to **Select all**.
54
+ 4. **Load the selection.** Read every file the user selected (the full list for "Select all"; nothing extra for "None"). If any selected file does not exist on disk, skip it silently and continue — do not error.
55
+ 5. **Final context set** = the always-loaded technical standards (section above) **+** the domain files selected here **+** any files the user passed via `@` mention in their command. The `@`-mentioned files are always loaded in addition, whether or not they appear in the candidate list, and are never removed by a "None"/subset choice.
56
+ 6. Proceed to the Pre-Execution Checks only after the selected files are loaded.
57
+
58
+ ## Pre-Execution Checks
59
+
60
+ **Check for extension hooks (before analysis)**:
61
+ - Check if `.aw-spec/extensions.yml` exists in the project root.
62
+ - If it exists, read it and look for entries under the `hooks.before_analyze` key
63
+ - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
64
+ - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
65
+ - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
66
+ - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
67
+ - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
68
+ - When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `aw-spec.git.commit` → `/aw-spec-git-commit`.
69
+ - For each executable hook, output the following based on its `optional` flag:
70
+ - **Optional hook** (`optional: true`):
71
+ ```
72
+ ## Extension Hooks
73
+
74
+ **Optional Pre-Hook**: {extension}
75
+ Command: `/{command}`
76
+ Description: {description}
77
+
78
+ Prompt: {prompt}
79
+ To execute: `/{command}`
80
+ ```
81
+ - **Mandatory hook** (`optional: false`):
82
+ ```
83
+ ## Extension Hooks
84
+
85
+ **Automatic Pre-Hook**: {extension}
86
+ Executing: `/{command}`
87
+ EXECUTE_COMMAND: {command}
88
+
89
+ Wait for the result of the hook command before proceeding to the Goal.
90
+ ```
91
+ - If no hooks are registered or `.aw-spec/extensions.yml` does not exist, skip silently
92
+
93
+ ## Goal
94
+
95
+ Identify inconsistencies, duplications, ambiguities, and underspecified items across the three core artifacts (`spec.md`, `plan.md`, `tasks.md`) before implementation. This command MUST run only after `/aw-spec-tasks` has successfully produced a complete `tasks.md`.
96
+
97
+ ## Operating Constraints
98
+
99
+ **STRICTLY READ-ONLY**: Do **not** modify any files. Output a structured analysis report. Offer an optional remediation plan (user must explicitly approve before any follow-up editing commands would be invoked manually).
100
+
101
+ **Constitution Authority**: The project constitution (`.aw-spec/memory/constitution.md`) is **non-negotiable** within this analysis scope. Constitution conflicts are automatically CRITICAL and require adjustment of the spec, plan, or tasks—not dilution, reinterpretation, or silent ignoring of the principle. If a principle itself needs to change, that must occur in a separate, explicit constitution update outside `/aw-spec-analyze`.
102
+
103
+ ## Execution Steps
104
+
105
+ ### 1. Initialize Analysis Context
106
+
107
+ Run `.aw-spec/scripts/bash/check-prerequisites.sh --json --require-tasks --include-tasks` once from repo root and parse JSON for FEATURE_DIR and AVAILABLE_DOCS. Derive absolute paths:
108
+
109
+ - SPEC = FEATURE_DIR/spec.md
110
+ - PLAN = FEATURE_DIR/plan.md
111
+ - TASKS = FEATURE_DIR/tasks.md
112
+
113
+ Abort with an error message if any required file is missing (instruct the user to run missing prerequisite command).
114
+ 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").
115
+
116
+ ### 2. Load Artifacts (Progressive Disclosure)
117
+
118
+ Load only the minimal necessary context from each artifact:
119
+
120
+ **From spec.md:**
121
+
122
+ - Overview/Context
123
+ - Functional Requirements
124
+ - Success Criteria (measurable outcomes — e.g., performance, security, availability, user success, business impact)
125
+ - User Stories
126
+ - Edge Cases (if present)
127
+
128
+ **From plan.md:**
129
+
130
+ - Architecture/stack choices
131
+ - Data Model references
132
+ - Phases
133
+ - Technical constraints
134
+
135
+ **From tasks.md:**
136
+
137
+ - Task IDs
138
+ - Descriptions
139
+ - Phase grouping
140
+ - Parallel markers [P]
141
+ - Referenced file paths
142
+
143
+ **From constitution:**
144
+
145
+ - Load `.aw-spec/memory/constitution.md` for principle validation
146
+
147
+ ### 3. Build Semantic Models
148
+
149
+ Create internal representations (do not include raw artifacts in output):
150
+
151
+ - **Requirements inventory**: For each Functional Requirement (FR-###) and Success Criterion (SC-###), record a stable key. Use the explicit FR-/SC- identifier as the primary key when present, and optionally also derive an imperative-phrase slug for readability (e.g., "User can upload file" → `user-can-upload-file`). Include only Success Criteria items that require buildable work (e.g., load-testing infrastructure, security audit tooling), and exclude post-launch outcome metrics and business KPIs (e.g., "Reduce support tickets by 50%").
152
+ - **User story/action inventory**: Discrete user actions with acceptance criteria
153
+ - **Task coverage mapping**: Map each task to one or more requirements or stories (inference by keyword / explicit reference patterns like IDs or key phrases)
154
+ - **Constitution rule set**: Extract principle names and MUST/SHOULD normative statements
155
+
156
+ ### 4. Detection Passes (Token-Efficient Analysis)
157
+
158
+ Focus on high-signal findings. Limit to 50 findings total; aggregate remainder in overflow summary.
159
+
160
+ #### A. Duplication Detection
161
+
162
+ - Identify near-duplicate requirements
163
+ - Mark lower-quality phrasing for consolidation
164
+
165
+ #### B. Ambiguity Detection
166
+
167
+ - Flag vague adjectives (fast, scalable, secure, intuitive, robust) lacking measurable criteria
168
+ - Flag unresolved placeholders (TODO, TKTK, ???, `<placeholder>`, etc.)
169
+
170
+ #### C. Underspecification
171
+
172
+ - Requirements with verbs but missing object or measurable outcome
173
+ - User stories missing acceptance criteria alignment
174
+ - Tasks referencing files or components not defined in spec/plan
175
+
176
+ #### D. Constitution Alignment
177
+
178
+ - Any requirement or plan element conflicting with a MUST principle
179
+ - Missing mandated sections or quality gates from constitution
180
+
181
+ #### E. Coverage Gaps
182
+
183
+ - Requirements with zero associated tasks
184
+ - Tasks with no mapped requirement/story
185
+ - Success Criteria requiring buildable work (performance, security, availability) not reflected in tasks
186
+
187
+ #### F. Inconsistency
188
+
189
+ - Terminology drift (same concept named differently across files)
190
+ - Data entities referenced in plan but absent in spec (or vice versa)
191
+ - Task ordering contradictions (e.g., integration tasks before foundational setup tasks without dependency note)
192
+ - Conflicting requirements (e.g., one requires Next.js while other specifies Vue)
193
+
194
+ ### 5. Severity Assignment
195
+
196
+ Use this heuristic to prioritize findings:
197
+
198
+ - **CRITICAL**: Violates constitution MUST, missing core spec artifact, or requirement with zero coverage that blocks baseline functionality
199
+ - **HIGH**: Duplicate or conflicting requirement, ambiguous security/performance attribute, untestable acceptance criterion
200
+ - **MEDIUM**: Terminology drift, missing non-functional task coverage, underspecified edge case
201
+ - **LOW**: Style/wording improvements, minor redundancy not affecting execution order
202
+
203
+ ### 6. Produce Compact Analysis Report
204
+
205
+ Output a Markdown report (no file writes) with the following structure:
206
+
207
+ ## Specification Analysis Report
208
+
209
+ | ID | Category | Severity | Location(s) | Summary | Recommendation |
210
+ |----|----------|----------|-------------|---------|----------------|
211
+ | A1 | Duplication | HIGH | spec.md:L120-134 | Two similar requirements ... | Merge phrasing; keep clearer version |
212
+
213
+ (Add one row per finding; generate stable IDs prefixed by category initial.)
214
+
215
+ **Coverage Summary Table:**
216
+
217
+ | Requirement Key | Has Task? | Task IDs | Notes |
218
+ |-----------------|-----------|----------|-------|
219
+
220
+ **Constitution Alignment Issues:** (if any)
221
+
222
+ **Unmapped Tasks:** (if any)
223
+
224
+ **Metrics:**
225
+
226
+ - Total Requirements
227
+ - Total Tasks
228
+ - Coverage % (requirements with >=1 task)
229
+ - Ambiguity Count
230
+ - Duplication Count
231
+ - Critical Issues Count
232
+
233
+ ### 7. Provide Next Actions
234
+
235
+ At end of report, output a concise Next Actions block:
236
+
237
+ - If CRITICAL issues exist: Recommend resolving before `/aw-spec-implement`
238
+ - If only LOW/MEDIUM: User may proceed, but provide improvement suggestions
239
+ - Provide explicit command suggestions: e.g., "Run /aw-spec-specify with refinement", "Run /aw-spec-plan to adjust architecture", "Manually edit tasks.md to add coverage for 'performance-metrics'"
240
+
241
+ ### 8. Offer Remediation
242
+
243
+ Ask the user: "Would you like me to suggest concrete remediation edits for the top N issues?" (Do NOT apply them automatically.)
244
+
245
+ ### 9. Check for extension hooks
246
+
247
+ After reporting, check if `.aw-spec/extensions.yml` exists in the project root.
248
+ - If it exists, read it and look for entries under the `hooks.after_analyze` key
249
+ - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
250
+ - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
251
+ - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
252
+ - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
253
+ - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
254
+ - When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `aw-spec.git.commit` → `/aw-spec-git-commit`.
255
+ - For each executable hook, output the following based on its `optional` flag:
256
+ - **Optional hook** (`optional: true`):
257
+ ```
258
+ ## Extension Hooks
259
+
260
+ **Optional Hook**: {extension}
261
+ Command: `/{command}`
262
+ Description: {description}
263
+
264
+ Prompt: {prompt}
265
+ To execute: `/{command}`
266
+ ```
267
+ - **Mandatory hook** (`optional: false`):
268
+ ```
269
+ ## Extension Hooks
270
+
271
+ **Automatic Hook**: {extension}
272
+ Executing: `/{command}`
273
+ EXECUTE_COMMAND: {command}
274
+ ```
275
+ - If no hooks are registered or `.aw-spec/extensions.yml` does not exist, skip silently
276
+
277
+ ## Operating Principles
278
+
279
+ ### Context Efficiency
280
+
281
+ - **Minimal high-signal tokens**: Focus on actionable findings, not exhaustive documentation
282
+ - **Progressive disclosure**: Load artifacts incrementally; don't dump all content into analysis
283
+ - **Token-efficient output**: Limit findings table to 50 rows; summarize overflow
284
+ - **Deterministic results**: Rerunning without changes should produce consistent IDs and counts
285
+
286
+ ### Analysis Guidelines
287
+
288
+ - **NEVER modify files** (this is read-only analysis)
289
+ - **NEVER hallucinate missing sections** (if absent, report them accurately)
290
+ - **Prioritize constitution violations** (these are always CRITICAL)
291
+ - **Use examples over exhaustive rules** (cite specific instances, not generic patterns)
292
+ - **Report zero issues gracefully** (emit success report with coverage statistics)
293
+
294
+ ## Context
295
+
296
+ $ARGUMENTS
@@ -0,0 +1,374 @@
1
+ ---
2
+ name: "aw-spec-checklist"
3
+ description: "Generate a custom checklist for the current feature based on user requirements."
4
+ argument-hint: "Domain or focus area for the checklist"
5
+ compatibility: "Requires aw-spec project structure with .aw-spec/ directory"
6
+ metadata:
7
+ author: "github-aw-spec"
8
+ source: "templates/commands/checklist.md"
9
+ user-invocable: true
10
+ disable-model-invocation: false
11
+ ---
12
+
13
+
14
+ ## Checklist Purpose: "Unit Tests for English"
15
+
16
+ **CRITICAL CONCEPT**: Checklists are **UNIT TESTS FOR REQUIREMENTS WRITING** - they validate the quality, clarity, and completeness of requirements in a given domain.
17
+
18
+ **NOT for verification/testing**:
19
+
20
+ - ❌ NOT "Verify the button clicks correctly"
21
+ - ❌ NOT "Test error handling works"
22
+ - ❌ NOT "Confirm the API returns 200"
23
+ - ❌ NOT checking if code/implementation matches the spec
24
+
25
+ **FOR requirements quality validation**:
26
+
27
+ - ✅ "Are visual hierarchy requirements defined for all card types?" (completeness)
28
+ - ✅ "Is 'prominent display' quantified with specific sizing/positioning?" (clarity)
29
+ - ✅ "Are hover state requirements consistent across all interactive elements?" (consistency)
30
+ - ✅ "Are accessibility requirements defined for keyboard navigation?" (coverage)
31
+ - ✅ "Does the spec define what happens when logo image fails to load?" (edge cases)
32
+
33
+ **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.
34
+
35
+ ## User Input
36
+
37
+ ```text
38
+ $ARGUMENTS
39
+ ```
40
+
41
+ You **MUST** consider the user input before proceeding (if not empty).
42
+
43
+ ## Pre-Execution Checks
44
+
45
+ **Check for extension hooks (before checklist generation)**:
46
+ - Check if `.aw-spec/extensions.yml` exists in the project root.
47
+ - If it exists, read it and look for entries under the `hooks.before_checklist` key
48
+ - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
49
+ - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
50
+ - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
51
+ - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
52
+ - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
53
+ - When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `aw-spec.git.commit` → `/aw-spec-git-commit`.
54
+ - For each executable hook, output the following based on its `optional` flag:
55
+ - **Optional hook** (`optional: true`):
56
+ ```
57
+ ## Extension Hooks
58
+
59
+ **Optional Pre-Hook**: {extension}
60
+ Command: `/{command}`
61
+ Description: {description}
62
+
63
+ Prompt: {prompt}
64
+ To execute: `/{command}`
65
+ ```
66
+ - **Mandatory hook** (`optional: false`):
67
+ ```
68
+ ## Extension Hooks
69
+
70
+ **Automatic Pre-Hook**: {extension}
71
+ Executing: `/{command}`
72
+ EXECUTE_COMMAND: {command}
73
+
74
+ Wait for the result of the hook command before proceeding to the Execution Steps.
75
+ ```
76
+ - If no hooks are registered or `.aw-spec/extensions.yml` does not exist, skip silently
77
+
78
+ ## Execution Steps
79
+
80
+ 1. **Setup**: Run `.aw-spec/scripts/bash/check-prerequisites.sh --json` from repo root and parse JSON for FEATURE_DIR and AVAILABLE_DOCS list.
81
+ - All file paths must be absolute.
82
+ - 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").
83
+
84
+ 2. **IF EXISTS**: Load `.aw-spec/memory/constitution.md` for project principles and governance constraints.
85
+
86
+ 3. **Clarify intent (dynamic)**: Derive up to THREE initial contextual clarifying questions (no pre-baked catalog). They MUST:
87
+ - Be generated from the user's phrasing + extracted signals from spec/plan/tasks
88
+ - Only ask about information that materially changes checklist content
89
+ - Be skipped individually if already unambiguous in `$ARGUMENTS`
90
+ - Prefer precision over breadth
91
+
92
+ Generation algorithm:
93
+ 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").
94
+ 2. Cluster signals into candidate focus areas (max 4) ranked by relevance.
95
+ 3. Identify probable audience & timing (author, reviewer, QA, release) if not explicit.
96
+ 4. Detect missing dimensions: scope breadth, depth/rigor, risk emphasis, exclusion boundaries, measurable acceptance criteria.
97
+ 5. Formulate questions chosen from these archetypes:
98
+ - Scope refinement (e.g., "Should this include integration touchpoints with X and Y or stay limited to local module correctness?")
99
+ - Risk prioritization (e.g., "Which of these potential risk areas should receive mandatory gating checks?")
100
+ - Depth calibration (e.g., "Is this a lightweight pre-commit sanity list or a formal release gate?")
101
+ - Audience framing (e.g., "Will this be used by the author only or peers during PR review?")
102
+ - Boundary exclusion (e.g., "Should we explicitly exclude performance tuning items this round?")
103
+ - Scenario class gap (e.g., "No recovery flows detected—are rollback / partial failure paths in scope?")
104
+
105
+ Question formatting rules:
106
+ - If presenting options, generate a compact table with columns: Option | Candidate | Why It Matters
107
+ - Limit to A–E options maximum; omit table if a free-form answer is clearer
108
+ - Never ask the user to restate what they already said
109
+ - Avoid speculative categories (no hallucination). If uncertain, ask explicitly: "Confirm whether X belongs in scope."
110
+
111
+ Defaults when interaction impossible:
112
+ - Depth: Standard
113
+ - Audience: Reviewer (PR) if code-related; Author otherwise
114
+ - Focus: Top 2 relevance clusters
115
+
116
+ 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.
117
+
118
+ 4. **Understand user request**: Combine `$ARGUMENTS` + clarifying answers:
119
+ - Derive checklist theme (e.g., security, review, deploy, ux)
120
+ - Consolidate explicit must-have items mentioned by user
121
+ - Map focus selections to category scaffolding
122
+ - Infer any missing context from spec/plan/tasks (do NOT hallucinate)
123
+
124
+ 5. **Load feature context**: Read from FEATURE_DIR:
125
+ - spec.md: Feature requirements and scope
126
+ - plan.md (if exists): Technical details, dependencies
127
+ - tasks.md (if exists): Implementation tasks
128
+
129
+ **Context Loading Strategy**:
130
+ - Load only necessary portions relevant to active focus areas (avoid full-file dumping)
131
+ - Prefer summarizing long sections into concise scenario/requirement bullets
132
+ - Use progressive disclosure: add follow-on retrieval only if gaps detected
133
+ - If source docs are large, generate interim summary items instead of embedding raw text
134
+
135
+ 6. **Generate checklist** - Create "Unit Tests for Requirements":
136
+ - Create `FEATURE_DIR/checklists/` directory if it doesn't exist
137
+ - Generate unique checklist filename:
138
+ - Use short, descriptive name based on domain (e.g., `ux.md`, `api.md`, `security.md`)
139
+ - Format: `[domain].md`
140
+ - File handling behavior:
141
+ - If file does NOT exist: Create new file and number items starting from CHK001
142
+ - 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)
143
+ - Never delete or replace existing checklist content - always preserve and append
144
+
145
+ **CORE PRINCIPLE - Test the Requirements, Not the Implementation**:
146
+ Every checklist item MUST evaluate the REQUIREMENTS THEMSELVES for:
147
+ - **Completeness**: Are all necessary requirements present?
148
+ - **Clarity**: Are requirements unambiguous and specific?
149
+ - **Consistency**: Do requirements align with each other?
150
+ - **Measurability**: Can requirements be objectively verified?
151
+ - **Coverage**: Are all scenarios/edge cases addressed?
152
+
153
+ **Category Structure** - Group items by requirement quality dimensions:
154
+ - **Requirement Completeness** (Are all necessary requirements documented?)
155
+ - **Requirement Clarity** (Are requirements specific and unambiguous?)
156
+ - **Requirement Consistency** (Do requirements align without conflicts?)
157
+ - **Acceptance Criteria Quality** (Are success criteria measurable?)
158
+ - **Scenario Coverage** (Are all flows/cases addressed?)
159
+ - **Edge Case Coverage** (Are boundary conditions defined?)
160
+ - **Non-Functional Requirements** (Performance, Security, Accessibility, etc. - are they specified?)
161
+ - **Dependencies & Assumptions** (Are they documented and validated?)
162
+ - **Ambiguities & Conflicts** (What needs clarification?)
163
+
164
+ **HOW TO WRITE CHECKLIST ITEMS - "Unit Tests for English"**:
165
+
166
+ ❌ **WRONG** (Testing implementation):
167
+ - "Verify landing page displays 3 episode cards"
168
+ - "Test hover states work on desktop"
169
+ - "Confirm logo click navigates home"
170
+
171
+ ✅ **CORRECT** (Testing requirements quality):
172
+ - "Are the exact number and layout of featured episodes specified?" [Completeness]
173
+ - "Is 'prominent display' quantified with specific sizing/positioning?" [Clarity]
174
+ - "Are hover state requirements consistent across all interactive elements?" [Consistency]
175
+ - "Are keyboard navigation requirements defined for all interactive UI?" [Coverage]
176
+ - "Is the fallback behavior specified when logo image fails to load?" [Edge Cases]
177
+ - "Are loading states defined for asynchronous episode data?" [Completeness]
178
+ - "Does the spec define visual hierarchy for competing UI elements?" [Clarity]
179
+
180
+ **ITEM STRUCTURE**:
181
+ Each item should follow this pattern:
182
+ - Question format asking about requirement quality
183
+ - Focus on what's WRITTEN (or not written) in the spec/plan
184
+ - Include quality dimension in brackets [Completeness/Clarity/Consistency/etc.]
185
+ - Reference spec section `[Spec §X.Y]` when checking existing requirements
186
+ - Use `[Gap]` marker when checking for missing requirements
187
+
188
+ **EXAMPLES BY QUALITY DIMENSION**:
189
+
190
+ Completeness:
191
+ - "Are error handling requirements defined for all API failure modes? [Gap]"
192
+ - "Are accessibility requirements specified for all interactive elements? [Completeness]"
193
+ - "Are mobile breakpoint requirements defined for responsive layouts? [Gap]"
194
+
195
+ Clarity:
196
+ - "Is 'fast loading' quantified with specific timing thresholds? [Clarity, Spec §NFR-2]"
197
+ - "Are 'related episodes' selection criteria explicitly defined? [Clarity, Spec §FR-5]"
198
+ - "Is 'prominent' defined with measurable visual properties? [Ambiguity, Spec §FR-4]"
199
+
200
+ Consistency:
201
+ - "Do navigation requirements align across all pages? [Consistency, Spec §FR-10]"
202
+ - "Are card component requirements consistent between landing and detail pages? [Consistency]"
203
+
204
+ Coverage:
205
+ - "Are requirements defined for zero-state scenarios (no episodes)? [Coverage, Edge Case]"
206
+ - "Are concurrent user interaction scenarios addressed? [Coverage, Gap]"
207
+ - "Are requirements specified for partial data loading failures? [Coverage, Exception Flow]"
208
+
209
+ Measurability:
210
+ - "Are visual hierarchy requirements measurable/testable? [Acceptance Criteria, Spec §FR-1]"
211
+ - "Can 'balanced visual weight' be objectively verified? [Measurability, Spec §FR-2]"
212
+
213
+ **Scenario Classification & Coverage** (Requirements Quality Focus):
214
+ - Check if requirements exist for: Primary, Alternate, Exception/Error, Recovery, Non-Functional scenarios
215
+ - For each scenario class, ask: "Are [scenario type] requirements complete, clear, and consistent?"
216
+ - If scenario class missing: "Are [scenario type] requirements intentionally excluded or missing? [Gap]"
217
+ - Include resilience/rollback when state mutation occurs: "Are rollback requirements defined for migration failures? [Gap]"
218
+
219
+ **Traceability Requirements**:
220
+ - MINIMUM: ≥80% of items MUST include at least one traceability reference
221
+ - Each item should reference: spec section `[Spec §X.Y]`, or use markers: `[Gap]`, `[Ambiguity]`, `[Conflict]`, `[Assumption]`
222
+ - If no ID system exists: "Is a requirement & acceptance criteria ID scheme established? [Traceability]"
223
+
224
+ **Surface & Resolve Issues** (Requirements Quality Problems):
225
+ Ask questions about the requirements themselves:
226
+ - Ambiguities: "Is the term 'fast' quantified with specific metrics? [Ambiguity, Spec §NFR-1]"
227
+ - Conflicts: "Do navigation requirements conflict between §FR-10 and §FR-10a? [Conflict]"
228
+ - Assumptions: "Is the assumption of 'always available podcast API' validated? [Assumption]"
229
+ - Dependencies: "Are external podcast API requirements documented? [Dependency, Gap]"
230
+ - Missing definitions: "Is 'visual hierarchy' defined with measurable criteria? [Gap]"
231
+
232
+ **Content Consolidation**:
233
+ - Soft cap: If raw candidate items > 40, prioritize by risk/impact
234
+ - Merge near-duplicates checking the same requirement aspect
235
+ - If >5 low-impact edge cases, create one item: "Are edge cases X, Y, Z addressed in requirements? [Coverage]"
236
+
237
+ **🚫 ABSOLUTELY PROHIBITED** - These make it an implementation test, not a requirements test:
238
+ - ❌ Any item starting with "Verify", "Test", "Confirm", "Check" + implementation behavior
239
+ - ❌ References to code execution, user actions, system behavior
240
+ - ❌ "Displays correctly", "works properly", "functions as expected"
241
+ - ❌ "Click", "navigate", "render", "load", "execute"
242
+ - ❌ Test cases, test plans, QA procedures
243
+ - ❌ Implementation details (frameworks, APIs, algorithms)
244
+
245
+ **✅ REQUIRED PATTERNS** - These test requirements quality:
246
+ - ✅ "Are [requirement type] defined/specified/documented for [scenario]?"
247
+ - ✅ "Is [vague term] quantified/clarified with specific criteria?"
248
+ - ✅ "Are requirements consistent between [section A] and [section B]?"
249
+ - ✅ "Can [requirement] be objectively measured/verified?"
250
+ - ✅ "Are [edge cases/scenarios] addressed in requirements?"
251
+ - ✅ "Does the spec define [missing aspect]?"
252
+
253
+ 7. **Structure Reference**: Generate the checklist following the canonical template in `.aw-spec/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.
254
+
255
+ 8. **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:
256
+ - Focus areas selected
257
+ - Depth level
258
+ - Actor/timing
259
+ - Any explicit user-specified must-have items incorporated
260
+
261
+ **Important**: Each `/aw-spec-checklist` command invocation uses a short, descriptive checklist filename and either creates a new file or appends to an existing one. This allows:
262
+
263
+ - Multiple checklists of different types (e.g., `ux.md`, `test.md`, `security.md`)
264
+ - Simple, memorable filenames that indicate checklist purpose
265
+ - Easy identification and navigation in the `checklists/` folder
266
+
267
+ To avoid clutter, use descriptive types and clean up obsolete checklists when done.
268
+
269
+ ## Example Checklist Types & Sample Items
270
+
271
+ **UX Requirements Quality:** `ux.md`
272
+
273
+ Sample items (testing the requirements, NOT the implementation):
274
+
275
+ - "Are visual hierarchy requirements defined with measurable criteria? [Clarity, Spec §FR-1]"
276
+ - "Is the number and positioning of UI elements explicitly specified? [Completeness, Spec §FR-1]"
277
+ - "Are interaction state requirements (hover, focus, active) consistently defined? [Consistency]"
278
+ - "Are accessibility requirements specified for all interactive elements? [Coverage, Gap]"
279
+ - "Is fallback behavior defined when images fail to load? [Edge Case, Gap]"
280
+ - "Can 'prominent display' be objectively measured? [Measurability, Spec §FR-4]"
281
+
282
+ **API Requirements Quality:** `api.md`
283
+
284
+ Sample items:
285
+
286
+ - "Are error response formats specified for all failure scenarios? [Completeness]"
287
+ - "Are rate limiting requirements quantified with specific thresholds? [Clarity]"
288
+ - "Are authentication requirements consistent across all endpoints? [Consistency]"
289
+ - "Are retry/timeout requirements defined for external dependencies? [Coverage, Gap]"
290
+ - "Is versioning strategy documented in requirements? [Gap]"
291
+
292
+ **Performance Requirements Quality:** `performance.md`
293
+
294
+ Sample items:
295
+
296
+ - "Are performance requirements quantified with specific metrics? [Clarity]"
297
+ - "Are performance targets defined for all critical user journeys? [Coverage]"
298
+ - "Are performance requirements under different load conditions specified? [Completeness]"
299
+ - "Can performance requirements be objectively measured? [Measurability]"
300
+ - "Are degradation requirements defined for high-load scenarios? [Edge Case, Gap]"
301
+
302
+ **Security Requirements Quality:** `security.md`
303
+
304
+ Sample items:
305
+
306
+ - "Are authentication requirements specified for all protected resources? [Coverage]"
307
+ - "Are data protection requirements defined for sensitive information? [Completeness]"
308
+ - "Is the threat model documented and requirements aligned to it? [Traceability]"
309
+ - "Are security requirements consistent with compliance obligations? [Consistency]"
310
+ - "Are security failure/breach response requirements defined? [Gap, Exception Flow]"
311
+
312
+ ## Anti-Examples: What NOT To Do
313
+
314
+ **❌ WRONG - These test implementation, not requirements:**
315
+
316
+ ```markdown
317
+ - [ ] CHK001 - Verify landing page displays 3 episode cards [Spec §FR-001]
318
+ - [ ] CHK002 - Test hover states work correctly on desktop [Spec §FR-003]
319
+ - [ ] CHK003 - Confirm logo click navigates to home page [Spec §FR-010]
320
+ - [ ] CHK004 - Check that related episodes section shows 3-5 items [Spec §FR-005]
321
+ ```
322
+
323
+ **✅ CORRECT - These test requirements quality:**
324
+
325
+ ```markdown
326
+ - [ ] CHK001 - Are the number and layout of featured episodes explicitly specified? [Completeness, Spec §FR-001]
327
+ - [ ] CHK002 - Are hover state requirements consistently defined for all interactive elements? [Consistency, Spec §FR-003]
328
+ - [ ] CHK003 - Are navigation requirements clear for all clickable brand elements? [Clarity, Spec §FR-010]
329
+ - [ ] CHK004 - Is the selection criteria for related episodes documented? [Gap, Spec §FR-005]
330
+ - [ ] CHK005 - Are loading state requirements defined for asynchronous episode data? [Gap]
331
+ - [ ] CHK006 - Can "visual hierarchy" requirements be objectively measured? [Measurability, Spec §FR-001]
332
+ ```
333
+
334
+ **Key Differences:**
335
+
336
+ - Wrong: Tests if the system works correctly
337
+ - Correct: Tests if the requirements are written correctly
338
+ - Wrong: Verification of behavior
339
+ - Correct: Validation of requirement quality
340
+ - Wrong: "Does it do X?"
341
+ - Correct: "Is X clearly specified?"
342
+
343
+ ## Post-Execution Checks
344
+
345
+ **Check for extension hooks (after checklist generation)**:
346
+ Check if `.aw-spec/extensions.yml` exists in the project root.
347
+ - If it exists, read it and look for entries under the `hooks.after_checklist` key
348
+ - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
349
+ - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
350
+ - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
351
+ - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
352
+ - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
353
+ - When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `aw-spec.git.commit` → `/aw-spec-git-commit`.
354
+ - For each executable hook, output the following based on its `optional` flag:
355
+ - **Optional hook** (`optional: true`):
356
+ ```
357
+ ## Extension Hooks
358
+
359
+ **Optional Hook**: {extension}
360
+ Command: `/{command}`
361
+ Description: {description}
362
+
363
+ Prompt: {prompt}
364
+ To execute: `/{command}`
365
+ ```
366
+ - **Mandatory hook** (`optional: false`):
367
+ ```
368
+ ## Extension Hooks
369
+
370
+ **Automatic Hook**: {extension}
371
+ Executing: `/{command}`
372
+ EXECUTE_COMMAND: {command}
373
+ ```
374
+ - If no hooks are registered or `.aw-spec/extensions.yml` does not exist, skip silently