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,73 @@
1
+ ---
2
+ name: "aw-spec-select-domain"
3
+ description: "Select the active domain-specs folder and store it in .aw-spec/domain.json, so all AW-Spec commands load the right domain rule files."
4
+ argument-hint: "Optional domain folder name to set directly (e.g. healthcare)"
5
+ compatibility: "Requires aw-spec project structure with .aw-spec/ and docs/domainspecs/ directories"
6
+ metadata:
7
+ author: "github-aw-spec"
8
+ source: "local"
9
+ user-invocable: true
10
+ disable-model-invocation: false
11
+ ---
12
+
13
+
14
+ ## User Input
15
+
16
+ ```text
17
+ $ARGUMENTS
18
+ ```
19
+
20
+ The text the user typed after `/aw-spec-select-domain` (if any) is an optional domain folder name to set directly.
21
+
22
+ ## Purpose
23
+
24
+ Set the **active domain** for this project. The active domain is the name of a folder under
25
+ `docs/domainspecs/`. It is stored in `.aw-spec/domain.json` as `{ "domain": "<folder-name>" }`,
26
+ and every `/aw-spec-*` command resolves `docs/domainspecs/<domain>/comandrulemap.md` from it to
27
+ offer that domain's rule files.
28
+
29
+ ## Outline
30
+
31
+ 1. **Discover candidate domains.** List the immediate **subdirectories** of `docs/domainspecs/`
32
+ (directories only — ignore loose files). This is the set of selectable domains.
33
+ - If `docs/domainspecs/` does not exist or has **no** subdirectories, report that no domains
34
+ are available, instruct the user to create `docs/domainspecs/<name>/` containing a
35
+ `comandrulemap.md` (laid out like the healthcare one), and **stop** without writing anything.
36
+
37
+ 2. **Direct argument (optional).** If the user passed an argument:
38
+ - If it exactly matches one of the discovered folder names, treat that as the chosen domain and
39
+ skip to step 4.
40
+ - If it does not match any folder, note the mismatch, list the available names, and fall through
41
+ to the interactive selection in step 3.
42
+
43
+ 3. **Interactive selection.** Present the candidate domains with the AskUserQuestion tool:
44
+ - If **2–4** domains exist: a single single-select question listing them.
45
+ - If **more than 4** domains exist: split across multiple questions/calls (AskUserQuestion
46
+ allows ≤4 options per question and ≤4 questions per call).
47
+ - If **exactly one** domain exists: ask a confirmation — *"Set active domain to '<name>'?"* with
48
+ options **"Set '<name>'"** and **"Cancel"**.
49
+ - If the user cancels (or interactive questions cannot be asked and no valid argument was given),
50
+ **stop** without writing anything.
51
+
52
+ 4. **Validate the choice.** Check whether `docs/domainspecs/<chosen>/comandrulemap.md` exists.
53
+ - If it is missing, warn the user that domain rules will not load until that file is added, but
54
+ still allow setting the domain (it is the developer's choice).
55
+
56
+ 5. **Write `.aw-spec/domain.json`.** Write (creating or overwriting) `.aw-spec/domain.json` with:
57
+ ```json
58
+ {
59
+ "domain": "<chosen folder name>"
60
+ }
61
+ ```
62
+ Store the **folder name only**, not a path.
63
+
64
+ 6. **Confirm.** Report to the user:
65
+ - the active domain now set,
66
+ - the resolved map path `docs/domainspecs/<chosen>/comandrulemap.md` and whether it exists,
67
+ - that subsequent `/aw-spec-*` commands will offer this domain's rule files.
68
+
69
+ ## Done When
70
+
71
+ - [ ] `.aw-spec/domain.json` written with the chosen domain folder name (or nothing written if the
72
+ user cancelled / no domains available).
73
+ - [ ] The active domain and resolved `comandrulemap.md` path reported to the user.
@@ -0,0 +1,378 @@
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
+ ## 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-specify`:
31
+ - docs/domain/domain-driven-design.md
32
+ - docs/security/data-classification.md
33
+ - docs/glossary/ai-rules.md
34
+
35
+ ## Domain Rule-File Selection (interactive)
36
+
37
+ 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:
38
+
39
+ 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`.
40
+ 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:
41
+ - 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"**.
42
+ - **Continue (technical only)** → skip steps 3-5 and proceed with only the auto-loaded technical standards (plus any `@`-mentioned files).
43
+ - **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.
44
+ - If interactive questions cannot be asked (non-interactive/automated run), default to **Continue (technical only)**.
45
+ - 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.
46
+ 3. **Show a selection box** using the AskUserQuestion tool:
47
+ - Ask one single-select question — *"Domain rule files for /aw-spec-specify:"* — with options **"Select all (recommended)"**, **"Pick a subset"**, and **"None (technical only)"**.
48
+ - 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.
49
+ - If interactive questions cannot be asked (non-interactive or automated run), skip the prompt and default to **Select all**.
50
+ 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.
51
+ 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.
52
+ 6. Proceed to the Pre-Execution Checks only after the selected files are loaded.
53
+
54
+ ## Pre-Execution Checks
55
+
56
+ **Check for extension hooks (before specification)**:
57
+ - Check if `.aw-spec/extensions.yml` exists in the project root.
58
+ - If it exists, read it and look for entries under the `hooks.before_specify` key
59
+ - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
60
+ - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
61
+ - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
62
+ - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
63
+ - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
64
+ - When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `aw-spec.git.commit` → `/aw-spec-git-commit`.
65
+ - For each executable hook, output the following based on its `optional` flag:
66
+ - **Optional hook** (`optional: true`):
67
+ ```
68
+ ## Extension Hooks
69
+
70
+ **Optional Pre-Hook**: {extension}
71
+ Command: `/{command}`
72
+ Description: {description}
73
+
74
+ Prompt: {prompt}
75
+ To execute: `/{command}`
76
+ ```
77
+ - **Mandatory hook** (`optional: false`):
78
+ ```
79
+ ## Extension Hooks
80
+
81
+ **Automatic Pre-Hook**: {extension}
82
+ Executing: `/{command}`
83
+ EXECUTE_COMMAND: {command}
84
+
85
+ Wait for the result of the hook command before proceeding to the Outline.
86
+ ```
87
+ - If no hooks are registered or `.aw-spec/extensions.yml` does not exist, skip silently
88
+
89
+ ## Outline
90
+
91
+ 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.
92
+
93
+ Given that feature description, do this:
94
+
95
+ 1. **Generate a concise short name** (2-4 words) for the feature:
96
+ - Analyze the feature description and extract the most meaningful keywords
97
+ - Create a 2-4 word short name that captures the essence of the feature
98
+ - Use action-noun format when possible (e.g., "add-user-auth", "fix-payment-bug")
99
+ - Preserve technical terms and acronyms (OAuth2, API, JWT, etc.)
100
+ - Keep it concise but descriptive enough to understand the feature at a glance
101
+ - Examples:
102
+ - "I want to add user authentication" → "user-auth"
103
+ - "Implement OAuth2 integration for the API" → "oauth2-api-integration"
104
+ - "Create a dashboard for analytics" → "analytics-dashboard"
105
+ - "Fix payment processing timeout bug" → "fix-payment-timeout"
106
+
107
+ 2. **Branch creation** (optional, via hook):
108
+
109
+ 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.
110
+
111
+ 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).
112
+
113
+ 3. **Create the spec feature directory**:
114
+
115
+ Specs live under `specs/<Aggregate>/<Feature>/` unless the user explicitly provides `SPECIFY_FEATURE_DIRECTORY`.
116
+
117
+ **Resolution order for `SPECIFY_FEATURE_DIRECTORY`**:
118
+ 1. If the user explicitly provided `SPECIFY_FEATURE_DIRECTORY` (e.g., via environment variable, argument, or configuration), use it as-is
119
+ 2. Otherwise, auto-generate it under `specs/` keyed by aggregate and feature:
120
+ - Derive `<Aggregate>` and `<Feature>` from the feature description (arguments):
121
+ - 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.
122
+ - 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.
123
+ - Preserve the casing of `<Aggregate>` and `<Feature>` exactly as provided (PascalCase, **no** numeric/timestamp prefix).
124
+ - Set `SPECIFY_FEATURE_DIRECTORY` to `specs/<Aggregate>/<Feature>` (e.g. `specs/Patient/RegisterPatient`).
125
+ - 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.
126
+
127
+ **Create the directory and spec file**:
128
+ - `mkdir -p SPECIFY_FEATURE_DIRECTORY`
129
+ - Resolve the active `spec-template` through the AW-Spec preset/template resolution stack (equivalent to `specify preset resolve spec-template`)
130
+ - Copy the resolved `spec-template` file to `SPECIFY_FEATURE_DIRECTORY/spec.md` as the starting point
131
+ - Set `SPEC_FILE` to `SPECIFY_FEATURE_DIRECTORY/spec.md`
132
+ - Persist the resolved path to `.aw-spec/feature.json`:
133
+ ```json
134
+ {
135
+ "feature_directory": "<resolved feature dir>"
136
+ }
137
+ ```
138
+ Write the actual resolved directory path value (for example, `specs/003-user-auth`), not the literal string `SPECIFY_FEATURE_DIRECTORY`.
139
+ This allows downstream commands (`/aw-spec-plan`, `/aw-spec-tasks`, etc.) to locate the feature directory without relying on git branch name conventions.
140
+
141
+ **IMPORTANT**:
142
+ - You must only create one feature per `/aw-spec-specify` invocation
143
+ - The spec directory name and the git branch name are independent — they may be the same but that is the user's choice
144
+ - The spec directory and file are always created by this command, never by the hook
145
+
146
+ 4. Load the resolved active `spec-template` file to understand required sections.
147
+
148
+ 5. **IF EXISTS**: Load `.aw-spec/memory/constitution.md` for project principles and governance constraints.
149
+
150
+ 6. Follow this execution flow:
151
+ 1. Parse user description from arguments
152
+ If empty: ERROR "No feature description provided"
153
+ 2. Extract key concepts from description
154
+ Identify: actors, actions, data, constraints
155
+ 3. For unclear aspects:
156
+ - Make informed guesses based on context and industry standards
157
+ - Only mark with [NEEDS CLARIFICATION: specific question] if:
158
+ - The choice significantly impacts feature scope or user experience
159
+ - Multiple reasonable interpretations exist with different implications
160
+ - No reasonable default exists
161
+ - **LIMIT: Maximum 3 [NEEDS CLARIFICATION] markers total**
162
+ - Prioritize clarifications by impact: scope > security/privacy > user experience > technical details
163
+ 4. Fill User Scenarios & Testing section
164
+ If no clear user flow: ERROR "Cannot determine user scenarios"
165
+ 5. Generate Functional Requirements
166
+ Each requirement must be testable
167
+ Use reasonable defaults for unspecified details (document assumptions in Assumptions section)
168
+ 6. Define Success Criteria
169
+ Create measurable, technology-agnostic outcomes
170
+ Include both quantitative metrics (time, performance, volume) and qualitative measures (user satisfaction, task completion)
171
+ Each criterion must be verifiable without implementation details
172
+ 7. Identify Key Entities (if data involved)
173
+ 8. Return: SUCCESS (spec ready for planning)
174
+
175
+ 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.
176
+
177
+ 7. **Specification Quality Validation**: After writing the initial spec, validate it against quality criteria:
178
+
179
+ 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:
180
+
181
+ ```markdown
182
+ # Specification Quality Checklist: [FEATURE NAME]
183
+
184
+ **Purpose**: Validate specification completeness and quality before proceeding to planning
185
+ **Created**: [DATE]
186
+ **Feature**: [Link to spec.md]
187
+
188
+ ## Content Quality
189
+
190
+ - [ ] No implementation details (languages, frameworks, APIs)
191
+ - [ ] Focused on user value and business needs
192
+ - [ ] Written for non-technical stakeholders
193
+ - [ ] All mandatory sections completed
194
+
195
+ ## Requirement Completeness
196
+
197
+ - [ ] No [NEEDS CLARIFICATION] markers remain
198
+ - [ ] Requirements are testable and unambiguous
199
+ - [ ] Success criteria are measurable
200
+ - [ ] Success criteria are technology-agnostic (no implementation details)
201
+ - [ ] All acceptance scenarios are defined
202
+ - [ ] Edge cases are identified
203
+ - [ ] Scope is clearly bounded
204
+ - [ ] Dependencies and assumptions identified
205
+
206
+ ## Feature Readiness
207
+
208
+ - [ ] All functional requirements have clear acceptance criteria
209
+ - [ ] User scenarios cover primary flows
210
+ - [ ] Feature meets measurable outcomes defined in Success Criteria
211
+ - [ ] No implementation details leak into specification
212
+
213
+ ## Notes
214
+
215
+ - Items marked incomplete require spec updates before `/aw-spec-clarify` or `/aw-spec-plan`
216
+ ```
217
+
218
+ b. **Run Validation Check**: Review the spec against each checklist item:
219
+ - For each item, determine if it passes or fails
220
+ - Document specific issues found (quote relevant spec sections)
221
+
222
+ c. **Handle Validation Results**:
223
+
224
+ - **If all items pass**: Mark checklist complete and proceed to the Mandatory Post-Execution Hooks section
225
+
226
+ - **If items fail (excluding [NEEDS CLARIFICATION])**:
227
+ 1. List the failing items and specific issues
228
+ 2. Update the spec to address each issue
229
+ 3. Re-run validation until all items pass (max 3 iterations)
230
+ 4. If still failing after 3 iterations, document remaining issues in checklist notes and warn user
231
+
232
+ - **If [NEEDS CLARIFICATION] markers remain**:
233
+ 1. Extract all [NEEDS CLARIFICATION: ...] markers from the spec
234
+ 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
235
+ 3. For each clarification needed (max 3), present options to user in this format:
236
+
237
+ ```markdown
238
+ ## Question [N]: [Topic]
239
+
240
+ **Context**: [Quote relevant spec section]
241
+
242
+ **What we need to know**: [Specific question from NEEDS CLARIFICATION marker]
243
+
244
+ **Suggested Answers**:
245
+
246
+ | Option | Answer | Implications |
247
+ |--------|--------|--------------|
248
+ | A | [First suggested answer] | [What this means for the feature] |
249
+ | B | [Second suggested answer] | [What this means for the feature] |
250
+ | C | [Third suggested answer] | [What this means for the feature] |
251
+ | Custom | Provide your own answer | [Explain how to provide custom input] |
252
+
253
+ **Your choice**: _[Wait for user response]_
254
+ ```
255
+
256
+ 4. **CRITICAL - Table Formatting**: Ensure markdown tables are properly formatted:
257
+ - Use consistent spacing with pipes aligned
258
+ - Each cell should have spaces around content: `| Content |` not `|Content|`
259
+ - Header separator must have at least 3 dashes: `|--------|`
260
+ - Test that the table renders correctly in markdown preview
261
+ 5. Number questions sequentially (Q1, Q2, Q3 - max 3 total)
262
+ 6. Present all questions together before waiting for responses
263
+ 7. Wait for user to respond with their choices for all questions (e.g., "Q1: A, Q2: Custom - [details], Q3: B")
264
+ 8. Update the spec by replacing each [NEEDS CLARIFICATION] marker with the user's selected or provided answer
265
+ 9. Re-run validation after all clarifications are resolved
266
+
267
+ d. **Update Checklist**: After each validation iteration, update the checklist file with current pass/fail status
268
+
269
+ ## Mandatory Post-Execution Hooks
270
+
271
+ **You MUST complete this section before reporting completion to the user.**
272
+
273
+ Check if `.aw-spec/extensions.yml` exists in the project root.
274
+ - If it does not exist, or no hooks are registered under `hooks.after_specify`, skip to the Completion Report.
275
+ - If it exists, read it and look for entries under the `hooks.after_specify` key.
276
+ - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue to the Completion Report.
277
+ - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
278
+ - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
279
+ - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
280
+ - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
281
+ - When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `aw-spec.git.commit` → `/aw-spec-git-commit`.
282
+ - For each executable hook, output the following based on its `optional` flag:
283
+ - **Mandatory hook** (`optional: false`) — **You MUST emit `EXECUTE_COMMAND:` for each mandatory hook**:
284
+ ```
285
+ ## Extension Hooks
286
+
287
+ **Automatic Hook**: {extension}
288
+ Executing: `/{command}`
289
+ EXECUTE_COMMAND: {command}
290
+ ```
291
+ - **Optional hook** (`optional: true`):
292
+ ```
293
+ ## Extension Hooks
294
+
295
+ **Optional Hook**: {extension}
296
+ Command: `/{command}`
297
+ Description: {description}
298
+
299
+ Prompt: {prompt}
300
+ To execute: `/{command}`
301
+ ```
302
+
303
+ ## Completion Report
304
+
305
+ Report completion to the user with:
306
+ - `SPECIFY_FEATURE_DIRECTORY` — the feature directory path
307
+ - `SPEC_FILE` — the spec file path
308
+ - Checklist results summary
309
+ - Readiness for the next phase (`/aw-spec-clarify` or `/aw-spec-plan`)
310
+
311
+ **NOTE:** Branch creation is handled by the `before_specify` hook (git extension). Spec directory and file creation are always handled by this core command.
312
+
313
+ ## Quick Guidelines
314
+
315
+ - Focus on **WHAT** users need and **WHY**.
316
+ - Avoid HOW to implement (no tech stack, APIs, code structure).
317
+ - Written for business stakeholders, not developers.
318
+ - DO NOT create any checklists that are embedded in the spec. That will be a separate command.
319
+
320
+ ### Section Requirements
321
+
322
+ - **Mandatory sections**: Must be completed for every feature
323
+ - **Optional sections**: Include only when relevant to the feature
324
+ - When a section doesn't apply, remove it entirely (don't leave as "N/A")
325
+
326
+ ### For AI Generation
327
+
328
+ When creating this spec from a user prompt:
329
+
330
+ 1. **Make informed guesses**: Use context, industry standards, and common patterns to fill gaps
331
+ 2. **Document assumptions**: Record reasonable defaults in the Assumptions section
332
+ 3. **Limit clarifications**: Maximum 3 [NEEDS CLARIFICATION] markers - use only for critical decisions that:
333
+ - Significantly impact feature scope or user experience
334
+ - Have multiple reasonable interpretations with different implications
335
+ - Lack any reasonable default
336
+ 4. **Prioritize clarifications**: scope > security/privacy > user experience > technical details
337
+ 5. **Think like a tester**: Every vague requirement should fail the "testable and unambiguous" checklist item
338
+ 6. **Common areas needing clarification** (only if no reasonable default exists):
339
+ - Feature scope and boundaries (include/exclude specific use cases)
340
+ - User types and permissions (if multiple conflicting interpretations possible)
341
+ - Security/compliance requirements (when legally/financially significant)
342
+
343
+ **Examples of reasonable defaults** (don't ask about these):
344
+
345
+ - Data retention: Industry-standard practices for the domain
346
+ - Performance targets: Standard web/mobile app expectations unless specified
347
+ - Error handling: User-friendly messages with appropriate fallbacks
348
+ - Authentication method: Standard session-based or OAuth2 for web apps
349
+ - Integration patterns: Use project-appropriate patterns (REST/GraphQL for web services, function calls for libraries, CLI args for tools, etc.)
350
+
351
+ ### Success Criteria Guidelines
352
+
353
+ Success criteria must be:
354
+
355
+ 1. **Measurable**: Include specific metrics (time, percentage, count, rate)
356
+ 2. **Technology-agnostic**: No mention of frameworks, languages, databases, or tools
357
+ 3. **User-focused**: Describe outcomes from user/business perspective, not system internals
358
+ 4. **Verifiable**: Can be tested/validated without knowing implementation details
359
+
360
+ **Good examples**:
361
+
362
+ - "Users can complete checkout in under 3 minutes"
363
+ - "System supports 10,000 concurrent users"
364
+ - "95% of searches return results in under 1 second"
365
+ - "Task completion rate improves by 40%"
366
+
367
+ **Bad examples** (implementation-focused):
368
+
369
+ - "API response time is under 200ms" (too technical, use "Users see results instantly")
370
+ - "Database can handle 1000 TPS" (implementation detail, use user-facing metric)
371
+ - "React components render efficiently" (framework-specific)
372
+ - "Redis cache hit rate above 80%" (technology-specific)
373
+
374
+ ## Done When
375
+
376
+ - [ ] Specification written to `SPEC_FILE` and validated against quality checklist
377
+ - [ ] Extension hooks dispatched or skipped according to the rules in Mandatory Post-Execution Hooks above
378
+ - [ ] Completion reported to user with feature directory, spec file path, and checklist results