@sniper.ai/core 1.0.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 (67) hide show
  1. package/README.md +73 -0
  2. package/framework/checklists/code-review.md +33 -0
  3. package/framework/checklists/discover-review.md +33 -0
  4. package/framework/checklists/doc-review.md +39 -0
  5. package/framework/checklists/plan-review.md +52 -0
  6. package/framework/checklists/sprint-review.md +41 -0
  7. package/framework/checklists/story-review.md +30 -0
  8. package/framework/claude-md.template +37 -0
  9. package/framework/commands/sniper-compose.md +237 -0
  10. package/framework/commands/sniper-discover.md +397 -0
  11. package/framework/commands/sniper-doc.md +441 -0
  12. package/framework/commands/sniper-init.md +372 -0
  13. package/framework/commands/sniper-plan.md +608 -0
  14. package/framework/commands/sniper-review.md +305 -0
  15. package/framework/commands/sniper-solve.md +375 -0
  16. package/framework/commands/sniper-sprint.md +601 -0
  17. package/framework/commands/sniper-status.md +276 -0
  18. package/framework/config.template.yaml +117 -0
  19. package/framework/personas/cognitive/devils-advocate.md +30 -0
  20. package/framework/personas/cognitive/mentor-explainer.md +29 -0
  21. package/framework/personas/cognitive/performance-focused.md +30 -0
  22. package/framework/personas/cognitive/security-first.md +29 -0
  23. package/framework/personas/cognitive/systems-thinker.md +29 -0
  24. package/framework/personas/cognitive/user-empathetic.md +29 -0
  25. package/framework/personas/domain/.gitkeep +0 -0
  26. package/framework/personas/process/analyst.md +29 -0
  27. package/framework/personas/process/architect.md +30 -0
  28. package/framework/personas/process/developer.md +32 -0
  29. package/framework/personas/process/doc-analyst.md +63 -0
  30. package/framework/personas/process/doc-reviewer.md +62 -0
  31. package/framework/personas/process/doc-writer.md +42 -0
  32. package/framework/personas/process/product-manager.md +32 -0
  33. package/framework/personas/process/qa-engineer.md +31 -0
  34. package/framework/personas/process/scrum-master.md +31 -0
  35. package/framework/personas/process/ux-designer.md +31 -0
  36. package/framework/personas/technical/ai-ml.md +33 -0
  37. package/framework/personas/technical/api-design.md +32 -0
  38. package/framework/personas/technical/backend.md +32 -0
  39. package/framework/personas/technical/database.md +32 -0
  40. package/framework/personas/technical/frontend.md +33 -0
  41. package/framework/personas/technical/infrastructure.md +32 -0
  42. package/framework/personas/technical/security.md +34 -0
  43. package/framework/settings.template.json +6 -0
  44. package/framework/spawn-prompts/_template.md +22 -0
  45. package/framework/teams/discover.yaml +57 -0
  46. package/framework/teams/doc.yaml +76 -0
  47. package/framework/teams/plan.yaml +86 -0
  48. package/framework/teams/solve.yaml +48 -0
  49. package/framework/teams/sprint.yaml +68 -0
  50. package/framework/templates/architecture.md +72 -0
  51. package/framework/templates/brief.md +52 -0
  52. package/framework/templates/doc-api.md +53 -0
  53. package/framework/templates/doc-guide.md +35 -0
  54. package/framework/templates/doc-readme.md +49 -0
  55. package/framework/templates/epic.md +33 -0
  56. package/framework/templates/personas.md +118 -0
  57. package/framework/templates/prd.md +69 -0
  58. package/framework/templates/risks.md +64 -0
  59. package/framework/templates/security.md +90 -0
  60. package/framework/templates/sprint-review.md +32 -0
  61. package/framework/templates/story.md +37 -0
  62. package/framework/templates/ux-spec.md +54 -0
  63. package/framework/workflows/discover-only.md +39 -0
  64. package/framework/workflows/full-lifecycle.md +56 -0
  65. package/framework/workflows/quick-feature.md +44 -0
  66. package/framework/workflows/sprint-cycle.md +47 -0
  67. package/package.json +30 -0
@@ -0,0 +1,305 @@
1
+ # /sniper-review -- Run Review Gate for the Current Phase
2
+
3
+ You are executing the `/sniper-review` command. Your job is to evaluate the current phase's artifacts against its review checklist and enforce the appropriate gate policy. Follow every step below precisely.
4
+
5
+ ---
6
+
7
+ ## Step 0: Pre-Flight -- Determine Current Phase
8
+
9
+ 1. Read `.sniper/config.yaml`
10
+ 2. Extract `state.current_phase`
11
+ 3. If `current_phase` is `null`:
12
+ ```
13
+ ERROR: No active phase. The SNIPER lifecycle has not been started.
14
+
15
+ Current state:
16
+ Phase: not started
17
+ Sprint: 0
18
+
19
+ To begin, run one of these phase commands:
20
+ /sniper-discover -- Start Phase 1: Discovery & Analysis
21
+ /sniper-plan -- Start Phase 2: Planning & Architecture
22
+ /sniper-solve -- Start Phase 3: Epic Sharding & Story Creation
23
+ /sniper-sprint -- Start Phase 4: Implementation Sprint
24
+ ```
25
+ Then STOP.
26
+
27
+ 4. Store the current phase name. It must be one of: `discover`, `plan`, `solve`, `sprint`
28
+
29
+ ---
30
+
31
+ ## Step 1: Map Phase to Checklist and Gate Mode
32
+
33
+ Use this mapping to determine which checklist to load and what gate mode to enforce:
34
+
35
+ | Phase | Checklist File | Config Gate Key |
36
+ |-----------|-------------------------------------------|-----------------------|
37
+ | `discover` | `.sniper/checklists/discover-review.md` | `review_gates.after_discover` |
38
+ | `plan` | `.sniper/checklists/plan-review.md` | `review_gates.after_plan` |
39
+ | `solve` | `.sniper/checklists/story-review.md` | `review_gates.after_solve` |
40
+ | `sprint` | `.sniper/checklists/sprint-review.md` | `review_gates.after_sprint` |
41
+
42
+ 1. Read the gate mode from `config.yaml` using the appropriate key
43
+ 2. Read the checklist file
44
+
45
+ If the checklist file does not exist:
46
+ ```
47
+ ERROR: Checklist file not found: {path}
48
+ The framework installation may be incomplete. Check .sniper/checklists/ for available checklists.
49
+ ```
50
+ Then STOP.
51
+
52
+ ---
53
+
54
+ ## Step 2: Identify Artifacts to Review
55
+
56
+ Based on the current phase, identify which artifact files need to be reviewed:
57
+
58
+ ### Phase: discover
59
+ | Artifact | Expected Path |
60
+ |---------------------|---------------------|
61
+ | Project Brief | `docs/brief.md` |
62
+ | Risk Assessment | `docs/risks.md` |
63
+ | User Personas | `docs/personas.md` |
64
+
65
+ ### Phase: plan
66
+ | Artifact | Expected Path |
67
+ |---------------------|-------------------------|
68
+ | PRD | `docs/prd.md` |
69
+ | Architecture | `docs/architecture.md` |
70
+ | UX Specification | `docs/ux-spec.md` |
71
+ | Security Requirements| `docs/security.md` |
72
+
73
+ ### Phase: solve
74
+ | Artifact | Expected Path |
75
+ |---------------------|---------------------|
76
+ | Epics | `docs/epics/*.md` |
77
+ | Stories | `docs/stories/*.md` |
78
+
79
+ ### Phase: sprint
80
+ | Artifact | Expected Path |
81
+ |---------------------|--------------------------------------|
82
+ | Source Code | Files in ownership directories |
83
+ | Tests | Files in test directories |
84
+ | Sprint Stories | Stories assigned to current sprint |
85
+
86
+ For each expected artifact:
87
+ 1. Check if the file exists
88
+ 2. If it does NOT exist, record an immediate FAIL for that artifact:
89
+ ```
90
+ FAIL: {artifact_name} not found at {path}
91
+ ```
92
+ 3. If it exists, read its content for evaluation in Step 3
93
+
94
+ ---
95
+
96
+ ## Step 3: Evaluate Each Checklist Item
97
+
98
+ Parse the checklist file. Each line starting with `- [ ]` is a checklist item.
99
+
100
+ Group the checklist items by their section headers (## headers in the checklist file).
101
+
102
+ For each checklist item, evaluate it against the relevant artifact content:
103
+
104
+ ### Evaluation Criteria
105
+
106
+ For each item, assign one of three statuses:
107
+
108
+ **PASS** -- The criterion is clearly met in the artifact:
109
+ - The artifact contains substantive content addressing the criterion
110
+ - The content is specific, not generic placeholder text
111
+ - The content has enough depth to be actionable
112
+
113
+ **WARN** -- The criterion is partially met or needs improvement:
114
+ - The artifact addresses the topic but lacks specificity
115
+ - The content exists but is thin or uses vague language
116
+ - The artifact has the right structure but some sections are incomplete
117
+
118
+ **FAIL** -- The criterion is not met:
119
+ - The artifact does not address the criterion at all
120
+ - The relevant section is empty or contains only template placeholders
121
+ - The content contradicts the criterion
122
+ - The artifact file does not exist
123
+
124
+ ### Evaluation Process
125
+
126
+ For each checklist section:
127
+ 1. Read the relevant artifact
128
+ 2. For each checklist item in that section:
129
+ a. Search the artifact for content related to the criterion
130
+ b. Assess whether the content meets the criterion (PASS/WARN/FAIL)
131
+ c. Write a brief (one-line) justification for the assessment
132
+ 3. Record the result
133
+
134
+ Be thorough but fair:
135
+ - Do NOT fail items just because they could be better -- that is a WARN
136
+ - Do NOT pass items that only have placeholder text (template markers like `<!-- -->` or `TODO`)
137
+ - For cross-document consistency checks, read ALL referenced documents and compare
138
+
139
+ ---
140
+
141
+ ## Step 4: Present Results
142
+
143
+ Print a formatted review report:
144
+
145
+ ```
146
+ ============================================
147
+ SNIPER Review Gate: {phase} Phase
148
+ ============================================
149
+
150
+ Gate Mode: {strict|flexible|auto}
151
+ Checklist: {checklist_file}
152
+ Date: {today's date}
153
+
154
+ --------------------------------------------
155
+ {Section Name from Checklist}
156
+ --------------------------------------------
157
+ {PASS|WARN|FAIL} {checklist item text}
158
+ -> {brief justification}
159
+
160
+ {PASS|WARN|FAIL} {checklist item text}
161
+ -> {brief justification}
162
+
163
+ ... (repeat for all items in section)
164
+
165
+ --------------------------------------------
166
+ {Next Section Name}
167
+ --------------------------------------------
168
+ ... (repeat for all sections)
169
+
170
+ ============================================
171
+ Summary
172
+ ============================================
173
+
174
+ Total Items: {count}
175
+ PASS: {count} ({percentage}%)
176
+ WARN: {count} ({percentage}%)
177
+ FAIL: {count} ({percentage}%)
178
+
179
+ Overall: {ALL PASS | HAS WARNINGS | HAS FAILURES}
180
+ ```
181
+
182
+ ---
183
+
184
+ ## Step 5: Apply Gate Policy
185
+
186
+ Based on the gate mode and results, take the appropriate action:
187
+
188
+ ### Gate Mode: `strict`
189
+
190
+ **If ALL items are PASS (no WARN, no FAIL):**
191
+ 1. Print: "All review criteria passed. This gate requires human approval to advance."
192
+ 2. Ask the user: "Do you approve advancing from the {phase} phase to the next phase? (yes/no)"
193
+ 3. If YES: proceed to Step 6 (update state)
194
+ 4. If NO: print "Phase advancement blocked by reviewer. Address feedback and run `/sniper-review` again."
195
+
196
+ **If ANY items are WARN (but no FAIL):**
197
+ 1. Print: "Review found warnings. This gate requires human approval."
198
+ 2. List all WARN items with their justifications
199
+ 3. Ask: "There are {count} warnings. Do you want to approve advancement despite these warnings? (yes/no)"
200
+ 4. If YES: proceed to Step 6
201
+ 5. If NO: print "Phase advancement blocked. Address warnings and run `/sniper-review` again."
202
+
203
+ **If ANY items are FAIL:**
204
+ 1. Print: "Review found failures. This gate BLOCKS advancement."
205
+ 2. List all FAIL items with their justifications
206
+ 3. Print: "The following items MUST be addressed before this phase can be approved:"
207
+ 4. List each FAIL item as an action item
208
+ 5. Print: "Fix these issues and run `/sniper-review` again."
209
+ 6. Do NOT advance. Do NOT ask for override. STOP here.
210
+
211
+ ### Gate Mode: `flexible`
212
+
213
+ **If ALL items are PASS:**
214
+ 1. Print: "All review criteria passed. Auto-advancing to next phase."
215
+ 2. Proceed to Step 6 (update state)
216
+
217
+ **If ANY items are WARN (but no FAIL):**
218
+ 1. Print: "Review found warnings. Auto-advancing (flexible gate)."
219
+ 2. List WARN items briefly
220
+ 3. Print: "These items are noted for async review. Proceeding to next phase."
221
+ 4. Proceed to Step 6
222
+
223
+ **If ANY items are FAIL:**
224
+ 1. Print: "Review found failures in a flexible gate."
225
+ 2. List all FAIL items
226
+ 3. Ask: "There are {count} failures. This is a flexible gate -- do you want to advance anyway? (yes/no)"
227
+ 4. If YES: proceed to Step 6 with a note that failures were accepted
228
+ 5. If NO: print "Address failures and run `/sniper-review` again."
229
+
230
+ ### Gate Mode: `auto`
231
+
232
+ 1. Print: "Auto gate -- no review required. Advancing to next phase."
233
+ 2. Print any FAIL or WARN items as informational notes
234
+ 3. Proceed to Step 6
235
+
236
+ ---
237
+
238
+ ## Step 6: Update Lifecycle State
239
+
240
+ When a phase is approved for advancement:
241
+
242
+ 1. Read the current `.sniper/config.yaml`
243
+ 2. Determine the next phase using this progression:
244
+ - `discover` -> `plan`
245
+ - `plan` -> `solve`
246
+ - `solve` -> `sprint`
247
+ - `sprint` -> `sprint` (remains in sprint phase, increment sprint number)
248
+
249
+ 3. Update the `state` section:
250
+ ```yaml
251
+ state:
252
+ current_phase: {next_phase}
253
+ phase_history:
254
+ - phase: {completed_phase}
255
+ started_at: {start_date_if_known_or_today}
256
+ completed_at: {today's date in YYYY-MM-DD format}
257
+ approved_by: {human or auto}
258
+ gate_mode: {strict|flexible|auto}
259
+ pass_count: {number}
260
+ warn_count: {number}
261
+ fail_count: {number}
262
+ # ... (preserve existing history entries)
263
+ current_sprint: {increment by 1 if completing a sprint, else keep}
264
+ artifacts:
265
+ # Update artifact statuses based on what was reviewed:
266
+ # If all items for an artifact passed -> "approved"
267
+ # If any items warn but no fails -> "draft"
268
+ # If the artifact exists but has fails -> "draft"
269
+ # Keep existing values for artifacts not reviewed in this phase
270
+ ```
271
+
272
+ 4. Write the updated config back to `.sniper/config.yaml`
273
+
274
+ 5. Print the advancement confirmation:
275
+ ```
276
+ ============================================
277
+ Phase Advanced
278
+ ============================================
279
+
280
+ Completed: {phase}
281
+ Advanced to: {next_phase}
282
+ Artifacts updated in config.yaml
283
+
284
+ Next step: Run {next_command}
285
+ ```
286
+
287
+ Where `next_command` maps to:
288
+ - `plan` -> `/sniper-plan`
289
+ - `solve` -> `/sniper-solve`
290
+ - `sprint` -> `/sniper-sprint`
291
+ - staying in `sprint` -> `/sniper-sprint` (next sprint cycle)
292
+
293
+ ---
294
+
295
+ ## IMPORTANT RULES
296
+
297
+ - NEVER skip evaluation -- read every artifact and assess every checklist item.
298
+ - NEVER auto-approve a strict gate. Always require explicit human input.
299
+ - NEVER modify artifact files -- this command is a review tool, not an editor.
300
+ - Be honest in assessments. Do not inflate passes to speed things along.
301
+ - If artifacts contain only template placeholders, that is a FAIL, not a WARN.
302
+ - For cross-document consistency checks, you MUST read all referenced documents.
303
+ - When updating config.yaml, preserve ALL existing content -- only modify the state section.
304
+ - Always show the full formatted report before applying gate logic.
305
+ - If the user's config.yaml is malformed or unreadable, report an error and STOP.
@@ -0,0 +1,375 @@
1
+ # /sniper-solve -- Phase 3: Epic Sharding & Story Creation (Single Agent)
2
+
3
+ You are executing the `/sniper-solve` command. Your job is to break the PRD into implementable epics and self-contained stories. This phase runs as a **single agent** -- you do the work directly, no team is spawned. Follow every step below precisely.
4
+
5
+ **Arguments:** $ARGUMENTS
6
+
7
+ ---
8
+
9
+ ## Step 0: Pre-Flight Checks
10
+
11
+ Perform ALL checks before proceeding. If any critical check fails, STOP.
12
+
13
+ ### 0a. Verify SNIPER Is Initialized
14
+
15
+ 1. Read `.sniper/config.yaml`.
16
+ 2. If the file does not exist or `project.name` is empty:
17
+ - **STOP.** Print: "SNIPER is not initialized. Run `/sniper-init` first."
18
+
19
+ ### 0b. Verify Phase 2 Artifacts Exist
20
+
21
+ Check that the following files exist and are non-empty. Read each file to verify it has substantive content (not just a template with empty sections).
22
+
23
+ 1. `docs/prd.md` -- **REQUIRED.** If missing or empty, STOP and print: "Phase 2 artifact `docs/prd.md` is missing. Run `/sniper-plan` first."
24
+ 2. `docs/architecture.md` -- **REQUIRED.** If missing or empty, STOP and print: "Phase 2 artifact `docs/architecture.md` is missing. Run `/sniper-plan` first."
25
+ 3. `docs/ux-spec.md` -- **REQUIRED.** If missing or empty, STOP and print: "Phase 2 artifact `docs/ux-spec.md` is missing. Run `/sniper-plan` first."
26
+ 4. `docs/security.md` -- Recommended. If missing, print a warning but continue.
27
+
28
+ ### 0c. Verify Phase 2 Was Approved
29
+
30
+ 1. Read `state.phase_history` from config.yaml.
31
+ 2. Find the entry with `phase: plan`.
32
+ 3. Check that `approved_by` is not null and not "rejected".
33
+ 4. **If plan was not approved:** Print a warning:
34
+ > "WARNING: Phase 2 (plan) has not been formally approved. The planning review gate is strict -- artifacts should be reviewed and approved before sharding into stories. Continue anyway? (yes/no)"
35
+ - If no, STOP.
36
+ - If yes, proceed with a note in the output.
37
+
38
+ ### 0d. Verify Phase State
39
+
40
+ 1. Read `state.current_phase`.
41
+ 2. **If `current_phase` is `plan`:** Good -- planning is done and we are advancing. Proceed.
42
+ 3. **If `current_phase` is `solve`:** Already in progress or was interrupted.
43
+ - Ask the user: "The solve phase appears to be in progress. Do you want to restart? This will overwrite existing epics and stories. (yes/no)"
44
+ - If no, STOP.
45
+ 4. **If `current_phase` is `sprint`:** Project has advanced past this phase.
46
+ - Ask the user: "The project is in sprint phase. Re-running solve will recreate epics and stories. Are you sure? (yes/no)"
47
+ - If no, STOP.
48
+
49
+ ---
50
+
51
+ ## Step 1: Update Lifecycle State
52
+
53
+ Edit `.sniper/config.yaml`:
54
+
55
+ 1. Set `state.current_phase: solve`
56
+ 2. Append to `state.phase_history`:
57
+ ```yaml
58
+ - phase: solve
59
+ started_at: "{current ISO timestamp}"
60
+ completed_at: null
61
+ approved_by: null
62
+ ```
63
+
64
+ ---
65
+
66
+ ## Step 2: Load Persona and Context
67
+
68
+ This phase does NOT spawn a team. Instead, adopt the scrum-master persona yourself.
69
+
70
+ 1. Read `.sniper/personas/process/scrum-master.md` -- internalize this role. You ARE the scrum master for this step.
71
+ 2. Read `.sniper/personas/cognitive/systems-thinker.md` -- apply this thinking pattern to your sharding decisions.
72
+ 3. If `domain_pack` is set in config.yaml, read domain context files from `.sniper/domain-packs/{domain_pack}/context/`.
73
+
74
+ ---
75
+
76
+ ## Step 3: Read All Phase 2 Artifacts
77
+
78
+ Read each artifact fully. You will need deep understanding of all of these to shard properly.
79
+
80
+ 1. **Read `docs/prd.md`** -- This is your primary input. Pay close attention to:
81
+ - P0 requirements (must-have for v1)
82
+ - P1 requirements (should-have)
83
+ - P2 requirements (nice-to-have, likely deferred)
84
+ - User stories and acceptance criteria
85
+ - Non-functional requirements
86
+ - Out-of-scope items
87
+
88
+ 2. **Read `docs/architecture.md`** -- Pay close attention to:
89
+ - Component boundaries (these inform epic boundaries)
90
+ - Data models (stories need embedded schema context)
91
+ - API contracts (stories need embedded endpoint specs)
92
+ - Infrastructure requirements
93
+ - Cross-cutting concerns (auth, logging, etc.)
94
+
95
+ 3. **Read `docs/ux-spec.md`** -- Pay close attention to:
96
+ - Screen inventory (each screen may map to one or more stories)
97
+ - User flows (flows cross multiple components)
98
+ - Component hierarchy (informs frontend story scope)
99
+ - Responsive breakpoints and states
100
+
101
+ 4. **Read `docs/security.md`** (if exists) -- Pay close attention to:
102
+ - Auth model (will be its own epic or stories)
103
+ - Encryption requirements
104
+ - Compliance requirements
105
+
106
+ ---
107
+
108
+ ## Step 4: Read Templates
109
+
110
+ 1. Read `.sniper/templates/epic.md` -- Every epic MUST follow this template structure.
111
+ 2. Read `.sniper/templates/story.md` -- Every story MUST follow this template structure.
112
+
113
+ ---
114
+
115
+ ## Step 5: Create Output Directories
116
+
117
+ Create the following directories if they do not exist:
118
+ - `docs/epics/`
119
+ - `docs/stories/`
120
+
121
+ If the directories already exist and contain files from a previous run, note this. The files will be overwritten.
122
+
123
+ ---
124
+
125
+ ## Step 6: Shard PRD into Epics
126
+
127
+ Break the PRD into **6-12 epics**. Follow these rules strictly:
128
+
129
+ ### Sharding Rules
130
+
131
+ 1. **No overlap:** Every requirement from the PRD belongs to exactly ONE epic. No requirement should appear in two epics.
132
+ 2. **Clear boundaries:** Each epic has explicit "In Scope" and "Out of Scope" sections.
133
+ 3. **Architecture alignment:** Epic boundaries should align with architecture component boundaries where possible.
134
+ 4. **Dependency DAG:** Epic dependencies must form a Directed Acyclic Graph -- no circular dependencies.
135
+ 5. **Sizing:** Each epic should be roughly similar in size (not one massive epic and five tiny ones).
136
+ 6. **Embedded context:** Each epic must EMBED the relevant architecture sections, not just reference them.
137
+
138
+ ### Suggested Epic Structure
139
+
140
+ Consider organizing epics along these axes (adapt to the specific project):
141
+ - **E01: Foundation** -- Project setup, configuration, infrastructure scaffolding
142
+ - **E02: Authentication & Authorization** -- Auth flows, RBAC, session management
143
+ - **E03: Core Data Layer** -- Database models, migrations, seed data, repositories
144
+ - **E04-E08: Feature Epics** -- One epic per major feature area from the PRD
145
+ - **E09: API Layer** -- API contracts, middleware, validation, error handling
146
+ - **E10: Frontend Shell** -- Layout, navigation, routing, shared components
147
+ - **E11-E12: Integration** -- Third-party integrations, background jobs, notifications
148
+
149
+ Adapt this structure to fit the actual project. Do NOT force-fit the project into this template if it does not make sense.
150
+
151
+ ### Writing Each Epic
152
+
153
+ For each epic, create a file at `docs/epics/E{NN}-{slug}.md` where:
154
+ - `{NN}` is a zero-padded two-digit number (E01, E02, etc.)
155
+ - `{slug}` is a kebab-case short name (e.g., `auth-system`, `core-data`, `dashboard-ui`)
156
+
157
+ Follow the template at `.sniper/templates/epic.md` exactly. Fill in:
158
+ - **Status:** Draft
159
+ - **Priority:** P0, P1, or P2 (based on the requirements it covers)
160
+ - **Estimated Points:** Total story points for all stories in this epic
161
+ - **Dependencies:** List other epics this depends on (e.g., "E01-foundation" if it needs project setup)
162
+ - **Scope:** Clear in/out boundaries
163
+ - **Architecture Context:** COPY the relevant sections from `docs/architecture.md` -- data models, API contracts, component descriptions. Do NOT just write "see architecture doc."
164
+ - **Stories table:** List the stories that will be created in Step 7 (you can fill this in after Step 7)
165
+ - **Acceptance Criteria:** Epic-level criteria -- what must be true when ALL stories in this epic are done
166
+ - **Technical Notes:** Implementation-specific guidance
167
+
168
+ ---
169
+
170
+ ## Step 7: Create Stories for Each Epic
171
+
172
+ For each epic, create **3-8 stories**. Follow these rules strictly:
173
+
174
+ ### Story Rules
175
+
176
+ 1. **Self-contained:** A developer reading ONLY the story file must have ALL context needed to implement it. No "see PRD" or "see architecture doc" -- embed the context.
177
+ 2. **Given/When/Then:** All acceptance criteria MUST use Given/When/Then format.
178
+ 3. **File ownership:** Each story must declare which directories it touches (from the ownership rules in config.yaml).
179
+ 4. **Complexity:** Estimate S/M/L/XL. If any story is XL, split it into smaller stories.
180
+ 5. **Dependencies:** Declare inter-story dependencies. Must form a DAG.
181
+ 6. **Test requirements:** Specify what tests are needed (unit, integration, e2e).
182
+
183
+ ### Writing Each Story
184
+
185
+ For each story, create a file at `docs/stories/S{NN}-{slug}.md` where:
186
+ - `{NN}` is a zero-padded two-digit number, globally sequential across all epics (S01, S02, ..., S42, etc.)
187
+ - `{slug}` is a kebab-case short name
188
+
189
+ Follow the template at `.sniper/templates/story.md` exactly. Fill in:
190
+
191
+ - **Epic reference:** Which epic this belongs to
192
+ - **Complexity:** S, M, L (never XL -- split if needed)
193
+ - **Priority:** P0, P1, or P2
194
+ - **File Ownership:** Which directories from config.yaml this story touches (e.g., "backend, tests" or "frontend, tests")
195
+ - **Dependencies:** Other story IDs that must complete first
196
+
197
+ #### Embedded Context (CRITICAL)
198
+
199
+ For the "Embedded Context" section, COPY the relevant content from the source documents:
200
+
201
+ - **From PRD:** Copy the specific requirements and user stories this story implements. Include exact acceptance criteria text.
202
+ - **From Architecture:** Copy relevant data models (with field types), API endpoint specs (with request/response shapes), and architectural patterns to follow.
203
+ - **From UX Spec:** For frontend stories, copy the screen descriptions, component specs (with all states), user flow segments, and responsive requirements.
204
+
205
+ Do NOT summarize or paraphrase. COPY the exact sections. A developer should not need to open any other document.
206
+
207
+ #### Acceptance Criteria
208
+
209
+ Write testable assertions in Given/When/Then format:
210
+
211
+ ```
212
+ 1. **Given** a user is not authenticated
213
+ **When** they access the dashboard endpoint
214
+ **Then** they receive a 401 Unauthorized response with a redirect URL to the login page
215
+
216
+ 2. **Given** a user is authenticated with role "admin"
217
+ **When** they request the user list endpoint with pagination params page=2, limit=20
218
+ **Then** they receive a 200 response with exactly 20 user objects and correct pagination metadata
219
+ ```
220
+
221
+ Be specific. Include status codes, field names, exact behaviors.
222
+
223
+ #### Test Requirements
224
+
225
+ Specify what tests are needed:
226
+ ```
227
+ - [ ] Unit tests: {specific functions/methods to test}
228
+ - [ ] Integration tests: {specific API endpoints or flows to test}
229
+ - [ ] E2E tests (if applicable): {specific user scenarios}
230
+ ```
231
+
232
+ ---
233
+
234
+ ## Step 8: Backfill Epic Story Tables
235
+
236
+ After creating all stories, go back to each epic file and update the **Stories** table with the actual story IDs, names, complexity, dependencies, and file ownership.
237
+
238
+ ---
239
+
240
+ ## Step 9: Self-Review Against Checklist
241
+
242
+ Read `.sniper/checklists/story-review.md` and evaluate your work against every item.
243
+
244
+ ### Epic Structure Review
245
+
246
+ Go through each epic checklist item:
247
+ - [ ] Epics number between 6-12
248
+ - [ ] No overlap between epics
249
+ - [ ] Epic dependencies form a DAG
250
+ - [ ] Each epic has clear scope boundaries
251
+ - [ ] Architecture context is EMBEDDED
252
+ - [ ] Complexity estimates are realistic
253
+
254
+ ### Story Quality Review
255
+
256
+ For EACH story, verify:
257
+ - [ ] Story is self-contained (a developer can implement from the story alone)
258
+ - [ ] PRD context is EMBEDDED (not just referenced)
259
+ - [ ] Architecture context is EMBEDDED
260
+ - [ ] UX context is EMBEDDED for frontend stories
261
+ - [ ] Acceptance criteria use Given/When/Then format
262
+ - [ ] Every criterion is testable
263
+ - [ ] Test requirements are specified
264
+ - [ ] File ownership is assigned
265
+ - [ ] Dependencies are declared
266
+ - [ ] Complexity is S/M/L (not XL)
267
+
268
+ ### Coverage Review
269
+
270
+ - [ ] All P0 requirements have implementing stories
271
+ - [ ] All P1 requirements have implementing stories
272
+ - [ ] All architecture components have at least one story
273
+ - [ ] Story dependency chains allow reasonable sprint planning
274
+
275
+ ---
276
+
277
+ ## Step 10: Fix Issues Found in Self-Review
278
+
279
+ If the self-review identified any issues:
280
+
281
+ 1. Fix each issue directly by editing the relevant epic or story file.
282
+ 2. Common fixes:
283
+ - **Missing embedded context:** Go back to the source doc, copy the relevant section into the story.
284
+ - **Vague acceptance criteria:** Rewrite with specific Given/When/Then and concrete values.
285
+ - **XL story:** Split into two or more smaller stories with clear boundaries.
286
+ - **Missing test requirements:** Add specific test types and what to test.
287
+ - **Circular dependencies:** Restructure the dependency graph to break the cycle.
288
+ 3. After fixing, re-verify the specific items that failed.
289
+
290
+ ---
291
+
292
+ ## Step 11: Update Lifecycle State
293
+
294
+ Edit `.sniper/config.yaml`:
295
+
296
+ 1. Set `state.artifacts.epics: draft`
297
+ 2. Set `state.artifacts.stories: draft`
298
+ 3. Update the solve entry in `state.phase_history`:
299
+ - Set `completed_at: "{current ISO timestamp}"`
300
+ - Set `approved_by: "auto-flexible"` (this is a flexible gate)
301
+
302
+ ---
303
+
304
+ ## Step 12: Present Results and Next Steps
305
+
306
+ Print a formatted summary:
307
+
308
+ ```
309
+ ============================================
310
+ SNIPER Phase 3: Epic Sharding Complete
311
+ ============================================
312
+
313
+ Epics Created: {count}
314
+ Stories Created: {count}
315
+
316
+ Epic Summary:
317
+ E01-{slug} | P{x} | {story count} stories | {total points} pts
318
+ E02-{slug} | P{x} | {story count} stories | {total points} pts
319
+ ...
320
+
321
+ Story Breakdown by Complexity:
322
+ Small (S): {count}
323
+ Medium (M): {count}
324
+ Large (L): {count}
325
+
326
+ Story Breakdown by File Ownership:
327
+ Backend: {count} stories
328
+ Frontend: {count} stories
329
+ Infrastructure: {count} stories
330
+ Full-stack: {count} stories
331
+
332
+ Self-Review Results:
333
+ Passed: {count}/{total} checklist items
334
+ Fixed: {count} issues auto-corrected
335
+ Attention: {count} items for async review
336
+
337
+ Review Gate: FLEXIBLE (auto-advanced)
338
+
339
+ ============================================
340
+ Next Steps
341
+ ============================================
342
+
343
+ 1. Review epics in `docs/epics/` and stories in `docs/stories/`
344
+ 2. When ready, run `/sniper-sprint` to begin Phase 4: Implementation Sprint
345
+ 3. `/sniper-sprint` will ask you to select which stories to include in the sprint
346
+ 4. Or run `/sniper-status` to see the full lifecycle state
347
+
348
+ Recommended first sprint: Start with foundation stories (E01)
349
+ and any stories with no dependencies.
350
+
351
+ ============================================
352
+
353
+ Files:
354
+ Epics: docs/epics/E01-*.md through docs/epics/E{NN}-*.md
355
+ Stories: docs/stories/S01-*.md through docs/stories/S{NN}-*.md
356
+
357
+ ============================================
358
+ ```
359
+
360
+ ---
361
+
362
+ ## IMPORTANT RULES
363
+
364
+ - This phase runs as a SINGLE AGENT. Do NOT create a team or spawn teammates.
365
+ - You ARE the scrum master. You do the work directly.
366
+ - Stories MUST be self-contained. This is the most critical quality requirement. A developer reading only the story file must have all context to implement it.
367
+ - EMBED context from PRD, architecture, and UX spec. Do NOT just reference them.
368
+ - Acceptance criteria MUST be Given/When/Then format with specific, testable assertions.
369
+ - No story should be XL complexity. Split large stories.
370
+ - Epic and story dependencies MUST form a DAG. No circular dependencies.
371
+ - If `$ARGUMENTS` contains "dry-run", perform Steps 0-4 only (read all artifacts and plan the sharding) and present the proposed epic structure without creating files. Let the user approve before proceeding.
372
+ - If `$ARGUMENTS` contains a specific epic count (e.g., "8 epics"), use that as a target instead of the 6-12 range.
373
+ - All file paths are relative to the project root.
374
+ - Do NOT start implementation. Do NOT write code. This phase produces planning artifacts only.
375
+ - Do NOT proceed to `/sniper-sprint` automatically -- let the user initiate it.