aw-spec-cli 0.1.0 → 0.1.1

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 (146) hide show
  1. package/assets/.agents/skills/aw-spec-addcomponent/SKILL.md +116 -0
  2. package/assets/.agents/skills/aw-spec-agent-context-update/SKILL.md +31 -0
  3. package/assets/.agents/skills/aw-spec-analyze/SKILL.md +292 -0
  4. package/assets/.agents/skills/aw-spec-checklist/SKILL.md +374 -0
  5. package/assets/.agents/skills/aw-spec-clarify/SKILL.md +316 -0
  6. package/assets/.agents/skills/aw-spec-constitution/SKILL.md +190 -0
  7. package/assets/.agents/skills/aw-spec-foundation/SKILL.md +188 -0
  8. package/assets/.agents/skills/aw-spec-implement/SKILL.md +268 -0
  9. package/assets/.agents/skills/aw-spec-plan/SKILL.md +217 -0
  10. package/assets/.agents/skills/aw-spec-select-domain/SKILL.md +73 -0
  11. package/assets/.agents/skills/aw-spec-specify/SKILL.md +378 -0
  12. package/assets/.agents/skills/aw-spec-tasks/SKILL.md +255 -0
  13. package/assets/.agents/skills/aw-spec-taskstoissues/SKILL.md +107 -0
  14. package/assets/.aw-spec/domain.json +3 -0
  15. package/assets/.aw-spec/extensions/.registry +19 -0
  16. package/assets/.aw-spec/extensions/agent-context/README.md +57 -0
  17. package/assets/.aw-spec/extensions/agent-context/agent-context-config.yml +4 -0
  18. package/assets/.aw-spec/extensions/agent-context/commands/aw-spec.agent-context.update.md +26 -0
  19. package/assets/.aw-spec/extensions/agent-context/extension.yml +34 -0
  20. package/assets/.aw-spec/extensions/agent-context/scripts/bash/update-agent-context.sh +201 -0
  21. package/assets/.aw-spec/extensions/agent-context/scripts/powershell/update-agent-context.ps1 +237 -0
  22. package/assets/.aw-spec/extensions.yml +23 -0
  23. package/assets/.aw-spec/feature.json +3 -0
  24. package/assets/.aw-spec/init-options.json +9 -0
  25. package/assets/.aw-spec/integration.json +15 -0
  26. package/assets/.aw-spec/integrations/aw-spec.manifest.json +17 -0
  27. package/assets/.aw-spec/integrations/claude.manifest.json +17 -0
  28. package/assets/.aw-spec/memory/constitution.md +50 -0
  29. package/assets/.aw-spec/scripts/bash/check-prerequisites.sh +189 -0
  30. package/assets/.aw-spec/scripts/bash/common.sh +582 -0
  31. package/assets/.aw-spec/scripts/bash/create-new-feature.sh +299 -0
  32. package/assets/.aw-spec/scripts/bash/setup-plan.sh +84 -0
  33. package/assets/.aw-spec/scripts/bash/setup-tasks.sh +91 -0
  34. package/assets/.aw-spec/templates/checklist-template.md +40 -0
  35. package/assets/.aw-spec/templates/constitution-template.md +57 -0
  36. package/assets/.aw-spec/templates/plan-template.md +113 -0
  37. package/assets/.aw-spec/templates/spec-template.md +131 -0
  38. package/assets/.aw-spec/templates/tasks-template.md +252 -0
  39. package/assets/.aw-spec/workflows/aw-spec/workflow.yml +77 -0
  40. package/assets/.aw-spec/workflows/workflow-registry.json +13 -0
  41. package/assets/.claude/skills/aw-spec-addcomponent/SKILL.md +116 -0
  42. package/assets/.claude/skills/aw-spec-agent-context-update/SKILL.md +31 -0
  43. package/assets/.claude/skills/aw-spec-analyze/SKILL.md +292 -0
  44. package/assets/.claude/skills/aw-spec-checklist/SKILL.md +374 -0
  45. package/assets/.claude/skills/aw-spec-clarify/SKILL.md +316 -0
  46. package/assets/.claude/skills/aw-spec-constitution/SKILL.md +190 -0
  47. package/assets/.claude/skills/aw-spec-foundation/SKILL.md +188 -0
  48. package/assets/.claude/skills/aw-spec-implement/SKILL.md +268 -0
  49. package/assets/.claude/skills/aw-spec-plan/SKILL.md +217 -0
  50. package/assets/.claude/skills/aw-spec-select-domain/SKILL.md +73 -0
  51. package/assets/.claude/skills/aw-spec-specify/SKILL.md +378 -0
  52. package/assets/.claude/skills/aw-spec-tasks/SKILL.md +255 -0
  53. package/assets/.claude/skills/aw-spec-taskstoissues/SKILL.md +107 -0
  54. package/assets/docs/README.md +106 -0
  55. package/assets/docs/VerticalSlice/PACKAGING.md +185 -0
  56. package/assets/docs/VerticalSlice/VerticalSlice.pack.txt +2833 -0
  57. package/assets/docs/VerticalSlice/pack-foundation.ps1 +145 -0
  58. package/assets/docs/VerticalSlice/pack-foundation.sh +196 -0
  59. package/assets/docs/VerticalSlice/unpack-foundation.ps1 +126 -0
  60. package/assets/docs/VerticalSlice/unpack-foundation.sh +217 -0
  61. package/assets/docs/architecture/clean-architecture.md +71 -0
  62. package/assets/docs/architecture/cqrs.md +141 -0
  63. package/assets/docs/architecture/eventing.md +83 -0
  64. package/assets/docs/architecture/folder-structure.md +61 -0
  65. package/assets/docs/architecture/modular-monolith.md +47 -0
  66. package/assets/docs/architecture/persistence.md +269 -0
  67. package/assets/docs/architecture/testing.md +55 -0
  68. package/assets/docs/architecture/vertical-slices.md +201 -0
  69. package/assets/docs/command.txt +295 -0
  70. package/assets/docs/components/Email/README.md +112 -0
  71. package/assets/docs/components/Email/integration.md +260 -0
  72. package/assets/docs/components/Jobs/README.md +113 -0
  73. package/assets/docs/components/Jobs/integration.md +245 -0
  74. package/assets/docs/components/QrGenerator/README.md +78 -0
  75. package/assets/docs/components/QrGenerator/integration.md +185 -0
  76. package/assets/docs/components/README.md +57 -0
  77. package/assets/docs/domain/domain-driven-design.md +212 -0
  78. package/assets/docs/domainspecs/healthcare/ai-rules.domain.md +34 -0
  79. package/assets/docs/domainspecs/healthcare/api-versioning.domain.md +17 -0
  80. package/assets/docs/domainspecs/healthcare/auditing.domain.md +29 -0
  81. package/assets/docs/domainspecs/healthcare/authorization.domain.md +26 -0
  82. package/assets/docs/domainspecs/healthcare/clinical-terms.md +20 -0
  83. package/assets/docs/domainspecs/healthcare/coding-standards.domain.md +26 -0
  84. package/assets/docs/domainspecs/healthcare/comandrulemap.md +119 -0
  85. package/assets/docs/domainspecs/healthcare/consent.md +19 -0
  86. package/assets/docs/domainspecs/healthcare/cqrs.domain.md +12 -0
  87. package/assets/docs/domainspecs/healthcare/data-classification.domain.md +28 -0
  88. package/assets/docs/domainspecs/healthcare/dependency-policy.domain.md +11 -0
  89. package/assets/docs/domainspecs/healthcare/dicom.md +15 -0
  90. package/assets/docs/domainspecs/healthcare/domain-driven-design.domain.md +28 -0
  91. package/assets/docs/domainspecs/healthcare/domain-requirements.md +55 -0
  92. package/assets/docs/domainspecs/healthcare/eventing.domain.md +18 -0
  93. package/assets/docs/domainspecs/healthcare/fhir.md +36 -0
  94. package/assets/docs/domainspecs/healthcare/folder-structure.domain.md +23 -0
  95. package/assets/docs/domainspecs/healthcare/hipaa.md +34 -0
  96. package/assets/docs/domainspecs/healthcare/hl7.md +15 -0
  97. package/assets/docs/domainspecs/healthcare/integration-terms.md +21 -0
  98. package/assets/docs/domainspecs/healthcare/persistence.domain.md +20 -0
  99. package/assets/docs/domainspecs/healthcare/terminology.md +30 -0
  100. package/assets/docs/domainspecs/healthcare/testing.domain.md +15 -0
  101. package/assets/docs/domainspecs/healthcare/vertical-slices.domain.md +18 -0
  102. package/assets/docs/domainspecs/healthcare/zero-trust.domain.md +12 -0
  103. package/assets/docs/domainspecs/pharma/ai-rules.domain.md +32 -0
  104. package/assets/docs/domainspecs/pharma/api-versioning.domain.md +20 -0
  105. package/assets/docs/domainspecs/pharma/atc.md +22 -0
  106. package/assets/docs/domainspecs/pharma/auditing.domain.md +26 -0
  107. package/assets/docs/domainspecs/pharma/authorization.domain.md +25 -0
  108. package/assets/docs/domainspecs/pharma/coding-standards.domain.md +28 -0
  109. package/assets/docs/domainspecs/pharma/comandrulemap.md +136 -0
  110. package/assets/docs/domainspecs/pharma/cqrs.domain.md +16 -0
  111. package/assets/docs/domainspecs/pharma/data-classification.domain.md +24 -0
  112. package/assets/docs/domainspecs/pharma/data-provenance.md +21 -0
  113. package/assets/docs/domainspecs/pharma/dependency-policy.domain.md +11 -0
  114. package/assets/docs/domainspecs/pharma/domain-driven-design.domain.md +36 -0
  115. package/assets/docs/domainspecs/pharma/domain-requirements.md +99 -0
  116. package/assets/docs/domainspecs/pharma/eventing.domain.md +18 -0
  117. package/assets/docs/domainspecs/pharma/fhir.md +31 -0
  118. package/assets/docs/domainspecs/pharma/folder-structure.domain.md +24 -0
  119. package/assets/docs/domainspecs/pharma/hl7.md +17 -0
  120. package/assets/docs/domainspecs/pharma/idmp.md +26 -0
  121. package/assets/docs/domainspecs/pharma/integration-terms.md +21 -0
  122. package/assets/docs/domainspecs/pharma/ndc.md +28 -0
  123. package/assets/docs/domainspecs/pharma/persistence.domain.md +23 -0
  124. package/assets/docs/domainspecs/pharma/pharma-terms.md +27 -0
  125. package/assets/docs/domainspecs/pharma/product-lifecycle.domain.md +30 -0
  126. package/assets/docs/domainspecs/pharma/regulatory-compliance.md +19 -0
  127. package/assets/docs/domainspecs/pharma/terminology.md +32 -0
  128. package/assets/docs/domainspecs/pharma/testing.domain.md +19 -0
  129. package/assets/docs/domainspecs/pharma/vertical-slices.domain.md +17 -0
  130. package/assets/docs/domainspecs/pharma/zero-trust.domain.md +12 -0
  131. package/assets/docs/glossary/ai-rules.md +59 -0
  132. package/assets/docs/governance/api-versioning.md +99 -0
  133. package/assets/docs/governance/coding-standards.md +87 -0
  134. package/assets/docs/governance/dependency-policy.md +40 -0
  135. package/assets/docs/interop/ihe-conformance.md +31 -0
  136. package/assets/docs/pharma-constitution.my-ref.md +86 -0
  137. package/assets/docs/requirement-spec.txt +15 -0
  138. package/assets/docs/security/auditing.md +117 -0
  139. package/assets/docs/security/authorization-matrix.md +14 -0
  140. package/assets/docs/security/authorization.md +87 -0
  141. package/assets/docs/security/data-classification.md +38 -0
  142. package/assets/docs/security/zero-trust.md +76 -0
  143. package/assets/docs/technology-constitution.md +172 -0
  144. package/dist/utils/paths.js +1 -1
  145. package/dist/utils/paths.js.map +1 -1
  146. package/package.json +1 -1
@@ -0,0 +1,188 @@
1
+ ---
2
+ name: "aw-spec-foundation"
3
+ description: "Scaffold a complete, compiling project by unpacking a verified foundation bundle (docs/<FoundationName>/<FoundationName>.pack.txt) and renaming its sentinel app name to your app name."
4
+ argument-hint: "FoundationName AppName [OutputDirectory] — e.g. VerticalSlice AppWeaver.Health"
5
+ compatibility: "Requires docs/<FoundationName>/<FoundationName>.pack.txt and unpack-foundation.ps1 to exist"
6
+ metadata:
7
+ author: "github-aw-spec"
8
+ user-invocable: true
9
+ disable-model-invocation: false
10
+ ---
11
+
12
+ ## User Input
13
+
14
+ ```text
15
+ $ARGUMENTS
16
+ ```
17
+
18
+ Parse the arguments (positional, in order):
19
+
20
+ - `FOUNDATION_NAME` — first token (e.g. `VerticalSlice`).
21
+ - `APP_NAME` — second token; the root namespace / solution name (e.g. `AppWeaver.Health`, `MyCompany.Orders`).
22
+ - `OUTPUT_DIR` — third token (optional); where to write the solution. **Default: the repo root (`.`).**
23
+
24
+ If `FOUNDATION_NAME` or `APP_NAME` is missing, stop and tell the user:
25
+
26
+ ```
27
+ Usage: /aw-spec-foundation <FoundationName> <AppName> [OutputDirectory]
28
+ Example: /aw-spec-foundation VerticalSlice AppWeaver.Health
29
+ ```
30
+
31
+ ---
32
+
33
+ ## How this works (read before acting)
34
+
35
+ This skill does **not** reconstruct files from prose rule docs anymore — that
36
+ caused broken skeletons. Instead it unpacks a **byte-for-byte bundle of a real,
37
+ verified solution** and renames the sentinel app name to `APP_NAME`.
38
+
39
+ - The bundle: `docs/<FOUNDATION_NAME>/<FOUNDATION_NAME>.pack.txt`
40
+ - The renamer: `docs/<FOUNDATION_NAME>/unpack-foundation.ps1`
41
+ - The rules for building/refreshing the bundle: `docs/<FOUNDATION_NAME>/PACKAGING.md`
42
+
43
+ The unpack script reads the **sentinel** from the pack header and rewrites it (in
44
+ dotted / underscored / lower-hyphen / lower-dot forms) across file contents and
45
+ file/folder names. The sample domain folder `Projects` and the `AppWeaver.*`
46
+ framework package references are intentionally **left unchanged**.
47
+
48
+ ---
49
+
50
+ ## Step 1 — Locate the bundle
51
+
52
+ Resolve these paths relative to the repo root:
53
+
54
+ - `PACK_FILE` = `docs/<FOUNDATION_NAME>/<FOUNDATION_NAME>.pack.txt`
55
+ - `UNPACK_PS1` = `docs/<FOUNDATION_NAME>/unpack-foundation.ps1`
56
+
57
+ Check both exist.
58
+
59
+ - If the folder `docs/<FOUNDATION_NAME>/` does not exist:
60
+ ```
61
+ Foundation '<FOUNDATION_NAME>' not found. Expected: docs/<FOUNDATION_NAME>/
62
+ Available foundations: <list the subdirectories under docs/ that contain a *.pack.txt>
63
+ ```
64
+ Then stop.
65
+
66
+ - If the folder exists but `PACK_FILE` is missing:
67
+ ```
68
+ Foundation '<FOUNDATION_NAME>' has no bundle yet (expected <PACK_FILE>).
69
+ Build it first — see docs/<FOUNDATION_NAME>/PACKAGING.md:
70
+ 1. Create the sample solution under the sentinel name in a scratch folder.
71
+ 2. Run docs/<FOUNDATION_NAME>/pack-foundation.ps1 to produce the .pack.txt.
72
+ ```
73
+ Then stop.
74
+
75
+ Read the **header lines** (those starting with `#`) at the top of `PACK_FILE` to obtain
76
+ `SENTINEL` and the declared file count. Do not parse the whole bundle yourself — the
77
+ script does the unpacking.
78
+
79
+ ---
80
+
81
+ ## Step 2 — Confirm the scaffold plan
82
+
83
+ Show this summary and wait for `yes`:
84
+
85
+ ```
86
+ Foundation : <FOUNDATION_NAME>
87
+ Bundle : <PACK_FILE> (<N> files, sentinel: <SENTINEL>)
88
+ App Name : <APP_NAME>
89
+ Output : <OUTPUT_DIR or repo root>
90
+
91
+ Rename (from bundle sentinel -> your app name):
92
+ <SENTINEL> -> <APP_NAME>
93
+ <SENTINEL _-form> -> <APP_NAME _-form>
94
+ <sentinel --form> -> <appname --form>
95
+ <sentinel .-form> -> <appname lower-dot>
96
+
97
+ Unchanged: 'Projects' sample domain, all AppWeaver.* framework packages.
98
+
99
+ Proceed? (yes/no)
100
+ ```
101
+
102
+ ---
103
+
104
+ ## Step 3 — Dry run, then unpack
105
+
106
+ First do a **dry run** to surface any path collisions without writing anything, using
107
+ the PowerShell tool:
108
+
109
+ ```powershell
110
+ & "docs/<FOUNDATION_NAME>/unpack-foundation.ps1" `
111
+ -PackFile "docs/<FOUNDATION_NAME>/<FOUNDATION_NAME>.pack.txt" `
112
+ -TargetAppName "<APP_NAME>" `
113
+ -OutDir "<OUTPUT_DIR>" `
114
+ -DryRun
115
+ ```
116
+
117
+ - If it reports files that **already exist** (the script throws on conflict unless `-Force`),
118
+ show the conflict list and ask whether to overwrite. Only add `-Force` if the user agrees.
119
+ - Otherwise run it for real (drop `-DryRun`; add `-Force` only if the user approved overwrite):
120
+
121
+ ```powershell
122
+ & "docs/<FOUNDATION_NAME>/unpack-foundation.ps1" `
123
+ -PackFile "docs/<FOUNDATION_NAME>/<FOUNDATION_NAME>.pack.txt" `
124
+ -TargetAppName "<APP_NAME>" `
125
+ -OutDir "<OUTPUT_DIR>"
126
+ ```
127
+
128
+ Capture the script's stdout (it reports the number of files written). Do **not**
129
+ hand-edit or regenerate any unpacked file.
130
+
131
+ ---
132
+
133
+ ## Step 4 — Verify
134
+
135
+ After unpacking:
136
+
137
+ 1. **File count** — confirm the written count matches the bundle's declared file count.
138
+ 2. **Sentinel residue** — search the output tree for any leftover sentinel token
139
+ (dotted/underscored/lower forms). There should be **none**. If any remain, report the
140
+ files (it indicates a case form the bundle used that the rename list missed).
141
+ 3. **Framework packages intact** — confirm `AppWeaver.*` package references in the
142
+ generated `.csproj`/`Directory.Packages.props` are unchanged.
143
+ 4. **Build (optional, recommended)** — if the .NET SDK is available, offer to build.
144
+ The solution file is whatever the bundle shipped (e.g. `api.sln`) and is **not**
145
+ renamed unless its name contains the sentinel — so discover it rather than assuming
146
+ `<APP_NAME>.sln`:
147
+ ```powershell
148
+ $sln = Get-ChildItem "<OUTPUT_DIR>" -Filter *.sln | Select-Object -First 1
149
+ dotnet build $sln.FullName -c Debug
150
+ ```
151
+ Report results; do not auto-fix — a build failure means the **bundle** needs fixing
152
+ and repacking (see PACKAGING.md), not a per-scaffold patch.
153
+
154
+ Report check failures as warnings; do not silently continue past a sentinel-residue finding.
155
+
156
+ ---
157
+
158
+ ## Step 5 — Completion report
159
+
160
+ ```
161
+ ✅ Foundation scaffold complete
162
+
163
+ Foundation : <FOUNDATION_NAME>
164
+ App Name : <APP_NAME>
165
+ Output : <OUTPUT_DIR or repo root>
166
+ Files : <N> written
167
+
168
+ Next steps:
169
+ 1. Rename the sample 'Projects' domain to your bounded context.
170
+ 2. Ensure your NuGet feed for AppWeaver.* packages is configured.
171
+ 3. Run the AppHost: dotnet run --project <OUTPUT_DIR>/src/<APP_NAME>.AppHost
172
+ 4. Use /aw-spec-specify to create your first feature spec.
173
+ ```
174
+
175
+ ---
176
+
177
+ ## Notes
178
+
179
+ - **The bundle is the source of truth.** If scaffolds come out wrong, fix the foundation
180
+ solution and re-pack (`docs/<FOUNDATION_NAME>/PACKAGING.md`) — never patch generated
181
+ output as a workaround.
182
+ - The engineering **standards** the foundation must satisfy live in the project
183
+ constitution and the domain-specs rule files (used by `/aw-spec-plan`, `/aw-spec-specify`,
184
+ etc.) — not in this foundation folder.
185
+ - To add a new foundation (e.g. `ModularMonolith`), create `docs/ModularMonolith/` with its
186
+ own `pack-foundation.ps1`, `unpack-foundation.ps1`, `PACKAGING.md`, and built
187
+ `ModularMonolith.pack.txt`, then call `/aw-spec-foundation ModularMonolith <AppName>`.
188
+ ```
@@ -0,0 +1,268 @@
1
+ ---
2
+ name: "aw-spec-implement"
3
+ description: "Execute the implementation plan by processing and executing all tasks defined in tasks.md"
4
+ argument-hint: "Optional implementation guidance or task filter"
5
+ compatibility: "Requires aw-spec project structure with .aw-spec/ directory"
6
+ metadata:
7
+ author: "github-aw-spec"
8
+ source: "templates/commands/implement.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
+ ## Auto-Loaded Engineering Standards (Required Context)
23
+
24
+ **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:
25
+
26
+ - 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`.
27
+ - If a listed file does not exist, skip it silently and continue — do **not** error and do **not** ask the user to provide it.
28
+ - 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.
29
+
30
+ Standards for `/aw-spec-implement`:
31
+ - docs/architecture/folder-structure.md
32
+ - docs/architecture/vertical-slices.md
33
+ - docs/architecture/cqrs.md
34
+ - docs/architecture/persistence.md
35
+ - docs/architecture/testing.md
36
+ - docs/architecture/eventing.md
37
+ - docs/domain/domain-driven-design.md
38
+ - docs/security/authorization.md
39
+ - docs/security/auditing.md
40
+ - docs/security/data-classification.md
41
+ - docs/security/zero-trust.md
42
+ - docs/governance/coding-standards.md
43
+ - docs/governance/dependency-policy.md
44
+ - docs/governance/api-versioning.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-implement` 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-implement:"* — 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 implementation)**:
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_implement` 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. Run `.aw-spec/scripts/bash/check-prerequisites.sh --json --require-tasks --include-tasks` from repo root and parse FEATURE_DIR and AVAILABLE_DOCS list. All paths must be absolute. For single quotes in args like "I'm Groot", use escape syntax: e.g 'I'\''m Groot' (or double-quote if possible: "I'm Groot").
104
+
105
+ 2. **Check checklists status** (if FEATURE_DIR/checklists/ exists):
106
+ - Scan all checklist files in the checklists/ directory
107
+ - For each checklist, count:
108
+ - Total items: All lines matching `- [ ]` or `- [X]` or `- [x]`
109
+ - Completed items: Lines matching `- [X]` or `- [x]`
110
+ - Incomplete items: Lines matching `- [ ]`
111
+ - Create a status table:
112
+
113
+ ```text
114
+ | Checklist | Total | Completed | Incomplete | Status |
115
+ |-----------|-------|-----------|------------|--------|
116
+ | ux.md | 12 | 12 | 0 | ✓ PASS |
117
+ | test.md | 8 | 5 | 3 | ✗ FAIL |
118
+ | security.md | 6 | 6 | 0 | ✓ PASS |
119
+ ```
120
+
121
+ - Calculate overall status:
122
+ - **PASS**: All checklists have 0 incomplete items
123
+ - **FAIL**: One or more checklists have incomplete items
124
+
125
+ - **If any checklist is incomplete**:
126
+ - Display the table with incomplete item counts
127
+ - **STOP** and ask: "Some checklists are incomplete. Do you want to proceed with implementation anyway? (yes/no)"
128
+ - Wait for user response before continuing
129
+ - If user says "no" or "wait" or "stop", halt execution
130
+ - If user says "yes" or "proceed" or "continue", proceed to step 3
131
+
132
+ - **If all checklists are complete**:
133
+ - Display the table showing all checklists passed
134
+ - Automatically proceed to step 3
135
+
136
+ 3. Load and analyze the implementation context:
137
+ - **REQUIRED**: Read tasks.md for the complete task list and execution plan
138
+ - **REQUIRED**: Read plan.md for tech stack, architecture, and file structure
139
+ - **IF EXISTS**: Read data-model.md for entities and relationships
140
+ - **IF EXISTS**: Read contracts/ for API specifications and test requirements
141
+ - **IF EXISTS**: Read research.md for technical decisions and constraints
142
+ - **IF EXISTS**: Read .aw-spec/memory/constitution.md for governance constraints
143
+ - **IF EXISTS**: Read quickstart.md for integration scenarios
144
+
145
+ 4. **Project Setup Verification**:
146
+ - **REQUIRED**: Create/verify ignore files based on actual project setup:
147
+
148
+ **Detection & Creation Logic**:
149
+ - Check if the following command succeeds to determine if the repository is a git repo (create/verify .gitignore if so):
150
+
151
+ ```sh
152
+ git rev-parse --git-dir 2>/dev/null
153
+ ```
154
+
155
+ - Check if Dockerfile* exists or Docker in plan.md → create/verify .dockerignore
156
+ - Check if .eslintrc* exists → create/verify .eslintignore
157
+ - Check if eslint.config.* exists → ensure the config's `ignores` entries cover required patterns
158
+ - Check if .prettierrc* exists → create/verify .prettierignore
159
+ - Check if .npmrc or package.json exists → create/verify .npmignore (if publishing)
160
+ - Check if terraform files (*.tf) exist → create/verify .terraformignore
161
+ - Check if .helmignore needed (helm charts present) → create/verify .helmignore
162
+
163
+ **If ignore file already exists**: Verify it contains essential patterns, append missing critical patterns only
164
+ **If ignore file missing**: Create with full pattern set for detected technology
165
+
166
+ **Common Patterns by Technology** (from plan.md tech stack):
167
+ - **Node.js/JavaScript/TypeScript**: `node_modules/`, `dist/`, `build/`, `*.log`, `.env*`
168
+ - **Python**: `__pycache__/`, `*.pyc`, `.venv/`, `venv/`, `dist/`, `*.egg-info/`
169
+ - **Java**: `target/`, `*.class`, `*.jar`, `.gradle/`, `build/`
170
+ - **C#/.NET**: `bin/`, `obj/`, `*.user`, `*.suo`, `packages/`
171
+ - **Go**: `*.exe`, `*.test`, `vendor/`, `*.out`
172
+ - **Ruby**: `.bundle/`, `log/`, `tmp/`, `*.gem`, `vendor/bundle/`
173
+ - **PHP**: `vendor/`, `*.log`, `*.cache`, `*.env`
174
+ - **Rust**: `target/`, `debug/`, `release/`, `*.rs.bk`, `*.rlib`, `*.prof*`, `.idea/`, `*.log`, `.env*`
175
+ - **Kotlin**: `build/`, `out/`, `.gradle/`, `.idea/`, `*.class`, `*.jar`, `*.iml`, `*.log`, `.env*`
176
+ - **C++**: `build/`, `bin/`, `obj/`, `out/`, `*.o`, `*.so`, `*.a`, `*.exe`, `*.dll`, `.idea/`, `*.log`, `.env*`
177
+ - **C**: `build/`, `bin/`, `obj/`, `out/`, `*.o`, `*.a`, `*.so`, `*.exe`, `*.dll`, `autom4te.cache/`, `config.status`, `config.log`, `.idea/`, `*.log`, `.env*`
178
+ - **Swift**: `.build/`, `DerivedData/`, `*.swiftpm/`, `Packages/`
179
+ - **R**: `.Rproj.user/`, `.Rhistory`, `.RData`, `.Ruserdata`, `*.Rproj`, `packrat/`, `renv/`
180
+ - **Universal**: `.DS_Store`, `Thumbs.db`, `*.tmp`, `*.swp`, `.vscode/`, `.idea/`
181
+
182
+ **Tool-Specific Patterns**:
183
+ - **Docker**: `node_modules/`, `.git/`, `Dockerfile*`, `.dockerignore`, `*.log*`, `.env*`, `coverage/`
184
+ - **ESLint**: `node_modules/`, `dist/`, `build/`, `coverage/`, `*.min.js`
185
+ - **Prettier**: `node_modules/`, `dist/`, `build/`, `coverage/`, `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`
186
+ - **Terraform**: `.terraform/`, `*.tfstate*`, `*.tfvars`, `.terraform.lock.hcl`
187
+ - **Kubernetes/k8s**: `*.secret.yaml`, `secrets/`, `.kube/`, `kubeconfig*`, `*.key`, `*.crt`
188
+
189
+ 5. Parse tasks.md structure and extract:
190
+ - **Task phases**: Setup, Tests, Core, Integration, Polish
191
+ - **Task dependencies**: Sequential vs parallel execution rules
192
+ - **Task details**: ID, description, file paths, parallel markers [P]
193
+ - **Execution flow**: Order and dependency requirements
194
+
195
+ 6. Execute implementation following the task plan:
196
+ - **Phase-by-phase execution**: Complete each phase before moving to the next
197
+ - **Respect dependencies**: Run sequential tasks in order, parallel tasks [P] can run together
198
+ - **Follow TDD approach**: Execute test tasks before their corresponding implementation tasks
199
+ - **File-based coordination**: Tasks affecting the same files must run sequentially
200
+ - **Validation checkpoints**: Verify each phase completion before proceeding
201
+
202
+ 7. Implementation execution rules:
203
+ - **Setup first**: Initialize project structure, dependencies, configuration
204
+ - **Tests before code**: If you need to write tests for contracts, entities, and integration scenarios
205
+ - **Core development**: Implement models, services, CLI commands, endpoints
206
+ - **Integration work**: Database connections, middleware, logging, external services
207
+ - **Polish and validation**: Unit tests, performance optimization, documentation
208
+
209
+ 8. Progress tracking and error handling:
210
+ - Report progress after each completed task
211
+ - Halt execution if any non-parallel task fails
212
+ - For parallel tasks [P], continue with successful tasks, report failed ones
213
+ - Provide clear error messages with context for debugging
214
+ - Suggest next steps if implementation cannot proceed
215
+ - **IMPORTANT** For completed tasks, make sure to mark the task off as [X] in the tasks file.
216
+
217
+ 9. Completion validation:
218
+ - Verify all required tasks are completed
219
+ - Check that implemented features match the original specification
220
+ - Validate that tests pass and coverage meets requirements
221
+ - Confirm the implementation follows the technical plan
222
+
223
+ Note: This command assumes a complete task breakdown exists in tasks.md. If tasks are incomplete or missing, suggest running `/aw-spec-tasks` first to regenerate the task list.
224
+
225
+ ## Mandatory Post-Execution Hooks
226
+
227
+ **You MUST complete this section before reporting completion to the user.**
228
+
229
+ Check if `.aw-spec/extensions.yml` exists in the project root.
230
+ - If it does not exist, or no hooks are registered under `hooks.after_implement`, skip to the Completion Report.
231
+ - If it exists, read it and look for entries under the `hooks.after_implement` key.
232
+ - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue to the Completion Report.
233
+ - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
234
+ - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
235
+ - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
236
+ - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
237
+ - When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `aw-spec.git.commit` → `/aw-spec-git-commit`.
238
+ - For each executable hook, output the following based on its `optional` flag:
239
+ - **Mandatory hook** (`optional: false`) — **You MUST emit `EXECUTE_COMMAND:` for each mandatory hook**:
240
+ ```
241
+ ## Extension Hooks
242
+
243
+ **Automatic Hook**: {extension}
244
+ Executing: `/{command}`
245
+ EXECUTE_COMMAND: {command}
246
+ ```
247
+ - **Optional hook** (`optional: true`):
248
+ ```
249
+ ## Extension Hooks
250
+
251
+ **Optional Hook**: {extension}
252
+ Command: `/{command}`
253
+ Description: {description}
254
+
255
+ Prompt: {prompt}
256
+ To execute: `/{command}`
257
+ ```
258
+
259
+ ## Completion Report
260
+
261
+ Report final status with summary of completed work.
262
+
263
+ ## Done When
264
+
265
+ - [ ] All tasks in tasks.md completed and marked `[X]`
266
+ - [ ] Implementation validated against specification, plan, and test coverage
267
+ - [ ] Extension hooks dispatched or skipped according to the rules in Mandatory Post-Execution Hooks above
268
+ - [ ] Completion reported to user with summary of completed work
@@ -0,0 +1,217 @@
1
+ ---
2
+ name: "aw-spec-plan"
3
+ description: "Execute the implementation planning workflow using the plan template to generate design artifacts."
4
+ argument-hint: "Optional guidance for the planning phase"
5
+ compatibility: "Requires aw-spec project structure with .aw-spec/ directory"
6
+ metadata:
7
+ author: "github-aw-spec"
8
+ source: "templates/commands/plan.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
+ ## Auto-Loaded Engineering Standards (Required Context)
23
+
24
+ **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:
25
+
26
+ - 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`.
27
+ - If a listed file does not exist, skip it silently and continue — do **not** error and do **not** ask the user to provide it.
28
+ - 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.
29
+
30
+ Standards for `/aw-spec-plan`:
31
+ - docs/architecture/clean-architecture.md
32
+ - docs/architecture/modular-monolith.md
33
+ - docs/architecture/folder-structure.md
34
+ - docs/architecture/cqrs.md
35
+ - docs/architecture/vertical-slices.md
36
+ - docs/architecture/persistence.md
37
+ - docs/architecture/testing.md
38
+ - docs/architecture/eventing.md
39
+ - docs/domain/domain-driven-design.md
40
+ - docs/security/zero-trust.md
41
+ - docs/security/authorization.md
42
+ - docs/security/auditing.md
43
+ - docs/security/data-classification.md
44
+ - docs/governance/coding-standards.md
45
+ - docs/governance/dependency-policy.md
46
+ - docs/governance/api-versioning.md
47
+ - docs/glossary/ai-rules.md
48
+
49
+ ## Domain Rule-File Selection (interactive)
50
+
51
+ 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:
52
+
53
+ 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-plan` heading in `docs/domainspecs/<domain>/comandrulemap.md`.
54
+ 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:
55
+ - 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"**.
56
+ - **Continue (technical only)** → skip steps 3-5 and proceed with only the auto-loaded technical standards (plus any `@`-mentioned files).
57
+ - **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.
58
+ - If interactive questions cannot be asked (non-interactive/automated run), default to **Continue (technical only)**.
59
+ - 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.
60
+ 3. **Show a selection box** using the AskUserQuestion tool:
61
+ - Ask one single-select question — *"Domain rule files for /aw-spec-plan:"* — with options **"Select all (recommended)"**, **"Pick a subset"**, and **"None (technical only)"**.
62
+ - 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.
63
+ - If interactive questions cannot be asked (non-interactive or automated run), skip the prompt and default to **Select all**.
64
+ 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.
65
+ 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.
66
+ 6. Proceed to the Pre-Execution Checks only after the selected files are loaded.
67
+
68
+ ## Pre-Execution Checks
69
+
70
+ **Check for extension hooks (before planning)**:
71
+ - Check if `.aw-spec/extensions.yml` exists in the project root.
72
+ - If it exists, read it and look for entries under the `hooks.before_plan` key
73
+ - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
74
+ - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
75
+ - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
76
+ - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
77
+ - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
78
+ - When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `aw-spec.git.commit` → `/aw-spec-git-commit`.
79
+ - For each executable hook, output the following based on its `optional` flag:
80
+ - **Optional hook** (`optional: true`):
81
+ ```
82
+ ## Extension Hooks
83
+
84
+ **Optional Pre-Hook**: {extension}
85
+ Command: `/{command}`
86
+ Description: {description}
87
+
88
+ Prompt: {prompt}
89
+ To execute: `/{command}`
90
+ ```
91
+ - **Mandatory hook** (`optional: false`):
92
+ ```
93
+ ## Extension Hooks
94
+
95
+ **Automatic Pre-Hook**: {extension}
96
+ Executing: `/{command}`
97
+ EXECUTE_COMMAND: {command}
98
+
99
+ Wait for the result of the hook command before proceeding to the Outline.
100
+ ```
101
+ - If no hooks are registered or `.aw-spec/extensions.yml` does not exist, skip silently
102
+
103
+ ## Outline
104
+
105
+ 1. **Setup**: Run `.aw-spec/scripts/bash/setup-plan.sh --json` from repo root and parse JSON for FEATURE_SPEC, IMPL_PLAN, SPECS_DIR, BRANCH. For single quotes in args like "I'm Groot", use escape syntax: e.g 'I'\''m Groot' (or double-quote if possible: "I'm Groot").
106
+
107
+ 2. **Load context**: Read FEATURE_SPEC and `.aw-spec/memory/constitution.md`. Load IMPL_PLAN template (already copied).
108
+
109
+ 3. **Execute plan workflow**: Follow the structure in IMPL_PLAN template to:
110
+ - Fill Technical Context (mark unknowns as "NEEDS CLARIFICATION")
111
+ - Fill Constitution Check section from constitution
112
+ - Evaluate gates (ERROR if violations unjustified)
113
+ - Phase 0: Generate research.md (resolve all NEEDS CLARIFICATION)
114
+ - Phase 1: Generate data-model.md, contracts/, quickstart.md
115
+ - Phase 1: Update agent context by running the agent script
116
+ - Re-evaluate Constitution Check post-design
117
+
118
+ ## Mandatory Post-Execution Hooks
119
+
120
+ **You MUST complete this section before reporting completion to the user.**
121
+
122
+ Check if `.aw-spec/extensions.yml` exists in the project root.
123
+ - If it does not exist, or no hooks are registered under `hooks.after_plan`, skip to the Completion Report.
124
+ - If it exists, read it and look for entries under the `hooks.after_plan` key.
125
+ - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue to the Completion Report.
126
+ - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
127
+ - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
128
+ - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
129
+ - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
130
+ - When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `aw-spec.git.commit` → `/aw-spec-git-commit`.
131
+ - For each executable hook, output the following based on its `optional` flag:
132
+ - **Mandatory hook** (`optional: false`) — **You MUST emit `EXECUTE_COMMAND:` for each mandatory hook**:
133
+ ```
134
+ ## Extension Hooks
135
+
136
+ **Automatic Hook**: {extension}
137
+ Executing: `/{command}`
138
+ EXECUTE_COMMAND: {command}
139
+ ```
140
+ - **Optional hook** (`optional: true`):
141
+ ```
142
+ ## Extension Hooks
143
+
144
+ **Optional Hook**: {extension}
145
+ Command: `/{command}`
146
+ Description: {description}
147
+
148
+ Prompt: {prompt}
149
+ To execute: `/{command}`
150
+ ```
151
+
152
+ ## Completion Report
153
+
154
+ Command ends after Phase 2 planning. Report branch, IMPL_PLAN path, and generated artifacts.
155
+
156
+ ## Phases
157
+
158
+ ### Phase 0: Outline & Research
159
+
160
+ 1. **Extract unknowns from Technical Context** above:
161
+ - For each NEEDS CLARIFICATION → research task
162
+ - For each dependency → best practices task
163
+ - For each integration → patterns task
164
+
165
+ 2. **Generate and dispatch research agents**:
166
+
167
+ ```text
168
+ For each unknown in Technical Context:
169
+ Task: "Research {unknown} for {feature context}"
170
+ For each technology choice:
171
+ Task: "Find best practices for {tech} in {domain}"
172
+ ```
173
+
174
+ 3. **Consolidate findings** in `research.md` using format:
175
+ - Decision: [what was chosen]
176
+ - Rationale: [why chosen]
177
+ - Alternatives considered: [what else evaluated]
178
+
179
+ **Output**: research.md with all NEEDS CLARIFICATION resolved
180
+
181
+ ### Phase 1: Design & Contracts
182
+
183
+ **Prerequisites:** `research.md` complete
184
+
185
+ 1. **Extract entities from feature spec** → `data-model.md`:
186
+ - Entity name, fields, relationships
187
+ - Validation rules from requirements
188
+ - State transitions if applicable
189
+
190
+ 2. **Define interface contracts** (if project has external interfaces) → `/contracts/`:
191
+ - Identify what interfaces the project exposes to users or other systems
192
+ - Document the contract format appropriate for the project type
193
+ - Examples: public APIs for libraries, command schemas for CLI tools, endpoints for web services, grammars for parsers, UI contracts for applications
194
+ - Skip if project is purely internal (build scripts, one-off tools, etc.)
195
+
196
+ 3. **Create quickstart validation guide** → `quickstart.md`:
197
+ - Document runnable validation scenarios that prove the feature works end-to-end
198
+ - Include prerequisites, setup commands, test/run commands, and expected outcomes
199
+ - Use links or references to contracts and data model details instead of duplicating them
200
+ - Do not include full implementation code, model/service/controller bodies, migrations, or complete test suites
201
+ - Keep this artifact as a validation/run guide; implementation details belong in `tasks.md` and the implementation phase
202
+
203
+ 4. **Agent context update**:
204
+ - Update the plan reference between the `<!-- AW-SPEC START -->` and `<!-- AW-SPEC END -->` markers in `CLAUDE.md` to point to the plan file created in step 1 (the IMPL_PLAN path)
205
+
206
+ **Output**: data-model.md, /contracts/*, quickstart.md, updated agent context file
207
+
208
+ ## Key rules
209
+
210
+ - Use absolute paths for filesystem operations; use project-relative paths for references in documentation and agent context files
211
+ - ERROR on gate failures or unresolved clarifications
212
+
213
+ ## Done When
214
+
215
+ - [ ] Plan workflow executed and design artifacts generated
216
+ - [ ] Extension hooks dispatched or skipped according to the rules in Mandatory Post-Execution Hooks above
217
+ - [ ] Completion reported to user with branch, plan path, and generated artifacts