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
@@ -86,17 +86,30 @@ registration scaffold, and verification steps — do not invent integration step
86
86
 
87
87
  7. **Add the code (one or more selected).** Execute the chosen component's `integration.md` runbook
88
88
  **in order** for the selected implementation(s):
89
- - Locate the target projects the runbook names (typically `…Application`, `…Infrastructure`,
90
- `…Service`; map the roles if the layout differs).
89
+ - Resolve the **host/startup project** the runbook targets — the single project that owns
90
+ `Program.cs` + the ASP.NET Core web SDK (`<App>.Service` for the Vertical Slice foundation,
91
+ `<App>.API` for the Modular Monolith foundation, or another name in a future template). **Find it
92
+ by locating `Program.cs`, not by assuming a fixed name.** These foundations have **no** separate
93
+ `…Application` / `…Infrastructure` project — package references, registration, and
94
+ `appsettings.json` all target this one project.
91
95
  - Apply the runbook's **"Common steps"** once.
92
96
  - Apply each selected implementation's **block** (package version in
93
97
  `Directory.Packages.props`, `PackageReference` without `Version=`, registration line, config).
94
98
  - Set `options.Provider` per the runbook (when multiple implementations are selected, follow the
95
99
  runbook's rule for choosing the default/active provider — ask a single-select follow-up if it
96
100
  requires one).
97
- - Honor the cross-cutting rules in `docs/components/README.md` (R0.1–R0.5): versions only in
98
- `Directory.Packages.props`; register in Infrastructure; inject the abstraction; always set
99
- `options.Provider`; never commit secrets.
101
+ - Honor the cross-cutting rules in `docs/components/README.md` (R0.1–R0.5, incl. R0.2a): versions
102
+ only in `Directory.Packages.props`; register in the host/startup project resolved via `Program.cs`
103
+ (R0.2 — its `Extensions/InfrastructureServiceRegistration.cs`/`AddInfrastructure` if present,
104
+ else `Program.cs`); inject the abstraction; always set `options.Provider`; never commit secrets.
105
+ - **Register in both startup paths when they exist (R0.2a).** If the host project splits
106
+ registration into `AddInfrastructure` (`Extensions/InfrastructureServiceRegistration.cs`) **and**
107
+ `AddAspireInfrastructure` (`Extensions/AspireInfrastructureExtensions.cs`) — the
108
+ `if (isAspire) AddAspireInfrastructure(...) else AddInfrastructure(...)` switch in `Program.cs` —
109
+ add the component's registration to **both** methods, not just `AddInfrastructure`. The block is
110
+ the same in each, differing only in provider-specific calls (connection strings, `UseSqlite` vs
111
+ `UseNpgsql`) that must match that method's existing provider. Registering in only one leaves the
112
+ component missing whenever the app runs in the other mode.
100
113
  - Run any optional usage/feature-slice and schema steps only if the runbook calls for them or the
101
114
  user asks.
102
115
 
@@ -19,6 +19,10 @@ $ARGUMENTS
19
19
 
20
20
  You **MUST** consider the user input before proceeding (if not empty).
21
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
+
22
26
  ## Auto-Loaded Engineering Standards (Required Context)
23
27
 
24
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:
@@ -19,6 +19,10 @@ $ARGUMENTS
19
19
 
20
20
  You **MUST** consider the user input before proceeding (if not empty).
21
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
+
22
26
  ## Auto-Loaded Engineering Standards (Required Context)
23
27
 
24
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:
@@ -19,6 +19,10 @@ $ARGUMENTS
19
19
 
20
20
  You **MUST** consider the user input before proceeding (if not empty).
21
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
+
22
26
  ## Auto-Loaded Engineering Standards (Required Context)
23
27
 
24
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:
@@ -0,0 +1,268 @@
1
+ ---
2
+ name: "aw-spec-fast-implement"
3
+ description: "Token-efficient fast path that collapses /aw-spec-plan + /aw-spec-tasks + /aw-spec-analyze + /aw-spec-implement into a single pass: load engineering and domain standards once, derive a compact design, self-check it, and implement the spec directly following both technological and domain patterns. Run after /aw-spec-specify (and optionally /aw-spec-clarify or a verify step)."
4
+ argument-hint: "Optional implementation guidance, scope filter (e.g. backend-only), or design hints"
5
+ compatibility: "Requires aw-spec project structure with .aw-spec/ directory and an existing spec.md (produced by /aw-spec-specify)"
6
+ metadata:
7
+ author: "github-aw-spec"
8
+ source: "templates/commands/fast-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
+ ## 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
+ ## What this command does
27
+
28
+ Collapses `/aw-spec-plan` → `/aw-spec-tasks` → `/aw-spec-analyze` → `/aw-spec-implement` into one pass: load the deduplicated union of standards + domain rules **once**, fold the design into a single compact `plan.md` + `tasks.md` (no separate research/data-model/contracts/quickstart), inline the analyze consistency check as an in-memory gate, then implement. Same end result as the full sequence; non-negotiables (constitution, standards, domain rules, spec checklist, constitution/coverage gates, architecture patterns, extension hooks) are all honored — only the intermediate documents and repeated context loads are dropped.
29
+
30
+ ## Project Structure Gate (run before loading standards)
31
+
32
+ **Before loading standards or writing code, confirm a scaffolded app exists** — the output of `/aw-spec-foundation`, not just `.aw-spec/`/`docs/`/`specs/` framework files. Check the repo root (Glob/Bash) for a real build entrypoint, ignoring matches only inside `.aw-spec/`/`docs/`/`specs/`: `*.sln` or `*.csproj` under `src/` (.NET/AppWeaver), else `package.json`/`pom.xml`/`build.gradle`/`go.mod`/`Cargo.toml`/`pyproject.toml` etc.
33
+
34
+ - **None found → STOP, no side effects** (don't load standards, run hooks, or write anything): tell the developer *"No scaffolded project found — run `/aw-spec-foundation ModularMonolith <AppName>` (or `VerticalSlice <AppName>`) first, then re-run."*
35
+ - **Found →** use its solution/host-project path as the implementation target and continue.
36
+
37
+ ## Auto-Loaded Engineering Standards (Required Context)
38
+
39
+ **Before doing anything else in this command, load the project engineering-standards files listed below into context using the Read tool — ONCE.** These were previously supplied manually as `@docs/...` mentions; they are now loaded automatically so the user does not need to pass them. Rules:
40
+
41
+ - 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`.
42
+ - This list is the **deduplicated union** of the standards that `/aw-spec-plan`, `/aw-spec-tasks`, `/aw-spec-analyze`, and `/aw-spec-implement` each load. Load every file **exactly once**; do not re-read a file you have already loaded in this pass.
43
+ - If a listed file does not exist, skip it silently and continue — do **not** error and do **not** ask the user to provide it.
44
+ - 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.
45
+
46
+ Standards for `/aw-spec-fast-implement` (union of the collapsed commands):
47
+ - docs/architecture/clean-architecture.md
48
+ - docs/architecture/modular-monolith.md
49
+ - docs/architecture/folder-structure.md
50
+ - docs/architecture/cqrs.md
51
+ - docs/architecture/vertical-slices.md
52
+ - docs/architecture/persistence.md
53
+ - docs/architecture/testing.md
54
+ - docs/architecture/eventing.md
55
+ - docs/domain/domain-driven-design.md
56
+ - docs/security/zero-trust.md
57
+ - docs/security/authorization.md
58
+ - docs/security/auditing.md
59
+ - docs/security/data-classification.md
60
+ - docs/governance/coding-standards.md
61
+ - docs/governance/dependency-policy.md
62
+ - docs/governance/api-versioning.md
63
+ - docs/glossary/ai-rules.md
64
+
65
+ ## Domain Rule-File Selection (interactive, once)
66
+
67
+ After the technical standards above are loaded, and **before** the Pre-Execution Checks, resolve the active domain and ask the user — **once for the whole pass** — which **domain** rule files to load:
68
+
69
+ 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-fast-implement`** heading in `docs/domainspecs/<domain>/comandrulemap.md` — this command has its own canonical entry, exactly like every other `/aw-spec-*` command.
70
+ - **Fallback (older domain maps).** If `comandrulemap.md` exists but has **no** `## /aw-spec-fast-implement` heading, derive the candidate set as the **deduplicated union** of the bullet lists under the `## /aw-spec-plan`, `## /aw-spec-tasks`, `## /aw-spec-analyze`, and `## /aw-spec-implement` headings (in practice `/aw-spec-plan` is the superset). A missing fast-implement heading is **not** an error.
71
+ 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:
72
+ - 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"**.
73
+ - **Continue (technical only)** → skip steps 3-5 and proceed with only the auto-loaded technical standards (plus any `@`-mentioned files).
74
+ - **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.
75
+ - If interactive questions cannot be asked (non-interactive/automated run), default to **Continue (technical only)**.
76
+ - Exception: if `comandrulemap.md` exists but yields no candidate files (no `## /aw-spec-fast-implement` heading **and** none of the four fallback headings have entries), this is **not** a gate trigger — load no domain files and continue normally to the Pre-Execution Checks.
77
+ 3. **Show a selection box** using the AskUserQuestion tool:
78
+ - Ask one single-select question — *"Domain rule files for /aw-spec-fast-implement:"* — with options **"Select all (recommended)"**, **"Pick a subset"**, and **"None (technical only)"**.
79
+ - 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.
80
+ - If interactive questions cannot be asked (non-interactive or automated run), skip the prompt and default to **Select all**.
81
+ 4. **Load the selection.** Read every file the user selected **exactly once** (the full deduplicated 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.
82
+ 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.
83
+ 6. Proceed to the Pre-Execution Checks only after the selected files are loaded.
84
+
85
+ ## Pre-Execution Checks
86
+
87
+ **Check for collapsed pre-hooks (before fast implementation)**:
88
+ - Check if `.aw-spec/extensions.yml` exists in the project root.
89
+ - If it exists, read it and collect hook entries from the `hooks.before_plan`, `hooks.before_tasks`, and `hooks.before_implement` keys (the pre-hook points of the commands this fast path collapses).
90
+ - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally.
91
+ - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
92
+ - **De-duplicate by command**: if the same hook `command` appears under more than one of those keys, execute it **only once** for this pass.
93
+ - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
94
+ - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
95
+ - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
96
+ - When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `aw-spec.git.commit` → `/aw-spec-git-commit`.
97
+ - For each executable hook, output the following based on its `optional` flag:
98
+ - **Optional hook** (`optional: true`):
99
+ ```
100
+ ## Extension Hooks
101
+
102
+ **Optional Pre-Hook**: {extension}
103
+ Command: `/{command}`
104
+ Description: {description}
105
+
106
+ Prompt: {prompt}
107
+ To execute: `/{command}`
108
+ ```
109
+ - **Mandatory hook** (`optional: false`):
110
+ ```
111
+ ## Extension Hooks
112
+
113
+ **Automatic Pre-Hook**: {extension}
114
+ Executing: `/{command}`
115
+ EXECUTE_COMMAND: {command}
116
+
117
+ Wait for the result of the hook command before proceeding to the Outline.
118
+ ```
119
+ - If no hooks are registered or `.aw-spec/extensions.yml` does not exist, skip silently.
120
+
121
+ ## Outline
122
+
123
+ ### 1. Resolve paths and seed artifacts (reuses the standard scripts)
124
+
125
+ 1. Run `.aw-spec/scripts/bash/setup-plan.sh --json` from repo root and parse JSON for `FEATURE_SPEC`, `IMPL_PLAN`, `SPECS_DIR`, `BRANCH`. All paths must be absolute. This step also copies the resolved `plan-template` to `IMPL_PLAN` if no plan exists yet (so the next script can resolve the tasks template). 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").
126
+ 2. **Spec gate**: Read `FEATURE_SPEC` (`spec.md`). If it does not exist or is empty, **STOP** and tell the user to run `/aw-spec-specify` first — this fast path requires a written spec. Do not invent a spec.
127
+ 3. Run `.aw-spec/scripts/bash/setup-tasks.sh --json` from repo root and parse `FEATURE_DIR`, `TASKS_TEMPLATE`, and `AVAILABLE_DOCS`. `TASKS_TEMPLATE` is the resolved tasks template to use when writing `tasks.md`. If `TASKS_TEMPLATE` is empty, fall back to `.aw-spec/templates/tasks-template.md`.
128
+
129
+ ### 2. Load the minimal authoritative context
130
+
131
+ - **REQUIRED**: `spec.md` — user stories with priorities (P1, P2, P3…), Functional Requirements (FR-###), Success Criteria (SC-###), Key Entities, edge cases.
132
+ - **IF EXISTS**: `.aw-spec/memory/constitution.md` — governance constraints (authoritative; MUST principles are non-negotiable).
133
+ - **IF EXISTS**: `FEATURE_DIR/checklists/requirements.md` — the spec quality checklist produced by `/aw-spec-specify`.
134
+ - **IF EXISTS**: any of `research.md`, `data-model.md`, `contracts/`, `quickstart.md` already present in `FEATURE_DIR` (from a prior partial run) — reuse them instead of regenerating.
135
+ - The engineering standards and domain rule files were already loaded above; **do not re-read them**.
136
+
137
+ ### 3. Spec-readiness gate (folds in checklist + clarification status)
138
+
139
+ - If `checklists/requirements.md` exists, scan it. Count total / completed / incomplete items.
140
+ - If any item is incomplete, display a short status line and **ask once**: "The spec quality checklist has incomplete items. Proceed with fast implementation anyway? (yes/no)". Halt on "no"/"stop"/"wait"; continue on "yes"/"proceed"/"continue". In a non-interactive run, default to proceed but record the gap in the Completion Report.
141
+ - If the spec still contains unresolved `[NEEDS CLARIFICATION]` markers, list them and either (a) make a documented reasonable assumption (preferred for the fast path, recorded under Assumptions in `plan.md`), or (b) if a marker is high-impact on scope/security, ask the user a single targeted question before proceeding.
142
+
143
+ ### 4. Derive the design — write a single compact `plan.md`
144
+
145
+ Fill `IMPL_PLAN` (`plan.md`) from the resolved plan template, then **append a "Design Detail" section** so this one file carries everything the separate `research.md` + `data-model.md` + `contracts/` + `quickstart.md` would have carried. Keep it compact — decisions and structure, not prose.
146
+
147
+ Populate:
148
+ - **Summary**: primary requirement + chosen technical approach.
149
+ - **Technical Context**: language/version, primary dependencies, storage, testing, target platform, project type, performance goals, constraints, scale/scope. Resolve unknowns with documented assumptions (do **not** leave `NEEDS CLARIFICATION` for the fast path unless genuinely blocking).
150
+ - **Constitution Check**: evaluate the gates from `.aw-spec/memory/constitution.md`. If a MUST principle is violated and unjustified, **STOP** and report — do not implement around a constitution violation.
151
+ - **Project Structure**: the concrete source layout for this feature, following `docs/architecture/folder-structure.md`, `vertical-slices.md`, and the active domain's `folder-structure.domain.md`. Remove unused template options.
152
+ - **Design Detail** (folded artifacts):
153
+ - *Data Model*: entities, fields, relationships, validation rules, and state transitions (replaces `data-model.md`).
154
+ - *Contracts*: the interfaces this feature exposes — endpoints / commands / queries / events with their request-response shapes, mapped to the user story they serve (replaces `contracts/`). Follow `cqrs.md`, `api-versioning.md`, and the domain interop rules (e.g. FHIR/HL7) where applicable.
155
+ - *Decisions & Rationale*: key technical decisions, why chosen, and notable alternatives rejected (replaces `research.md`).
156
+ - *Validation Quickstart*: the runnable steps that prove the feature works end-to-end (replaces `quickstart.md`).
157
+ - Re-check the Constitution gate after the design is fleshed out.
158
+
159
+ ### 5. Derive the task plan — write `tasks.md`
160
+
161
+ Using `TASKS_TEMPLATE` as the structure, write `tasks.md` organized **by user story** so each story is independently implementable and testable. Follow the strict checklist format from the template:
162
+
163
+ ```text
164
+ - [ ] [TaskID] [P?] [Story?] Description with exact file path
165
+ ```
166
+
167
+ - **Phase 1: Setup** (project initialization) — no story label.
168
+ - **Phase 2: Foundational** (blocking prerequisites for all stories) — no story label.
169
+ - **Phase 3+: one phase per user story** in priority order (P1, P2, P3…), each with a goal and independent-test criterion, each carrying its `[US#]` label.
170
+ - **Final Phase: Polish & cross-cutting concerns** — no story label.
171
+ - **Tests are OPTIONAL** — only generate test tasks if the spec explicitly requests tests or TDD. When generated, tests precede their implementation tasks (write-fail-implement) per `docs/architecture/testing.md`.
172
+ - Mark `[P]` only for tasks on different files with no incomplete dependencies. Give every task an exact file path.
173
+
174
+ ### 6. Inline consistency self-check (replaces `/aw-spec-analyze`)
175
+
176
+ Before writing any code, run a quick **in-memory** gate across `spec.md`, the `plan.md` you just wrote, and `tasks.md`. Do **not** write a report file. Check:
177
+ - **Coverage**: every Functional Requirement and every user story maps to ≥1 task; every buildable Success Criterion (performance/security/availability tooling) has a task. Flag any requirement with zero coverage.
178
+ - **Constitution alignment**: no requirement, design element, or task conflicts with a MUST principle (CRITICAL if it does).
179
+ - **Consistency**: no terminology drift, no conflicting tech choices, no task-ordering contradictions (e.g. integration before its foundational setup).
180
+ - **Ambiguity / underspecification**: vague attributes lacking measurable criteria; tasks referencing undefined components.
181
+
182
+ Resolution:
183
+ - **CRITICAL issues** (constitution MUST violation, zero-coverage of baseline functionality, conflicting requirements): **STOP**, summarize them, and ask the user how to proceed — adjust `plan.md`/`tasks.md` rather than implementing on a broken foundation.
184
+ - **HIGH/MEDIUM/LOW issues**: fix them in `plan.md`/`tasks.md` in place when cheap, otherwise note them and continue.
185
+
186
+ ### 7. Project setup verification
187
+
188
+ Create/verify ignore files based on the actual stack from `plan.md` (this is a .NET/C# AppWeaver project by default — `bin/`, `obj/`, `*.user`, `*.suo` for `.gitignore`; add Docker/other patterns only if detected). Use `git rev-parse --git-dir` to confirm a git repo before creating `.gitignore`. Append only missing critical patterns to existing ignore files; do not overwrite them.
189
+
190
+ ### 8. Implement directly
191
+
192
+ Execute the tasks in `tasks.md`, phase by phase, applying the loaded standards and domain patterns:
193
+ - **Setup → Foundational → User Stories (priority order) → Polish.** Complete each phase before the next; respect dependencies; `[P]` tasks may proceed together; tasks on the same file run sequentially.
194
+ - **Follow the patterns**: vertical slices, CQRS command/query separation, DDD aggregates/value objects, the prescribed folder structure, persistence/eventing conventions, authorization/auditing/data-classification/zero-trust requirements, and the active domain's overlays (e.g. FHIR/HL7 mapping, consent, HIPAA, audit) — all already in context.
195
+ - **TDD when requested**: write the story's tests first and see them fail before implementing.
196
+ - **Mark every completed task `[X]` in `tasks.md`** as you finish it.
197
+ - Report progress per phase. Halt on a failing non-parallel task with a clear, actionable error; for `[P]` tasks, continue the successful ones and report the failures.
198
+
199
+ ### 9. Completion validation
200
+
201
+ - All required tasks completed and marked `[X]`.
202
+ - Implementation matches `spec.md` (requirements + user stories) and the `plan.md` design.
203
+ - The project builds; if tests were requested, they pass.
204
+ - The validation quickstart steps in `plan.md` succeed (or are clearly documented as pending).
205
+
206
+ ## Mandatory Post-Execution Hooks
207
+
208
+ **You MUST complete this section before reporting completion to the user.**
209
+
210
+ Check if `.aw-spec/extensions.yml` exists in the project root.
211
+ - If it does not exist, skip to the Completion Report.
212
+ - If it exists, read it and collect hook entries from the `hooks.after_plan`, `hooks.after_tasks`, and `hooks.after_implement` keys (the post-hook points of the commands this fast path collapses).
213
+ - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue to the Completion Report.
214
+ - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
215
+ - **De-duplicate by command**: if the same hook `command` (e.g. `aw-spec.agent-context.update`, which is registered for both `after_plan` and elsewhere) appears under more than one of those keys, execute it **only once** for this pass.
216
+ - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
217
+ - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
218
+ - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
219
+ - When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `aw-spec.git.commit` → `/aw-spec-git-commit`.
220
+ - For each executable hook, output the following based on its `optional` flag:
221
+ - **Mandatory hook** (`optional: false`) — **You MUST emit `EXECUTE_COMMAND:` for each mandatory hook**:
222
+ ```
223
+ ## Extension Hooks
224
+
225
+ **Automatic Hook**: {extension}
226
+ Executing: `/{command}`
227
+ EXECUTE_COMMAND: {command}
228
+ ```
229
+ - **Optional hook** (`optional: true`):
230
+ ```
231
+ ## Extension Hooks
232
+
233
+ **Optional Hook**: {extension}
234
+ Command: `/{command}`
235
+ Description: {description}
236
+
237
+ Prompt: {prompt}
238
+ To execute: `/{command}`
239
+ ```
240
+
241
+ ## Completion Report
242
+
243
+ Report final status with:
244
+ - `FEATURE_DIR`, `plan.md`, and `tasks.md` paths.
245
+ - Task summary: total tasks, tasks per user story, how many are now `[X]`.
246
+ - Standards and domain rule files applied (domain name + count, or "technical only").
247
+ - Any consistency-gate findings that were noted but not blocking.
248
+ - Build/test status and whether the validation quickstart passed.
249
+ - Any documented assumptions or deferred items.
250
+
251
+ ## Key rules
252
+
253
+ - Use absolute paths for filesystem operations; use project-relative paths for references in `plan.md`/`tasks.md` and agent-context files.
254
+ - Load each standards/domain/spec file **once** per pass — never re-read context you already hold. This single-load discipline is the primary token saving over the four-command sequence.
255
+ - The constitution and the loaded standards are authoritative. **ERROR/STOP on unjustified constitution-gate failures or zero-coverage of baseline functionality** rather than implementing around them.
256
+ - This command assumes `spec.md` exists. If it is missing, suggest `/aw-spec-specify`. If the user wants the full, audited artifact set (separate research/data-model/contracts/quickstart + analysis report), suggest the standard `/aw-spec-plan → /aw-spec-tasks → /aw-spec-analyze → /aw-spec-implement` sequence instead.
257
+
258
+ ## Done When
259
+
260
+ - [ ] Engineering standards and domain rule files loaded **once** (deduplicated union)
261
+ - [ ] `spec.md` present and read; spec-readiness gate cleared or its gaps documented
262
+ - [ ] Compact `plan.md` written (with folded data-model / contracts / decisions / quickstart) and constitution gate passed
263
+ - [ ] `tasks.md` generated by user story in strict checklist format
264
+ - [ ] Inline consistency self-check passed (no unresolved CRITICAL issues)
265
+ - [ ] All tasks implemented following technological and domain standards, and marked `[X]`
266
+ - [ ] Implementation validated against spec, plan, and (if requested) tests
267
+ - [ ] Extension hooks dispatched or skipped per the rules above
268
+ - [ ] Completion reported with artifact paths, task summary, standards applied, and build/test status