ruby_reactor 0.5.4 → 0.6.0

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 (70) hide show
  1. checksums.yaml +4 -4
  2. data/.claude/skills/speckit-agent-context-update/SKILL.md +32 -0
  3. data/.claude/skills/speckit-analyze/SKILL.md +262 -0
  4. data/.claude/skills/speckit-checklist/SKILL.md +374 -0
  5. data/.claude/skills/speckit-clarify/SKILL.md +286 -0
  6. data/.claude/skills/speckit-constitution/SKILL.md +157 -0
  7. data/.claude/skills/speckit-converge/SKILL.md +277 -0
  8. data/.claude/skills/speckit-implement/SKILL.md +224 -0
  9. data/.claude/skills/speckit-plan/SKILL.md +171 -0
  10. data/.claude/skills/speckit-specify/SKILL.md +346 -0
  11. data/.claude/skills/speckit-tasks/SKILL.md +215 -0
  12. data/.claude/skills/speckit-taskstoissues/SKILL.md +110 -0
  13. data/.release-please-manifest.json +1 -1
  14. data/.specify/extensions/.registry +19 -0
  15. data/.specify/extensions/agent-context/README.md +66 -0
  16. data/.specify/extensions/agent-context/agent-context-config.yml +5 -0
  17. data/.specify/extensions/agent-context/commands/speckit.agent-context.update.md +27 -0
  18. data/.specify/extensions/agent-context/extension.yml +34 -0
  19. data/.specify/extensions/agent-context/scripts/bash/update-agent-context.sh +282 -0
  20. data/.specify/extensions/agent-context/scripts/powershell/update-agent-context.ps1 +353 -0
  21. data/.specify/extensions.yml +23 -0
  22. data/.specify/feature.json +3 -0
  23. data/.specify/init-options.json +9 -0
  24. data/.specify/integration.json +15 -0
  25. data/.specify/integrations/claude.manifest.json +17 -0
  26. data/.specify/integrations/speckit.manifest.json +17 -0
  27. data/.specify/memory/constitution.md +134 -0
  28. data/.specify/scripts/bash/check-prerequisites.sh +189 -0
  29. data/.specify/scripts/bash/common.sh +619 -0
  30. data/.specify/scripts/bash/create-new-feature.sh +299 -0
  31. data/.specify/scripts/bash/setup-plan.sh +84 -0
  32. data/.specify/scripts/bash/setup-tasks.sh +91 -0
  33. data/.specify/templates/checklist-template.md +40 -0
  34. data/.specify/templates/constitution-template.md +50 -0
  35. data/.specify/templates/plan-template.md +113 -0
  36. data/.specify/templates/spec-template.md +131 -0
  37. data/.specify/templates/tasks-template.md +252 -0
  38. data/.specify/workflows/speckit/workflow.yml +77 -0
  39. data/.specify/workflows/workflow-registry.json +13 -0
  40. data/CHANGELOG.md +7 -0
  41. data/README.md +51 -24
  42. data/lib/ruby_reactor/adapters/active_job/compat.rb +24 -0
  43. data/lib/ruby_reactor/adapters/active_job/map_collector_worker.rb +19 -0
  44. data/lib/ruby_reactor/adapters/active_job/map_element_worker.rb +19 -0
  45. data/lib/ruby_reactor/adapters/active_job/router.rb +91 -0
  46. data/lib/ruby_reactor/adapters/active_job/sweeper_worker.rb +16 -0
  47. data/lib/ruby_reactor/adapters/active_job/worker.rb +24 -0
  48. data/lib/ruby_reactor/adapters/sidekiq/map_collector_worker.rb +15 -0
  49. data/lib/ruby_reactor/adapters/sidekiq/map_element_worker.rb +15 -0
  50. data/lib/ruby_reactor/adapters/sidekiq/router.rb +91 -0
  51. data/lib/ruby_reactor/adapters/sidekiq/sweeper_worker.rb +19 -0
  52. data/lib/ruby_reactor/adapters/sidekiq/worker.rb +25 -0
  53. data/lib/ruby_reactor/configuration.rb +24 -4
  54. data/lib/ruby_reactor/map/element_executor.rb +1 -1
  55. data/lib/ruby_reactor/rspec/active_job_helpers.rb +52 -0
  56. data/lib/ruby_reactor/rspec/async_test_helpers.rb +41 -0
  57. data/lib/ruby_reactor/rspec/sidekiq_helpers.rb +3 -3
  58. data/lib/ruby_reactor/rspec/test_subject.rb +11 -7
  59. data/lib/ruby_reactor/rspec.rb +4 -0
  60. data/lib/ruby_reactor/sweeper_job.rb +70 -0
  61. data/lib/ruby_reactor/version.rb +1 -1
  62. data/lib/ruby_reactor/worker.rb +226 -0
  63. data/lib/ruby_reactor.rb +40 -1
  64. data/specs/active_job.md +259 -0
  65. metadata +54 -6
  66. data/lib/ruby_reactor/sidekiq_adapter.rb +0 -87
  67. data/lib/ruby_reactor/sidekiq_workers/map_collector_worker.rb +0 -13
  68. data/lib/ruby_reactor/sidekiq_workers/map_element_worker.rb +0 -13
  69. data/lib/ruby_reactor/sidekiq_workers/sweeper_worker.rb +0 -73
  70. data/lib/ruby_reactor/sidekiq_workers/worker.rb +0 -222
@@ -0,0 +1,171 @@
1
+ ---
2
+ name: "speckit-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 spec-kit project structure with .specify/ directory"
6
+ metadata:
7
+ author: "github-spec-kit"
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
+ ## Pre-Execution Checks
23
+
24
+ **Check for extension hooks (before planning)**:
25
+ - Check if `.specify/extensions.yml` exists in the project root.
26
+ - If it exists, read it and look for entries under the `hooks.before_plan` key
27
+ - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
28
+ - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
29
+ - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
30
+ - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
31
+ - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
32
+ - When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `speckit.git.commit` → `/speckit-git-commit`.
33
+ - For each executable hook, output the following based on its `optional` flag:
34
+ - **Optional hook** (`optional: true`):
35
+ ```
36
+ ## Extension Hooks
37
+
38
+ **Optional Pre-Hook**: {extension}
39
+ Command: `/{command}`
40
+ Description: {description}
41
+
42
+ Prompt: {prompt}
43
+ To execute: `/{command}`
44
+ ```
45
+ - **Mandatory hook** (`optional: false`):
46
+ ```
47
+ ## Extension Hooks
48
+
49
+ **Automatic Pre-Hook**: {extension}
50
+ Executing: `/{command}`
51
+ EXECUTE_COMMAND: {command}
52
+
53
+ Wait for the result of the hook command before proceeding to the Outline.
54
+ ```
55
+ - If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
56
+
57
+ ## Outline
58
+
59
+ 1. **Setup**: Run `.specify/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").
60
+
61
+ 2. **Load context**: Read FEATURE_SPEC and `.specify/memory/constitution.md`. Load IMPL_PLAN template (already copied).
62
+
63
+ 3. **Execute plan workflow**: Follow the structure in IMPL_PLAN template to:
64
+ - Fill Technical Context (mark unknowns as "NEEDS CLARIFICATION")
65
+ - Fill Constitution Check section from constitution
66
+ - Evaluate gates (ERROR if violations unjustified)
67
+ - Phase 0: Generate research.md (resolve all NEEDS CLARIFICATION)
68
+ - Phase 1: Generate data-model.md, contracts/, quickstart.md
69
+ - Phase 1: Update agent context by running the agent script
70
+ - Re-evaluate Constitution Check post-design
71
+
72
+ ## Mandatory Post-Execution Hooks
73
+
74
+ **You MUST complete this section before reporting completion to the user.**
75
+
76
+ Check if `.specify/extensions.yml` exists in the project root.
77
+ - If it does not exist, or no hooks are registered under `hooks.after_plan`, skip to the Completion Report.
78
+ - If it exists, read it and look for entries under the `hooks.after_plan` key.
79
+ - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue to the Completion Report.
80
+ - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
81
+ - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
82
+ - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
83
+ - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
84
+ - When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `speckit.git.commit` → `/speckit-git-commit`.
85
+ - For each executable hook, output the following based on its `optional` flag:
86
+ - **Mandatory hook** (`optional: false`) — **You MUST emit `EXECUTE_COMMAND:` for each mandatory hook**:
87
+ ```
88
+ ## Extension Hooks
89
+
90
+ **Automatic Hook**: {extension}
91
+ Executing: `/{command}`
92
+ EXECUTE_COMMAND: {command}
93
+ ```
94
+ - **Optional hook** (`optional: true`):
95
+ ```
96
+ ## Extension Hooks
97
+
98
+ **Optional Hook**: {extension}
99
+ Command: `/{command}`
100
+ Description: {description}
101
+
102
+ Prompt: {prompt}
103
+ To execute: `/{command}`
104
+ ```
105
+
106
+ ## Completion Report
107
+
108
+ Command ends after Phase 2 planning. Report branch, IMPL_PLAN path, and generated artifacts.
109
+
110
+ ## Phases
111
+
112
+ ### Phase 0: Outline & Research
113
+
114
+ 1. **Extract unknowns from Technical Context** above:
115
+ - For each NEEDS CLARIFICATION → research task
116
+ - For each dependency → best practices task
117
+ - For each integration → patterns task
118
+
119
+ 2. **Generate and dispatch research agents**:
120
+
121
+ ```text
122
+ For each unknown in Technical Context:
123
+ Task: "Research {unknown} for {feature context}"
124
+ For each technology choice:
125
+ Task: "Find best practices for {tech} in {domain}"
126
+ ```
127
+
128
+ 3. **Consolidate findings** in `research.md` using format:
129
+ - Decision: [what was chosen]
130
+ - Rationale: [why chosen]
131
+ - Alternatives considered: [what else evaluated]
132
+
133
+ **Output**: research.md with all NEEDS CLARIFICATION resolved
134
+
135
+ ### Phase 1: Design & Contracts
136
+
137
+ **Prerequisites:** `research.md` complete
138
+
139
+ 1. **Extract entities from feature spec** → `data-model.md`:
140
+ - Entity name, fields, relationships
141
+ - Validation rules from requirements
142
+ - State transitions if applicable
143
+
144
+ 2. **Define interface contracts** (if project has external interfaces) → `/contracts/`:
145
+ - Identify what interfaces the project exposes to users or other systems
146
+ - Document the contract format appropriate for the project type
147
+ - Examples: public APIs for libraries, command schemas for CLI tools, endpoints for web services, grammars for parsers, UI contracts for applications
148
+ - Skip if project is purely internal (build scripts, one-off tools, etc.)
149
+
150
+ 3. **Create quickstart validation guide** → `quickstart.md`:
151
+ - Document runnable validation scenarios that prove the feature works end-to-end
152
+ - Include prerequisites, setup commands, test/run commands, and expected outcomes
153
+ - Use links or references to contracts and data model details instead of duplicating them
154
+ - Do not include full implementation code, model/service/controller bodies, migrations, or complete test suites
155
+ - Keep this artifact as a validation/run guide; implementation details belong in `tasks.md` and the implementation phase
156
+
157
+ 4. **Agent context update**:
158
+ - Update the plan reference between the `<!-- SPECKIT START -->` and `<!-- SPECKIT END -->` markers in `CLAUDE.md` to point to the plan file created in step 1 (the IMPL_PLAN path)
159
+
160
+ **Output**: data-model.md, /contracts/*, quickstart.md, updated agent context file
161
+
162
+ ## Key rules
163
+
164
+ - Use absolute paths for filesystem operations; use project-relative paths for references in documentation and agent context files
165
+ - ERROR on gate failures or unresolved clarifications
166
+
167
+ ## Done When
168
+
169
+ - [ ] Plan workflow executed and design artifacts generated
170
+ - [ ] Extension hooks dispatched or skipped according to the rules in Mandatory Post-Execution Hooks above
171
+ - [ ] Completion reported to user with branch, plan path, and generated artifacts
@@ -0,0 +1,346 @@
1
+ ---
2
+ name: "speckit-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 spec-kit project structure with .specify/ directory"
6
+ metadata:
7
+ author: "github-spec-kit"
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
+ ## Pre-Execution Checks
23
+
24
+ **Check for extension hooks (before specification)**:
25
+ - Check if `.specify/extensions.yml` exists in the project root.
26
+ - If it exists, read it and look for entries under the `hooks.before_specify` key
27
+ - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
28
+ - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
29
+ - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
30
+ - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
31
+ - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
32
+ - When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `speckit.git.commit` → `/speckit-git-commit`.
33
+ - For each executable hook, output the following based on its `optional` flag:
34
+ - **Optional hook** (`optional: true`):
35
+ ```
36
+ ## Extension Hooks
37
+
38
+ **Optional Pre-Hook**: {extension}
39
+ Command: `/{command}`
40
+ Description: {description}
41
+
42
+ Prompt: {prompt}
43
+ To execute: `/{command}`
44
+ ```
45
+ - **Mandatory hook** (`optional: false`):
46
+ ```
47
+ ## Extension Hooks
48
+
49
+ **Automatic Pre-Hook**: {extension}
50
+ Executing: `/{command}`
51
+ EXECUTE_COMMAND: {command}
52
+
53
+ Wait for the result of the hook command before proceeding to the Outline.
54
+ ```
55
+ - If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
56
+
57
+ ## Outline
58
+
59
+ The text the user typed after `/speckit-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.
60
+
61
+ Given that feature description, do this:
62
+
63
+ 1. **Generate a concise short name** (2-4 words) for the feature:
64
+ - Analyze the feature description and extract the most meaningful keywords
65
+ - Create a 2-4 word short name that captures the essence of the feature
66
+ - Use action-noun format when possible (e.g., "add-user-auth", "fix-payment-bug")
67
+ - Preserve technical terms and acronyms (OAuth2, API, JWT, etc.)
68
+ - Keep it concise but descriptive enough to understand the feature at a glance
69
+ - Examples:
70
+ - "I want to add user authentication" → "user-auth"
71
+ - "Implement OAuth2 integration for the API" → "oauth2-api-integration"
72
+ - "Create a dashboard for analytics" → "analytics-dashboard"
73
+ - "Fix payment processing timeout bug" → "fix-payment-timeout"
74
+
75
+ 2. **Branch creation** (optional, via hook):
76
+
77
+ 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.
78
+
79
+ 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).
80
+
81
+ 3. **Create the spec feature directory**:
82
+
83
+ Specs live under the default `specs/` directory unless the user explicitly provides `SPECIFY_FEATURE_DIRECTORY`.
84
+
85
+ **Resolution order for `SPECIFY_FEATURE_DIRECTORY`**:
86
+ 1. If the user explicitly provided `SPECIFY_FEATURE_DIRECTORY` (e.g., via environment variable, argument, or configuration), use it as-is
87
+ 2. Otherwise, auto-generate it under `specs/`:
88
+ - Check `.specify/init-options.json` for `feature_numbering` (preferred) or `branch_numbering` (deprecated, migration only — will be removed in a future release)
89
+ - If `"timestamp"`: prefix is `YYYYMMDD-HHMMSS` (current timestamp)
90
+ - If `"sequential"` or absent: prefix is `NNN` (next available 3-digit number after scanning existing directories in `specs/`)
91
+ - Construct the directory name: `<prefix>-<short-name>` (e.g., `003-user-auth` or `20260319-143022-user-auth`)
92
+ - Set `SPECIFY_FEATURE_DIRECTORY` to `specs/<directory-name>`
93
+ - If `branch_numbering` was used (and `feature_numbering` was absent), emit a one-line warning: "⚠️ `branch_numbering` in init-options.json is deprecated. Rename to `feature_numbering`."
94
+
95
+ **Create the directory and spec file**:
96
+ - `mkdir -p SPECIFY_FEATURE_DIRECTORY`
97
+ - Resolve the active `spec-template` through the Spec Kit preset/template resolution stack (equivalent to `specify preset resolve spec-template`)
98
+ - Copy the resolved `spec-template` file to `SPECIFY_FEATURE_DIRECTORY/spec.md` as the starting point
99
+ - Set `SPEC_FILE` to `SPECIFY_FEATURE_DIRECTORY/spec.md`
100
+ - Persist the resolved path to `.specify/feature.json`:
101
+ ```json
102
+ {
103
+ "feature_directory": "<resolved feature dir>"
104
+ }
105
+ ```
106
+ Write the actual resolved directory path value (for example, `specs/003-user-auth`), not the literal string `SPECIFY_FEATURE_DIRECTORY`.
107
+ This allows downstream commands (`/speckit-plan`, `/speckit-tasks`, etc.) to locate the feature directory without relying on git branch name conventions.
108
+
109
+ **IMPORTANT**:
110
+ - You must only create one feature per `/speckit-specify` invocation
111
+ - The spec directory name and the git branch name are independent — they may be the same but that is the user's choice
112
+ - The spec directory and file are always created by this command, never by the hook
113
+
114
+ 4. Load the resolved active `spec-template` file to understand required sections.
115
+
116
+ 5. **IF EXISTS**: Load `.specify/memory/constitution.md` for project principles and governance constraints.
117
+
118
+ 6. Follow this execution flow:
119
+ 1. Parse user description from arguments
120
+ If empty: ERROR "No feature description provided"
121
+ 2. Extract key concepts from description
122
+ Identify: actors, actions, data, constraints
123
+ 3. For unclear aspects:
124
+ - Make informed guesses based on context and industry standards
125
+ - Only mark with [NEEDS CLARIFICATION: specific question] if:
126
+ - The choice significantly impacts feature scope or user experience
127
+ - Multiple reasonable interpretations exist with different implications
128
+ - No reasonable default exists
129
+ - **LIMIT: Maximum 3 [NEEDS CLARIFICATION] markers total**
130
+ - Prioritize clarifications by impact: scope > security/privacy > user experience > technical details
131
+ 4. Fill User Scenarios & Testing section
132
+ If no clear user flow: ERROR "Cannot determine user scenarios"
133
+ 5. Generate Functional Requirements
134
+ Each requirement must be testable
135
+ Use reasonable defaults for unspecified details (document assumptions in Assumptions section)
136
+ 6. Define Success Criteria
137
+ Create measurable, technology-agnostic outcomes
138
+ Include both quantitative metrics (time, performance, volume) and qualitative measures (user satisfaction, task completion)
139
+ Each criterion must be verifiable without implementation details
140
+ 7. Identify Key Entities (if data involved)
141
+ 8. Return: SUCCESS (spec ready for planning)
142
+
143
+ 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.
144
+
145
+ 7. **Specification Quality Validation**: After writing the initial spec, validate it against quality criteria:
146
+
147
+ 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:
148
+
149
+ ```markdown
150
+ # Specification Quality Checklist: [FEATURE NAME]
151
+
152
+ **Purpose**: Validate specification completeness and quality before proceeding to planning
153
+ **Created**: [DATE]
154
+ **Feature**: [Link to spec.md]
155
+
156
+ ## Content Quality
157
+
158
+ - [ ] No implementation details (languages, frameworks, APIs)
159
+ - [ ] Focused on user value and business needs
160
+ - [ ] Written for non-technical stakeholders
161
+ - [ ] All mandatory sections completed
162
+
163
+ ## Requirement Completeness
164
+
165
+ - [ ] No [NEEDS CLARIFICATION] markers remain
166
+ - [ ] Requirements are testable and unambiguous
167
+ - [ ] Success criteria are measurable
168
+ - [ ] Success criteria are technology-agnostic (no implementation details)
169
+ - [ ] All acceptance scenarios are defined
170
+ - [ ] Edge cases are identified
171
+ - [ ] Scope is clearly bounded
172
+ - [ ] Dependencies and assumptions identified
173
+
174
+ ## Feature Readiness
175
+
176
+ - [ ] All functional requirements have clear acceptance criteria
177
+ - [ ] User scenarios cover primary flows
178
+ - [ ] Feature meets measurable outcomes defined in Success Criteria
179
+ - [ ] No implementation details leak into specification
180
+
181
+ ## Notes
182
+
183
+ - Items marked incomplete require spec updates before `/speckit-clarify` or `/speckit-plan`
184
+ ```
185
+
186
+ b. **Run Validation Check**: Review the spec against each checklist item:
187
+ - For each item, determine if it passes or fails
188
+ - Document specific issues found (quote relevant spec sections)
189
+
190
+ c. **Handle Validation Results**:
191
+
192
+ - **If all items pass**: Mark checklist complete and proceed to the Mandatory Post-Execution Hooks section
193
+
194
+ - **If items fail (excluding [NEEDS CLARIFICATION])**:
195
+ 1. List the failing items and specific issues
196
+ 2. Update the spec to address each issue
197
+ 3. Re-run validation until all items pass (max 3 iterations)
198
+ 4. If still failing after 3 iterations, document remaining issues in checklist notes and warn user
199
+
200
+ - **If [NEEDS CLARIFICATION] markers remain**:
201
+ 1. Extract all [NEEDS CLARIFICATION: ...] markers from the spec
202
+ 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
203
+ 3. For each clarification needed (max 3), present options to user in this format:
204
+
205
+ ```markdown
206
+ ## Question [N]: [Topic]
207
+
208
+ **Context**: [Quote relevant spec section]
209
+
210
+ **What we need to know**: [Specific question from NEEDS CLARIFICATION marker]
211
+
212
+ **Suggested Answers**:
213
+
214
+ | Option | Answer | Implications |
215
+ |--------|--------|--------------|
216
+ | A | [First suggested answer] | [What this means for the feature] |
217
+ | B | [Second suggested answer] | [What this means for the feature] |
218
+ | C | [Third suggested answer] | [What this means for the feature] |
219
+ | Custom | Provide your own answer | [Explain how to provide custom input] |
220
+
221
+ **Your choice**: _[Wait for user response]_
222
+ ```
223
+
224
+ 4. **CRITICAL - Table Formatting**: Ensure markdown tables are properly formatted:
225
+ - Use consistent spacing with pipes aligned
226
+ - Each cell should have spaces around content: `| Content |` not `|Content|`
227
+ - Header separator must have at least 3 dashes: `|--------|`
228
+ - Test that the table renders correctly in markdown preview
229
+ 5. Number questions sequentially (Q1, Q2, Q3 - max 3 total)
230
+ 6. Present all questions together before waiting for responses
231
+ 7. Wait for user to respond with their choices for all questions (e.g., "Q1: A, Q2: Custom - [details], Q3: B")
232
+ 8. Update the spec by replacing each [NEEDS CLARIFICATION] marker with the user's selected or provided answer
233
+ 9. Re-run validation after all clarifications are resolved
234
+
235
+ d. **Update Checklist**: After each validation iteration, update the checklist file with current pass/fail status
236
+
237
+ ## Mandatory Post-Execution Hooks
238
+
239
+ **You MUST complete this section before reporting completion to the user.**
240
+
241
+ Check if `.specify/extensions.yml` exists in the project root.
242
+ - If it does not exist, or no hooks are registered under `hooks.after_specify`, skip to the Completion Report.
243
+ - If it exists, read it and look for entries under the `hooks.after_specify` key.
244
+ - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue to the Completion Report.
245
+ - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
246
+ - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
247
+ - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
248
+ - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
249
+ - When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `speckit.git.commit` → `/speckit-git-commit`.
250
+ - For each executable hook, output the following based on its `optional` flag:
251
+ - **Mandatory hook** (`optional: false`) — **You MUST emit `EXECUTE_COMMAND:` for each mandatory hook**:
252
+ ```
253
+ ## Extension Hooks
254
+
255
+ **Automatic Hook**: {extension}
256
+ Executing: `/{command}`
257
+ EXECUTE_COMMAND: {command}
258
+ ```
259
+ - **Optional hook** (`optional: true`):
260
+ ```
261
+ ## Extension Hooks
262
+
263
+ **Optional Hook**: {extension}
264
+ Command: `/{command}`
265
+ Description: {description}
266
+
267
+ Prompt: {prompt}
268
+ To execute: `/{command}`
269
+ ```
270
+
271
+ ## Completion Report
272
+
273
+ Report completion to the user with:
274
+ - `SPECIFY_FEATURE_DIRECTORY` — the feature directory path
275
+ - `SPEC_FILE` — the spec file path
276
+ - Checklist results summary
277
+ - Readiness for the next phase (`/speckit-clarify` or `/speckit-plan`)
278
+
279
+ **NOTE:** Branch creation is handled by the `before_specify` hook (git extension). Spec directory and file creation are always handled by this core command.
280
+
281
+ ## Quick Guidelines
282
+
283
+ - Focus on **WHAT** users need and **WHY**.
284
+ - Avoid HOW to implement (no tech stack, APIs, code structure).
285
+ - Written for business stakeholders, not developers.
286
+ - DO NOT create any checklists that are embedded in the spec. That will be a separate command.
287
+
288
+ ### Section Requirements
289
+
290
+ - **Mandatory sections**: Must be completed for every feature
291
+ - **Optional sections**: Include only when relevant to the feature
292
+ - When a section doesn't apply, remove it entirely (don't leave as "N/A")
293
+
294
+ ### For AI Generation
295
+
296
+ When creating this spec from a user prompt:
297
+
298
+ 1. **Make informed guesses**: Use context, industry standards, and common patterns to fill gaps
299
+ 2. **Document assumptions**: Record reasonable defaults in the Assumptions section
300
+ 3. **Limit clarifications**: Maximum 3 [NEEDS CLARIFICATION] markers - use only for critical decisions that:
301
+ - Significantly impact feature scope or user experience
302
+ - Have multiple reasonable interpretations with different implications
303
+ - Lack any reasonable default
304
+ 4. **Prioritize clarifications**: scope > security/privacy > user experience > technical details
305
+ 5. **Think like a tester**: Every vague requirement should fail the "testable and unambiguous" checklist item
306
+ 6. **Common areas needing clarification** (only if no reasonable default exists):
307
+ - Feature scope and boundaries (include/exclude specific use cases)
308
+ - User types and permissions (if multiple conflicting interpretations possible)
309
+ - Security/compliance requirements (when legally/financially significant)
310
+
311
+ **Examples of reasonable defaults** (don't ask about these):
312
+
313
+ - Data retention: Industry-standard practices for the domain
314
+ - Performance targets: Standard web/mobile app expectations unless specified
315
+ - Error handling: User-friendly messages with appropriate fallbacks
316
+ - Authentication method: Standard session-based or OAuth2 for web apps
317
+ - Integration patterns: Use project-appropriate patterns (REST/GraphQL for web services, function calls for libraries, CLI args for tools, etc.)
318
+
319
+ ### Success Criteria Guidelines
320
+
321
+ Success criteria must be:
322
+
323
+ 1. **Measurable**: Include specific metrics (time, percentage, count, rate)
324
+ 2. **Technology-agnostic**: No mention of frameworks, languages, databases, or tools
325
+ 3. **User-focused**: Describe outcomes from user/business perspective, not system internals
326
+ 4. **Verifiable**: Can be tested/validated without knowing implementation details
327
+
328
+ **Good examples**:
329
+
330
+ - "Users can complete checkout in under 3 minutes"
331
+ - "System supports 10,000 concurrent users"
332
+ - "95% of searches return results in under 1 second"
333
+ - "Task completion rate improves by 40%"
334
+
335
+ **Bad examples** (implementation-focused):
336
+
337
+ - "API response time is under 200ms" (too technical, use "Users see results instantly")
338
+ - "Database can handle 1000 TPS" (implementation detail, use user-facing metric)
339
+ - "React components render efficiently" (framework-specific)
340
+ - "Redis cache hit rate above 80%" (technology-specific)
341
+
342
+ ## Done When
343
+
344
+ - [ ] Specification written to `SPEC_FILE` and validated against quality checklist
345
+ - [ ] Extension hooks dispatched or skipped according to the rules in Mandatory Post-Execution Hooks above
346
+ - [ ] Completion reported to user with feature directory, spec file path, and checklist results