aw-spec-cli 0.1.1 → 0.1.2

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/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/dist/commands/init.d.ts.map +1 -1
  40. package/dist/commands/init.js +3 -2
  41. package/dist/commands/init.js.map +1 -1
  42. package/dist/utils/copy-assets.d.ts +8 -1
  43. package/dist/utils/copy-assets.d.ts.map +1 -1
  44. package/dist/utils/copy-assets.js +1 -0
  45. package/dist/utils/copy-assets.js.map +1 -1
  46. package/package.json +1 -1
@@ -0,0 +1,382 @@
1
+ ---
2
+ name: "aw-spec-specify"
3
+ description: "Create or update the feature specification from a natural language feature description."
4
+ argument-hint: "Describe the feature you want to specify"
5
+ compatibility: "Requires aw-spec project structure with .aw-spec/ directory"
6
+ metadata:
7
+ author: "github-aw-spec"
8
+ source: "templates/commands/specify.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 / Outline. 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-specify`:
35
+ - docs/domain/domain-driven-design.md
36
+ - docs/security/data-classification.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-specify` 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-specify:"* — 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 specification)**:
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_specify` 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 Outline.
90
+ ```
91
+ - If no hooks are registered or `.aw-spec/extensions.yml` does not exist, skip silently
92
+
93
+ ## Outline
94
+
95
+ The text the user typed after `/aw-spec-specify` in the triggering message **is** the feature description. Assume you always have it available in this conversation even if `$ARGUMENTS` appears literally below. Do not ask the user to repeat it unless they provided an empty command.
96
+
97
+ Given that feature description, do this:
98
+
99
+ 1. **Generate a concise short name** (2-4 words) for the feature:
100
+ - Analyze the feature description and extract the most meaningful keywords
101
+ - Create a 2-4 word short name that captures the essence of the feature
102
+ - Use action-noun format when possible (e.g., "add-user-auth", "fix-payment-bug")
103
+ - Preserve technical terms and acronyms (OAuth2, API, JWT, etc.)
104
+ - Keep it concise but descriptive enough to understand the feature at a glance
105
+ - Examples:
106
+ - "I want to add user authentication" → "user-auth"
107
+ - "Implement OAuth2 integration for the API" → "oauth2-api-integration"
108
+ - "Create a dashboard for analytics" → "analytics-dashboard"
109
+ - "Fix payment processing timeout bug" → "fix-payment-timeout"
110
+
111
+ 2. **Branch creation** (optional, via hook):
112
+
113
+ If a `before_specify` hook ran successfully in the Pre-Execution Checks above, it will have created/switched to a git branch and output JSON containing `BRANCH_NAME` and `FEATURE_NUM`. Note these values for reference, but the branch name does **not** dictate the spec directory name.
114
+
115
+ If the user explicitly provided `GIT_BRANCH_NAME`, pass it through to the hook so the branch script uses the exact value as the branch name (bypassing all prefix/suffix generation).
116
+
117
+ 3. **Create the spec feature directory**:
118
+
119
+ Specs live under `specs/<Aggregate>/<Feature>/` unless the user explicitly provides `SPECIFY_FEATURE_DIRECTORY`.
120
+
121
+ **Resolution order for `SPECIFY_FEATURE_DIRECTORY`**:
122
+ 1. If the user explicitly provided `SPECIFY_FEATURE_DIRECTORY` (e.g., via environment variable, argument, or configuration), use it as-is
123
+ 2. Otherwise, auto-generate it under `specs/` keyed by aggregate and feature:
124
+ - Derive `<Aggregate>` and `<Feature>` from the feature description (arguments):
125
+ - If the description begins with an `Aggregate/Feature` token — two PascalCase segments separated by a single `/` (e.g. `Patient/RegisterPatient`) — split it into `<Aggregate>` (`Patient`) and `<Feature>` (`RegisterPatient`), and treat any remaining text as the descriptive detail.
126
+ - Otherwise, set `<Feature>` to the PascalCase form of the short-name from step 1, and `<Aggregate>` to the primary domain entity named in the description; if none is identifiable, use `General` and note this in the summary.
127
+ - Preserve the casing of `<Aggregate>` and `<Feature>` exactly as provided (PascalCase, **no** numeric/timestamp prefix).
128
+ - Set `SPECIFY_FEATURE_DIRECTORY` to `specs/<Aggregate>/<Feature>` (e.g. `specs/Patient/RegisterPatient`).
129
+ - The git branch (created by the `before_specify` hook) is independent and keeps its own numbering — do **not** mirror the branch name into the spec directory.
130
+
131
+ **Create the directory and spec file**:
132
+ - `mkdir -p SPECIFY_FEATURE_DIRECTORY`
133
+ - Resolve the active `spec-template` through the AW-Spec preset/template resolution stack (equivalent to `specify preset resolve spec-template`)
134
+ - Copy the resolved `spec-template` file to `SPECIFY_FEATURE_DIRECTORY/spec.md` as the starting point
135
+ - Set `SPEC_FILE` to `SPECIFY_FEATURE_DIRECTORY/spec.md`
136
+ - Persist the resolved path to `.aw-spec/feature.json`:
137
+ ```json
138
+ {
139
+ "feature_directory": "<resolved feature dir>"
140
+ }
141
+ ```
142
+ Write the actual resolved directory path value (for example, `specs/003-user-auth`), not the literal string `SPECIFY_FEATURE_DIRECTORY`.
143
+ This allows downstream commands (`/aw-spec-plan`, `/aw-spec-tasks`, etc.) to locate the feature directory without relying on git branch name conventions.
144
+
145
+ **IMPORTANT**:
146
+ - You must only create one feature per `/aw-spec-specify` invocation
147
+ - The spec directory name and the git branch name are independent — they may be the same but that is the user's choice
148
+ - The spec directory and file are always created by this command, never by the hook
149
+
150
+ 4. Load the resolved active `spec-template` file to understand required sections.
151
+
152
+ 5. **IF EXISTS**: Load `.aw-spec/memory/constitution.md` for project principles and governance constraints.
153
+
154
+ 6. Follow this execution flow:
155
+ 1. Parse user description from arguments
156
+ If empty: ERROR "No feature description provided"
157
+ 2. Extract key concepts from description
158
+ Identify: actors, actions, data, constraints
159
+ 3. For unclear aspects:
160
+ - Make informed guesses based on context and industry standards
161
+ - Only mark with [NEEDS CLARIFICATION: specific question] if:
162
+ - The choice significantly impacts feature scope or user experience
163
+ - Multiple reasonable interpretations exist with different implications
164
+ - No reasonable default exists
165
+ - **LIMIT: Maximum 3 [NEEDS CLARIFICATION] markers total**
166
+ - Prioritize clarifications by impact: scope > security/privacy > user experience > technical details
167
+ 4. Fill User Scenarios & Testing section
168
+ If no clear user flow: ERROR "Cannot determine user scenarios"
169
+ 5. Generate Functional Requirements
170
+ Each requirement must be testable
171
+ Use reasonable defaults for unspecified details (document assumptions in Assumptions section)
172
+ 6. Define Success Criteria
173
+ Create measurable, technology-agnostic outcomes
174
+ Include both quantitative metrics (time, performance, volume) and qualitative measures (user satisfaction, task completion)
175
+ Each criterion must be verifiable without implementation details
176
+ 7. Identify Key Entities (if data involved)
177
+ 8. Return: SUCCESS (spec ready for planning)
178
+
179
+ 6. Write the specification to SPEC_FILE using the template structure, replacing placeholders with concrete details derived from the feature description (arguments) while preserving section order and headings.
180
+
181
+ 7. **Specification Quality Validation**: After writing the initial spec, validate it against quality criteria:
182
+
183
+ a. **Create Spec Quality Checklist**: Generate a checklist file at `SPECIFY_FEATURE_DIRECTORY/checklists/requirements.md` using the checklist template structure with these validation items:
184
+
185
+ ```markdown
186
+ # Specification Quality Checklist: [FEATURE NAME]
187
+
188
+ **Purpose**: Validate specification completeness and quality before proceeding to planning
189
+ **Created**: [DATE]
190
+ **Feature**: [Link to spec.md]
191
+
192
+ ## Content Quality
193
+
194
+ - [ ] No implementation details (languages, frameworks, APIs)
195
+ - [ ] Focused on user value and business needs
196
+ - [ ] Written for non-technical stakeholders
197
+ - [ ] All mandatory sections completed
198
+
199
+ ## Requirement Completeness
200
+
201
+ - [ ] No [NEEDS CLARIFICATION] markers remain
202
+ - [ ] Requirements are testable and unambiguous
203
+ - [ ] Success criteria are measurable
204
+ - [ ] Success criteria are technology-agnostic (no implementation details)
205
+ - [ ] All acceptance scenarios are defined
206
+ - [ ] Edge cases are identified
207
+ - [ ] Scope is clearly bounded
208
+ - [ ] Dependencies and assumptions identified
209
+
210
+ ## Feature Readiness
211
+
212
+ - [ ] All functional requirements have clear acceptance criteria
213
+ - [ ] User scenarios cover primary flows
214
+ - [ ] Feature meets measurable outcomes defined in Success Criteria
215
+ - [ ] No implementation details leak into specification
216
+
217
+ ## Notes
218
+
219
+ - Items marked incomplete require spec updates before `/aw-spec-clarify` or `/aw-spec-plan`
220
+ ```
221
+
222
+ b. **Run Validation Check**: Review the spec against each checklist item:
223
+ - For each item, determine if it passes or fails
224
+ - Document specific issues found (quote relevant spec sections)
225
+
226
+ c. **Handle Validation Results**:
227
+
228
+ - **If all items pass**: Mark checklist complete and proceed to the Mandatory Post-Execution Hooks section
229
+
230
+ - **If items fail (excluding [NEEDS CLARIFICATION])**:
231
+ 1. List the failing items and specific issues
232
+ 2. Update the spec to address each issue
233
+ 3. Re-run validation until all items pass (max 3 iterations)
234
+ 4. If still failing after 3 iterations, document remaining issues in checklist notes and warn user
235
+
236
+ - **If [NEEDS CLARIFICATION] markers remain**:
237
+ 1. Extract all [NEEDS CLARIFICATION: ...] markers from the spec
238
+ 2. **LIMIT CHECK**: If more than 3 markers exist, keep only the 3 most critical (by scope/security/UX impact) and make informed guesses for the rest
239
+ 3. For each clarification needed (max 3), present options to user in this format:
240
+
241
+ ```markdown
242
+ ## Question [N]: [Topic]
243
+
244
+ **Context**: [Quote relevant spec section]
245
+
246
+ **What we need to know**: [Specific question from NEEDS CLARIFICATION marker]
247
+
248
+ **Suggested Answers**:
249
+
250
+ | Option | Answer | Implications |
251
+ |--------|--------|--------------|
252
+ | A | [First suggested answer] | [What this means for the feature] |
253
+ | B | [Second suggested answer] | [What this means for the feature] |
254
+ | C | [Third suggested answer] | [What this means for the feature] |
255
+ | Custom | Provide your own answer | [Explain how to provide custom input] |
256
+
257
+ **Your choice**: _[Wait for user response]_
258
+ ```
259
+
260
+ 4. **CRITICAL - Table Formatting**: Ensure markdown tables are properly formatted:
261
+ - Use consistent spacing with pipes aligned
262
+ - Each cell should have spaces around content: `| Content |` not `|Content|`
263
+ - Header separator must have at least 3 dashes: `|--------|`
264
+ - Test that the table renders correctly in markdown preview
265
+ 5. Number questions sequentially (Q1, Q2, Q3 - max 3 total)
266
+ 6. Present all questions together before waiting for responses
267
+ 7. Wait for user to respond with their choices for all questions (e.g., "Q1: A, Q2: Custom - [details], Q3: B")
268
+ 8. Update the spec by replacing each [NEEDS CLARIFICATION] marker with the user's selected or provided answer
269
+ 9. Re-run validation after all clarifications are resolved
270
+
271
+ d. **Update Checklist**: After each validation iteration, update the checklist file with current pass/fail status
272
+
273
+ ## Mandatory Post-Execution Hooks
274
+
275
+ **You MUST complete this section before reporting completion to the user.**
276
+
277
+ Check if `.aw-spec/extensions.yml` exists in the project root.
278
+ - If it does not exist, or no hooks are registered under `hooks.after_specify`, skip to the Completion Report.
279
+ - If it exists, read it and look for entries under the `hooks.after_specify` key.
280
+ - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue to the Completion Report.
281
+ - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
282
+ - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
283
+ - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
284
+ - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
285
+ - When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `aw-spec.git.commit` → `/aw-spec-git-commit`.
286
+ - For each executable hook, output the following based on its `optional` flag:
287
+ - **Mandatory hook** (`optional: false`) — **You MUST emit `EXECUTE_COMMAND:` for each mandatory hook**:
288
+ ```
289
+ ## Extension Hooks
290
+
291
+ **Automatic Hook**: {extension}
292
+ Executing: `/{command}`
293
+ EXECUTE_COMMAND: {command}
294
+ ```
295
+ - **Optional hook** (`optional: true`):
296
+ ```
297
+ ## Extension Hooks
298
+
299
+ **Optional Hook**: {extension}
300
+ Command: `/{command}`
301
+ Description: {description}
302
+
303
+ Prompt: {prompt}
304
+ To execute: `/{command}`
305
+ ```
306
+
307
+ ## Completion Report
308
+
309
+ Report completion to the user with:
310
+ - `SPECIFY_FEATURE_DIRECTORY` — the feature directory path
311
+ - `SPEC_FILE` — the spec file path
312
+ - Checklist results summary
313
+ - Readiness for the next phase (`/aw-spec-clarify` or `/aw-spec-plan`)
314
+
315
+ **NOTE:** Branch creation is handled by the `before_specify` hook (git extension). Spec directory and file creation are always handled by this core command.
316
+
317
+ ## Quick Guidelines
318
+
319
+ - Focus on **WHAT** users need and **WHY**.
320
+ - Avoid HOW to implement (no tech stack, APIs, code structure).
321
+ - Written for business stakeholders, not developers.
322
+ - DO NOT create any checklists that are embedded in the spec. That will be a separate command.
323
+
324
+ ### Section Requirements
325
+
326
+ - **Mandatory sections**: Must be completed for every feature
327
+ - **Optional sections**: Include only when relevant to the feature
328
+ - When a section doesn't apply, remove it entirely (don't leave as "N/A")
329
+
330
+ ### For AI Generation
331
+
332
+ When creating this spec from a user prompt:
333
+
334
+ 1. **Make informed guesses**: Use context, industry standards, and common patterns to fill gaps
335
+ 2. **Document assumptions**: Record reasonable defaults in the Assumptions section
336
+ 3. **Limit clarifications**: Maximum 3 [NEEDS CLARIFICATION] markers - use only for critical decisions that:
337
+ - Significantly impact feature scope or user experience
338
+ - Have multiple reasonable interpretations with different implications
339
+ - Lack any reasonable default
340
+ 4. **Prioritize clarifications**: scope > security/privacy > user experience > technical details
341
+ 5. **Think like a tester**: Every vague requirement should fail the "testable and unambiguous" checklist item
342
+ 6. **Common areas needing clarification** (only if no reasonable default exists):
343
+ - Feature scope and boundaries (include/exclude specific use cases)
344
+ - User types and permissions (if multiple conflicting interpretations possible)
345
+ - Security/compliance requirements (when legally/financially significant)
346
+
347
+ **Examples of reasonable defaults** (don't ask about these):
348
+
349
+ - Data retention: Industry-standard practices for the domain
350
+ - Performance targets: Standard web/mobile app expectations unless specified
351
+ - Error handling: User-friendly messages with appropriate fallbacks
352
+ - Authentication method: Standard session-based or OAuth2 for web apps
353
+ - Integration patterns: Use project-appropriate patterns (REST/GraphQL for web services, function calls for libraries, CLI args for tools, etc.)
354
+
355
+ ### Success Criteria Guidelines
356
+
357
+ Success criteria must be:
358
+
359
+ 1. **Measurable**: Include specific metrics (time, percentage, count, rate)
360
+ 2. **Technology-agnostic**: No mention of frameworks, languages, databases, or tools
361
+ 3. **User-focused**: Describe outcomes from user/business perspective, not system internals
362
+ 4. **Verifiable**: Can be tested/validated without knowing implementation details
363
+
364
+ **Good examples**:
365
+
366
+ - "Users can complete checkout in under 3 minutes"
367
+ - "System supports 10,000 concurrent users"
368
+ - "95% of searches return results in under 1 second"
369
+ - "Task completion rate improves by 40%"
370
+
371
+ **Bad examples** (implementation-focused):
372
+
373
+ - "API response time is under 200ms" (too technical, use "Users see results instantly")
374
+ - "Database can handle 1000 TPS" (implementation detail, use user-facing metric)
375
+ - "React components render efficiently" (framework-specific)
376
+ - "Redis cache hit rate above 80%" (technology-specific)
377
+
378
+ ## Done When
379
+
380
+ - [ ] Specification written to `SPEC_FILE` and validated against quality checklist
381
+ - [ ] Extension hooks dispatched or skipped according to the rules in Mandatory Post-Execution Hooks above
382
+ - [ ] Completion reported to user with feature directory, spec file path, and checklist results
@@ -0,0 +1,259 @@
1
+ ---
2
+ name: "aw-spec-tasks"
3
+ description: "Generate an actionable, dependency-ordered tasks.md for the feature based on available design artifacts."
4
+ argument-hint: "Optional task generation constraints"
5
+ compatibility: "Requires aw-spec project structure with .aw-spec/ directory"
6
+ metadata:
7
+ author: "github-aw-spec"
8
+ source: "templates/commands/tasks.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 / Outline. 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-tasks`:
35
+ - docs/architecture/folder-structure.md
36
+ - docs/architecture/vertical-slices.md
37
+ - docs/architecture/cqrs.md
38
+ - docs/architecture/persistence.md
39
+ - docs/architecture/testing.md
40
+ - docs/architecture/eventing.md
41
+ - docs/domain/domain-driven-design.md
42
+ - docs/security/authorization.md
43
+ - docs/security/auditing.md
44
+ - docs/governance/coding-standards.md
45
+ - docs/glossary/ai-rules.md
46
+
47
+ ## Domain Rule-File Selection (interactive)
48
+
49
+ 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:
50
+
51
+ 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-tasks` heading in `docs/domainspecs/<domain>/comandrulemap.md`.
52
+ 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:
53
+ - 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"**.
54
+ - **Continue (technical only)** → skip steps 3-5 and proceed with only the auto-loaded technical standards (plus any `@`-mentioned files).
55
+ - **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.
56
+ - If interactive questions cannot be asked (non-interactive/automated run), default to **Continue (technical only)**.
57
+ - 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.
58
+ 3. **Show a selection box** using the AskUserQuestion tool:
59
+ - Ask one single-select question — *"Domain rule files for /aw-spec-tasks:"* — with options **"Select all (recommended)"**, **"Pick a subset"**, and **"None (technical only)"**.
60
+ - 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.
61
+ - If interactive questions cannot be asked (non-interactive or automated run), skip the prompt and default to **Select all**.
62
+ 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.
63
+ 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.
64
+ 6. Proceed to the Pre-Execution Checks only after the selected files are loaded.
65
+
66
+ ## Pre-Execution Checks
67
+
68
+ **Check for extension hooks (before tasks generation)**:
69
+ - Check if `.aw-spec/extensions.yml` exists in the project root.
70
+ - If it exists, read it and look for entries under the `hooks.before_tasks` key
71
+ - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
72
+ - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
73
+ - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
74
+ - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
75
+ - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
76
+ - When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `aw-spec.git.commit` → `/aw-spec-git-commit`.
77
+ - For each executable hook, output the following based on its `optional` flag:
78
+ - **Optional hook** (`optional: true`):
79
+ ```
80
+ ## Extension Hooks
81
+
82
+ **Optional Pre-Hook**: {extension}
83
+ Command: `/{command}`
84
+ Description: {description}
85
+
86
+ Prompt: {prompt}
87
+ To execute: `/{command}`
88
+ ```
89
+ - **Mandatory hook** (`optional: false`):
90
+ ```
91
+ ## Extension Hooks
92
+
93
+ **Automatic Pre-Hook**: {extension}
94
+ Executing: `/{command}`
95
+ EXECUTE_COMMAND: {command}
96
+
97
+ Wait for the result of the hook command before proceeding to the Outline.
98
+ ```
99
+ - If no hooks are registered or `.aw-spec/extensions.yml` does not exist, skip silently
100
+
101
+ ## Outline
102
+
103
+ 1. **Setup**: Run `.aw-spec/scripts/bash/setup-tasks.sh --json` from repo root and parse FEATURE_DIR, TASKS_TEMPLATE, and AVAILABLE_DOCS list. `FEATURE_DIR` and `TASKS_TEMPLATE` must be absolute paths when provided. `AVAILABLE_DOCS` is a list of document names/relative paths available under `FEATURE_DIR` (for example `research.md` or `contracts/`). 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").
104
+
105
+ 2. **Load design documents**: Read from FEATURE_DIR:
106
+ - **Required**: plan.md (tech stack, libraries, structure), spec.md (user stories with priorities)
107
+ - **Optional**: data-model.md (entities), contracts/ (interface contracts), research.md (decisions), quickstart.md (test scenarios)
108
+ - **IF EXISTS**: Load `.aw-spec/memory/constitution.md` for project principles and governance constraints
109
+ - Note: Not all projects have all documents. Generate tasks based on what's available.
110
+
111
+ 3. **Execute task generation workflow**:
112
+ - Load plan.md and extract tech stack, libraries, project structure
113
+ - Load spec.md and extract user stories with their priorities (P1, P2, P3, etc.)
114
+ - If data-model.md exists: Extract entities and map to user stories
115
+ - If contracts/ exists: Map interface contracts to user stories
116
+ - If research.md exists: Extract decisions for setup tasks
117
+ - Generate tasks organized by user story (see Task Generation Rules below)
118
+ - Generate dependency graph showing user story completion order
119
+ - Create parallel execution examples per user story
120
+ - Validate task completeness (each user story has all needed tasks, independently testable)
121
+
122
+ 4. **Generate tasks.md**: Read the tasks template from TASKS_TEMPLATE (from the JSON output above) and use it as structure. If TASKS_TEMPLATE is empty, fall back to `.aw-spec/templates/tasks-template.md`. Fill with:
123
+ - Correct feature name from plan.md
124
+ - Phase 1: Setup tasks (project initialization)
125
+ - Phase 2: Foundational tasks (blocking prerequisites for all user stories)
126
+ - Phase 3+: One phase per user story (in priority order from spec.md)
127
+ - Each phase includes: story goal, independent test criteria, tests (if requested), implementation tasks
128
+ - Final Phase: Polish & cross-cutting concerns
129
+ - All tasks must follow the strict checklist format (see Task Generation Rules below)
130
+ - Clear file paths for each task
131
+ - Dependencies section showing story completion order
132
+ - Parallel execution examples per story
133
+ - Implementation strategy section (MVP first, incremental delivery)
134
+
135
+ ## Mandatory Post-Execution Hooks
136
+
137
+ **You MUST complete this section before reporting completion to the user.**
138
+
139
+ Check if `.aw-spec/extensions.yml` exists in the project root.
140
+ - If it does not exist, or no hooks are registered under `hooks.after_tasks`, skip to the Completion Report.
141
+ - If it exists, read it and look for entries under the `hooks.after_tasks` key.
142
+ - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue to the Completion Report.
143
+ - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
144
+ - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
145
+ - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
146
+ - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
147
+ - When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `aw-spec.git.commit` → `/aw-spec-git-commit`.
148
+ - For each executable hook, output the following based on its `optional` flag:
149
+ - **Mandatory hook** (`optional: false`) — **You MUST emit `EXECUTE_COMMAND:` for each mandatory hook**:
150
+ ```
151
+ ## Extension Hooks
152
+
153
+ **Automatic Hook**: {extension}
154
+ Executing: `/{command}`
155
+ EXECUTE_COMMAND: {command}
156
+ ```
157
+ - **Optional hook** (`optional: true`):
158
+ ```
159
+ ## Extension Hooks
160
+
161
+ **Optional Hook**: {extension}
162
+ Command: `/{command}`
163
+ Description: {description}
164
+
165
+ Prompt: {prompt}
166
+ To execute: `/{command}`
167
+ ```
168
+
169
+ ## Completion Report
170
+
171
+ Output path to generated tasks.md and summary:
172
+ - Total task count
173
+ - Task count per user story
174
+ - Parallel opportunities identified
175
+ - Independent test criteria for each story
176
+ - Suggested MVP scope (typically just User Story 1)
177
+ - Format validation: Confirm ALL tasks follow the checklist format (checkbox, ID, labels, file paths)
178
+
179
+ Context for task generation: $ARGUMENTS
180
+
181
+ The tasks.md should be immediately executable - each task must be specific enough that an LLM can complete it without additional context.
182
+
183
+ ## Task Generation Rules
184
+
185
+ **CRITICAL**: Tasks MUST be organized by user story to enable independent implementation and testing.
186
+
187
+ **Tests are OPTIONAL**: Only generate test tasks if explicitly requested in the feature specification or if user requests TDD approach.
188
+
189
+ ### Checklist Format (REQUIRED)
190
+
191
+ Every task MUST strictly follow this format:
192
+
193
+ ```text
194
+ - [ ] [TaskID] [P?] [Story?] Description with file path
195
+ ```
196
+
197
+ **Format Components**:
198
+
199
+ 1. **Checkbox**: ALWAYS start with `- [ ]` (markdown checkbox)
200
+ 2. **Task ID**: Sequential number (T001, T002, T003...) in execution order
201
+ 3. **[P] marker**: Include ONLY if task is parallelizable (different files, no dependencies on incomplete tasks)
202
+ 4. **[Story] label**: REQUIRED for user story phase tasks only
203
+ - Format: [US1], [US2], [US3], etc. (maps to user stories from spec.md)
204
+ - Setup phase: NO story label
205
+ - Foundational phase: NO story label
206
+ - User Story phases: MUST have story label
207
+ - Polish phase: NO story label
208
+ 5. **Description**: Clear action with exact file path
209
+
210
+ **Examples**:
211
+
212
+ - ✅ CORRECT: `- [ ] T001 Create project structure per implementation plan`
213
+ - ✅ CORRECT: `- [ ] T005 [P] Implement authentication middleware in src/middleware/auth.py`
214
+ - ✅ CORRECT: `- [ ] T012 [P] [US1] Create User model in src/models/user.py`
215
+ - ✅ CORRECT: `- [ ] T014 [US1] Implement UserService in src/services/user_service.py`
216
+ - ❌ WRONG: `- [ ] Create User model` (missing ID and Story label)
217
+ - ❌ WRONG: `T001 [US1] Create model` (missing checkbox)
218
+ - ❌ WRONG: `- [ ] [US1] Create User model` (missing Task ID)
219
+ - ❌ WRONG: `- [ ] T001 [US1] Create model` (missing file path)
220
+
221
+ ### Task Organization
222
+
223
+ 1. **From User Stories (spec.md)** - PRIMARY ORGANIZATION:
224
+ - Each user story (P1, P2, P3...) gets its own phase
225
+ - Map all related components to their story:
226
+ - Models needed for that story
227
+ - Services needed for that story
228
+ - Interfaces/UI needed for that story
229
+ - If tests requested: Tests specific to that story
230
+ - Mark story dependencies (most stories should be independent)
231
+
232
+ 2. **From Contracts**:
233
+ - Map each interface contract → to the user story it serves
234
+ - If tests requested: Each interface contract → contract test task [P] before implementation in that story's phase
235
+
236
+ 3. **From Data Model**:
237
+ - Map each entity to the user story(ies) that need it
238
+ - If entity serves multiple stories: Put in earliest story or Setup phase
239
+ - Relationships → service layer tasks in appropriate story phase
240
+
241
+ 4. **From Setup/Infrastructure**:
242
+ - Shared infrastructure → Setup phase (Phase 1)
243
+ - Foundational/blocking tasks → Foundational phase (Phase 2)
244
+ - Story-specific setup → within that story's phase
245
+
246
+ ### Phase Structure
247
+
248
+ - **Phase 1**: Setup (project initialization)
249
+ - **Phase 2**: Foundational (blocking prerequisites - MUST complete before user stories)
250
+ - **Phase 3+**: User Stories in priority order (P1, P2, P3...)
251
+ - Within each story: Tests (if requested) → Models → Services → Endpoints → Integration
252
+ - Each phase should be a complete, independently testable increment
253
+ - **Final Phase**: Polish & Cross-Cutting Concerns
254
+
255
+ ## Done When
256
+
257
+ - [ ] tasks.md generated with all phases, task IDs, and file paths
258
+ - [ ] Extension hooks dispatched or skipped according to the rules in Mandatory Post-Execution Hooks above
259
+ - [ ] Completion reported to user with task count, story breakdown, and MVP scope