@comfanion/workflow 3.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 (95) hide show
  1. package/README.md +185 -0
  2. package/bin/cli.js +406 -0
  3. package/package.json +50 -0
  4. package/src/build-info.json +16 -0
  5. package/src/opencode/ARCHITECTURE.md +255 -0
  6. package/src/opencode/FLOW.yaml +900 -0
  7. package/src/opencode/agents/analyst.md +141 -0
  8. package/src/opencode/agents/architect.md +177 -0
  9. package/src/opencode/agents/change-manager.md +263 -0
  10. package/src/opencode/agents/dev.md +171 -0
  11. package/src/opencode/agents/module-docs.md +628 -0
  12. package/src/opencode/agents/pm.md +157 -0
  13. package/src/opencode/agents/researcher.md +254 -0
  14. package/src/opencode/agents/sm.md +184 -0
  15. package/src/opencode/agents/workflow-orchestrator.md +249 -0
  16. package/src/opencode/checklists/architecture-checklist.md +166 -0
  17. package/src/opencode/checklists/code-review-checklist.md +151 -0
  18. package/src/opencode/checklists/prd-checklist.md +140 -0
  19. package/src/opencode/checklists/requirements-checklist.md +86 -0
  20. package/src/opencode/checklists/story-checklist.md +137 -0
  21. package/src/opencode/commands/architecture.md +68 -0
  22. package/src/opencode/commands/archive.md +146 -0
  23. package/src/opencode/commands/change.md +169 -0
  24. package/src/opencode/commands/clarify.md +132 -0
  25. package/src/opencode/commands/code-review.md +96 -0
  26. package/src/opencode/commands/coding-standards.md +102 -0
  27. package/src/opencode/commands/dev-story.md +80 -0
  28. package/src/opencode/commands/diagram.md +152 -0
  29. package/src/opencode/commands/epics.md +52 -0
  30. package/src/opencode/commands/help.md +139 -0
  31. package/src/opencode/commands/jira-sync.md +58 -0
  32. package/src/opencode/commands/module-docs.md +158 -0
  33. package/src/opencode/commands/prd.md +63 -0
  34. package/src/opencode/commands/quick.md +166 -0
  35. package/src/opencode/commands/requirements.md +49 -0
  36. package/src/opencode/commands/research.md +113 -0
  37. package/src/opencode/commands/sprint-plan.md +59 -0
  38. package/src/opencode/commands/stories.md +61 -0
  39. package/src/opencode/commands/validate.md +84 -0
  40. package/src/opencode/commands/workflow-status.md +150 -0
  41. package/src/opencode/config.yaml +223 -0
  42. package/src/opencode/opencode.json +36 -0
  43. package/src/opencode/skills/acceptance-criteria/SKILL.md +212 -0
  44. package/src/opencode/skills/adr-writing/SKILL.md +241 -0
  45. package/src/opencode/skills/architecture-design/SKILL.md +183 -0
  46. package/src/opencode/skills/architecture-validation/SKILL.md +199 -0
  47. package/src/opencode/skills/archiving/SKILL.md +191 -0
  48. package/src/opencode/skills/changelog/SKILL.md +280 -0
  49. package/src/opencode/skills/code-review/SKILL.md +193 -0
  50. package/src/opencode/skills/coding-standards/SKILL.md +430 -0
  51. package/src/opencode/skills/diagram-creation/SKILL.md +273 -0
  52. package/src/opencode/skills/doc-todo/SKILL.md +325 -0
  53. package/src/opencode/skills/epic-writing/SKILL.md +291 -0
  54. package/src/opencode/skills/jira-integration/SKILL.md +560 -0
  55. package/src/opencode/skills/methodologies/SKILL.md +376 -0
  56. package/src/opencode/skills/module-documentation/SKILL.md +214 -0
  57. package/src/opencode/skills/prd-validation/SKILL.md +164 -0
  58. package/src/opencode/skills/prd-writing/SKILL.md +104 -0
  59. package/src/opencode/skills/requirements-gathering/SKILL.md +132 -0
  60. package/src/opencode/skills/requirements-validation/SKILL.md +141 -0
  61. package/src/opencode/skills/research-methodology/SKILL.md +140 -0
  62. package/src/opencode/skills/sprint-planning/SKILL.md +217 -0
  63. package/src/opencode/skills/story-writing/SKILL.md +574 -0
  64. package/src/opencode/skills/test-design/SKILL.md +313 -0
  65. package/src/opencode/skills/translation/SKILL.md +411 -0
  66. package/src/opencode/templates/CHANGELOG.md +82 -0
  67. package/src/opencode/templates/adr-template.md +115 -0
  68. package/src/opencode/templates/architecture-template.md +362 -0
  69. package/src/opencode/templates/change-proposal-template.md +186 -0
  70. package/src/opencode/templates/epic-template.md +151 -0
  71. package/src/opencode/templates/git-workflow-template.md +384 -0
  72. package/src/opencode/templates/integration-tests-template.md +265 -0
  73. package/src/opencode/templates/jira-cache-template.yaml +103 -0
  74. package/src/opencode/templates/module-index-template.md +139 -0
  75. package/src/opencode/templates/module-test-cases-template.md +230 -0
  76. package/src/opencode/templates/prd-acceptance-criteria-template.md +124 -0
  77. package/src/opencode/templates/prd-template.md +479 -0
  78. package/src/opencode/templates/requirements-template.md +132 -0
  79. package/src/opencode/templates/sprint-status-template.yaml +84 -0
  80. package/src/opencode/templates/story-template.md +437 -0
  81. package/src/opencode/templates/testing-standards-template.md +359 -0
  82. package/src/opencode/workflows/dev-story/instructions.md +529 -0
  83. package/src/repo-structure/.gitattributes +64 -0
  84. package/src/repo-structure/CONTRIBUTING.md +182 -0
  85. package/src/repo-structure/README.md +77 -0
  86. package/src/repo-structure/docs/README.md +62 -0
  87. package/src/repo-structure/docs/api/README.md +43 -0
  88. package/src/repo-structure/docs/architecture/README.md +36 -0
  89. package/src/repo-structure/docs/architecture/adr/README.md +53 -0
  90. package/src/repo-structure/docs/architecture/diagrams/README.md +59 -0
  91. package/src/repo-structure/docs/coding-standards/README.md +52 -0
  92. package/src/repo-structure/docs/confluence/README.md +43 -0
  93. package/src/repo-structure/docs/requirements/README.md +28 -0
  94. package/src/repo-structure/docs/sprint-artifacts/README.md +76 -0
  95. package/src/repo-structure/docs/sprint-artifacts/backlog/README.md +24 -0
@@ -0,0 +1,574 @@
1
+ ---
2
+ name: story-writing
3
+ description: How to write user stories with proper format, acceptance criteria in Given/When/Then, and technical tasks
4
+ license: MIT
5
+ compatibility: opencode
6
+ metadata:
7
+ domain: agile
8
+ artifacts: docs/sprint-artifacts/*/stories/story-*.md
9
+ ---
10
+
11
+ # Story Writing Skill
12
+
13
+ ## When to Use
14
+
15
+ Use this skill when you need to:
16
+ - Create stories from epics
17
+ - Write detailed acceptance criteria
18
+ - Define technical implementation tasks
19
+ - Specify test scenarios
20
+
21
+ ## Template
22
+
23
+ Use template at: `@.opencode/templates/story-template.md`
24
+
25
+ ## Story Structure
26
+
27
+ ### Header
28
+
29
+ ```markdown
30
+ # Story N.M: [Title]
31
+
32
+ **Story ID:** [MODULE]-S[EPIC]-[NN]
33
+ **Epic:** [MODULE]-E[EPIC] - [Epic Title]
34
+ **Status:** TODO | IN_PROGRESS | REVIEW | DONE
35
+ **Priority:** P0 | P1 | P2
36
+ **Estimate:** XS | S | M | L | XL
37
+ ```
38
+
39
+ ### User Story Format (MANDATORY)
40
+
41
+ ```markdown
42
+ ## User Story
43
+
44
+ **As a** [user type],
45
+ **I want** [capability/action],
46
+ **So that** [benefit/value].
47
+ ```
48
+
49
+ ### Sections
50
+
51
+ 1. **User Story** - As a... I want... So that...
52
+ 2. **Acceptance Criteria** - Given/When/Then (MANDATORY)
53
+ 3. **Technical Tasks** - Implementation checklist
54
+ 4. **Definition of Done** - Quality gates
55
+ 5. **Technical Context** - Related files, patterns
56
+ 6. **Test Scenarios** - Unit and integration tests
57
+ 7. **Notes** - Additional context
58
+
59
+ ## Naming Conventions
60
+
61
+ ### File Naming
62
+
63
+ ```
64
+ story-[EPIC]-[NN]-[description].md
65
+
66
+ Examples:
67
+ - story-05-01-product-aggregate.md
68
+ - story-05-02-product-repository.md
69
+ - story-05-03-product-http-endpoints.md
70
+ ```
71
+
72
+ ### Story ID Format
73
+
74
+ ```
75
+ [MODULE]-S[EPIC]-[NN]
76
+
77
+ Examples:
78
+ - CATALOG-S05-01
79
+ - CATALOG-S05-02
80
+ - INVENTORY-S10-01
81
+ ```
82
+
83
+ ## Acceptance Criteria (MANDATORY)
84
+
85
+ Use skill: `acceptance-criteria`
86
+
87
+ ### Format: Given/When/Then
88
+
89
+ ```markdown
90
+ ## Acceptance Criteria
91
+
92
+ ### AC1: Create product with valid data
93
+
94
+ **Given** authenticated merchant with "product:create" permission
95
+ **When** POST /api/v1/products with:
96
+ - name: "Test Product"
97
+ - price: 100.00
98
+ - currency: "UAH"
99
+ **Then** 201 Created returned
100
+ **And** response contains product with generated UUID
101
+ **And** product status is "pending"
102
+ **And** "product.created" event published to Kafka
103
+
104
+ ### AC2: Reject invalid product data
105
+
106
+ **Given** authenticated merchant
107
+ **When** POST /api/v1/products with missing required field "name"
108
+ **Then** 400 Bad Request returned
109
+ **And** error response contains:
110
+ - field: "name"
111
+ - message: "name is required"
112
+ **And** no product is created in database
113
+
114
+ ### AC3: Unauthorized access rejected
115
+
116
+ **Given** user without "product:create" permission
117
+ **When** POST /api/v1/products
118
+ **Then** 403 Forbidden returned
119
+ ```
120
+
121
+ ### AC Coverage
122
+
123
+ Each story should have:
124
+ - **Happy path** - At least 1 success scenario
125
+ - **Validation errors** - Invalid input handling
126
+ - **Authorization** - Permission checks
127
+ - **Edge cases** - Boundary conditions
128
+
129
+ ## Atomic Tasks (1-2 hours each)
130
+
131
+ ### Task Decomposition Rules
132
+
133
+ **MANDATORY**: Every story MUST be broken into atomic tasks:
134
+
135
+ | Rule | Description |
136
+ |------|-------------|
137
+ | **Max 2 hours** | No task should exceed 2 hours of work |
138
+ | **Single responsibility** | One clear deliverable per task |
139
+ | **Explicit dependencies** | Every task declares what it depends on |
140
+ | **Parallel opportunities** | Independent tasks can run in parallel |
141
+ | **Red-Green-Refactor** | Follow TDD cycle in task types |
142
+
143
+ ## Development Methodologies
144
+
145
+ **Set in config.yaml:** `development.methodology: tdd | stub`
146
+
147
+ ### TDD (Test-Driven Development)
148
+
149
+ ```
150
+ Interface → Test (RED) → Implementation (GREEN) → Refactor
151
+ ```
152
+
153
+ | Step | Action | Validation |
154
+ |------|--------|------------|
155
+ | 1 | Define interface/contract | Compiles |
156
+ | 2 | Write failing test | Test FAILS (RED) |
157
+ | 3 | Implement minimal code | Test PASSES (GREEN) |
158
+ | 4 | Refactor | Tests still PASS |
159
+
160
+ **Best for:** New features, complex logic, when requirements are clear
161
+
162
+ ### STUB (Stub-First Development)
163
+
164
+ ```
165
+ Interface → Stub Implementation → Tests → Real Implementation
166
+ ```
167
+
168
+ | Step | Action | Validation |
169
+ |------|--------|------------|
170
+ | 1 | Define interface/contract | Compiles |
171
+ | 2 | Write stub (mock data) | Returns expected shape |
172
+ | 3 | Write tests against stub | Tests PASS |
173
+ | 4 | Replace stub with real impl | Tests still PASS |
174
+
175
+ **Best for:** Exploratory work, unclear requirements, rapid prototyping
176
+
177
+ ### Task Structure by Methodology
178
+
179
+ **TDD Task:**
180
+ ```markdown
181
+ ### T2: Implement {{Entity}} Aggregate
182
+ - **Estimate:** 1.5h
183
+ - **Depends on:** T1
184
+ - **Methodology:** TDD
185
+ - **Deliverables:**
186
+ - [ ] Aggregate: `domain/aggregate/entity.go`
187
+ - **Validation Test:** `domain/aggregate/entity_test.go`
188
+ - [ ] Test creation happy path
189
+ - [ ] Test validation errors
190
+ - [ ] **⚠️ ALL TESTS MUST PASS**
191
+ ```
192
+
193
+ **STUB Task:**
194
+ ```markdown
195
+ ### T2: Implement Repository (Stub → Real)
196
+ - **Estimate:** 1.5h
197
+ - **Depends on:** T1
198
+ - **Methodology:** STUB
199
+ - **Deliverables:**
200
+ - [ ] Stub: `infrastructure/repo/entity_memory_repo.go`
201
+ - [ ] Real: `infrastructure/repo/entity_postgres_repo.go`
202
+ - **Validation Test:** `infrastructure/repo/entity_repo_test.go`
203
+ - [ ] Test with stub first
204
+ - [ ] Replace stub with real
205
+ - [ ] **⚠️ ALL TESTS MUST PASS**
206
+ ```
207
+
208
+ ---
209
+
210
+ ### Task Types
211
+
212
+ | Type | Icon | Description |
213
+ |------|------|-------------|
214
+ | INTERFACE | 📐 | Define interface/contract |
215
+ | RED | 🔴 | Write failing test first (TDD) |
216
+ | GREEN | 🟢 | Implement to pass tests |
217
+ | STUB | 🧪 | Stub implementation (STUB methodology) |
218
+ | REFACTOR | 🔵 | Clean up, no new functionality |
219
+ | INTEGRATION | 🔗 | E2E integration test |
220
+ | DOCS | 📝 | Documentation only |
221
+
222
+ ### Task Structure
223
+
224
+ ```markdown
225
+ ### T{N}: {Task Name}
226
+ - **Estimate:** 1h | 1.5h | 2h
227
+ - **Depends on:** T1, T2 | - (none)
228
+ - **Blocks:** T5, T6 | - (none)
229
+ - **Type:** 🔴 RED | 🟢 GREEN | 🔵 REFACTOR | 📝 DOCS
230
+ - **Files:** `path/to/file.go`
231
+ - **Definition of Done:**
232
+ - [ ] Specific deliverable 1
233
+ - [ ] Specific deliverable 2
234
+ - **Notes:** Implementation hints
235
+ ```
236
+
237
+ ### Dependency Graph (ASCII)
238
+
239
+ Visualize task dependencies:
240
+
241
+ ```
242
+ T1 ──┬──► T2 ──► T4
243
+ │ │
244
+ └──► T3 ────┴──► T5 ──► T6
245
+ ```
246
+
247
+ - `──►` = depends on (must complete before)
248
+ - `┬` = fork (parallel branches)
249
+ - `┴` = join (waits for all)
250
+
251
+ ### Summary Table (MANDATORY)
252
+
253
+ ```markdown
254
+ | ID | Task | Est | Depends On | Status |
255
+ |----|------|-----|------------|--------|
256
+ | T1 | Write aggregate test | 1h | - | ⬜ |
257
+ | T2 | Implement aggregate | 1.5h | T1 | ⬜ |
258
+ | T3 | Write repository interface | 0.5h | T1 | ⬜ |
259
+ | T4 | Write use case test | 1h | T2 | ⬜ |
260
+ | T5 | Implement use case | 1.5h | T3, T4 | ⬜ |
261
+ | T6 | Implement repository | 1.5h | T3 | ⬜ |
262
+ | T7 | Write HTTP handler test | 1h | T5 | ⬜ |
263
+ | T8 | Implement HTTP handler | 1h | T7 | ⬜ |
264
+ | T9 | Integration tests | 1.5h | T6, T8 | ⬜ |
265
+ | T10 | Refactor & docs | 1h | T9 | ⬜ |
266
+ ```
267
+
268
+ **Status:** ⬜ TODO | 🔄 IN_PROGRESS | ✅ DONE | ⏸️ BLOCKED
269
+
270
+ ### Execution Phases
271
+
272
+ Group tasks by parallel execution opportunity:
273
+
274
+ ```markdown
275
+ ### Execution Order
276
+
277
+ Phase 1: T1 (no deps)
278
+ Phase 2: T2, T3 (parallel - both depend only on T1)
279
+ Phase 3: T4, T6 (parallel - independent branches)
280
+ Phase 4: T5 (waits for T3, T4)
281
+ Phase 5: T7 (waits for T5)
282
+ Phase 6: T8, T6-continued (parallel)
283
+ Phase 7: T9 (waits for T6, T8)
284
+ Phase 8: T10 (final)
285
+
286
+ **Critical Path:** T1 → T2 → T4 → T5 → T7 → T8 → T9 → T10
287
+ **Total Estimate:** 12h
288
+ **Parallel Savings:** ~3h (25%)
289
+ ```
290
+
291
+ ### Example: CreateProduct Story Tasks
292
+
293
+ ```markdown
294
+ | ID | Task | Est | Depends On | Type |
295
+ |----|------|-----|------------|------|
296
+ | T1 | Write Product aggregate test | 1h | - | 🔴 |
297
+ | T2 | Implement Product aggregate | 1.5h | T1 | 🟢 |
298
+ | T3 | Write ProductRepository interface | 0.5h | - | 📝 |
299
+ | T4 | Write CreateProduct use case test | 1h | T2, T3 | 🔴 |
300
+ | T5 | Implement CreateProduct handler | 1.5h | T4 | 🟢 |
301
+ | T6 | Implement PostgreSQL repository | 1.5h | T3 | 🟢 |
302
+ | T7 | Write HTTP handler test | 1h | T5 | 🔴 |
303
+ | T8 | Implement HTTP handler | 1h | T7 | 🟢 |
304
+ | T9 | Write integration tests | 1.5h | T6, T8 | 🔴 |
305
+ | T10 | Refactor & documentation | 1h | T9 | 🔵 |
306
+
307
+ **Graph:**
308
+ T1 ──► T2 ──┬──► T4 ──► T5 ──► T7 ──► T8 ──┬──► T9 ──► T10
309
+ │ │
310
+ T3 ─────────┴───────────► T6 ───────────────┘
311
+ ```
312
+
313
+ ### Splitting Large Tasks
314
+
315
+ If a task exceeds 2h, split it. **Each split task MUST have validation test.**
316
+
317
+ | Original (4h) | Split Into (with tests) |
318
+ |---------------|------------------------|
319
+ | "Implement repository" | **T1:** Interface + contract test (0.5h)<br>**T2:** Save method + test (1h)<br>**T3:** FindByID + test (1h)<br>**T4:** List + test (1.5h) |
320
+ | "Write aggregate" | **T1:** Value objects + tests (1h)<br>**T2:** Aggregate + creation test (1h)<br>**T3:** Business rules + tests (1h) |
321
+
322
+ ### Task Template with Validation
323
+
324
+ ```markdown
325
+ ### T{N}: {Task Name}
326
+ - **Estimate:** 1.5h
327
+ - **Depends on:** T{N-1}
328
+ - **Methodology:** TDD | STUB
329
+ - **Deliverables:**
330
+ - [ ] File: `path/to/implementation.go`
331
+ - [ ] File: `path/to/implementation2.go`
332
+ - **Validation Test:** `path/to/implementation_test.go`
333
+ - [ ] Test case 1: happy path
334
+ - [ ] Test case 2: error handling
335
+ - [ ] Test case 3: edge case
336
+ - [ ] **⚠️ ALL TESTS MUST PASS** ← MANDATORY
337
+ - **Notes:** Implementation hints
338
+ ```
339
+
340
+ ### Validation Test Requirements
341
+
342
+ **Every task MUST have:**
343
+
344
+ | Test Type | Required | Description |
345
+ |-----------|----------|-------------|
346
+ | Happy path | ✅ Yes | Normal success case |
347
+ | Error handling | ✅ Yes | Expected failures |
348
+ | Edge cases | Recommended | Boundary conditions |
349
+ | **Pass gate** | ✅ MANDATORY | `⚠️ ALL TESTS MUST PASS` |
350
+
351
+ ### TDD vs STUB Task Examples
352
+
353
+ **TDD Example:**
354
+ ```markdown
355
+ ### T2: Implement Product Aggregate
356
+ - **Methodology:** TDD
357
+ - **Deliverables:**
358
+ - [ ] `domain/aggregate/product.go`
359
+ - **Validation Test:** `domain/aggregate/product_test.go`
360
+ - [ ] 🔴 Write test first (should FAIL)
361
+ - [ ] 🟢 Implement until test PASSES
362
+ - [ ] 🔵 Refactor, tests still PASS
363
+ - [ ] **⚠️ ALL TESTS MUST PASS**
364
+ ```
365
+
366
+ **STUB Example:**
367
+ ```markdown
368
+ ### T4: Implement Repository
369
+ - **Methodology:** STUB
370
+ - **Deliverables:**
371
+ - [ ] Stub: `infrastructure/repo/product_memory_repo.go`
372
+ - [ ] Real: `infrastructure/repo/product_postgres_repo.go`
373
+ - **Validation Test:** `infrastructure/repo/product_repo_test.go`
374
+ - [ ] 🧪 Write stub (mock data)
375
+ - [ ] ✅ Write tests against stub
376
+ - [ ] 🟢 Replace with real impl
377
+ - [ ] **⚠️ ALL TESTS MUST PASS**
378
+ ```
379
+
380
+ ## Definition of Done
381
+
382
+ Standard DoD checklist:
383
+
384
+ ```markdown
385
+ ## Definition of Done
386
+
387
+ - [ ] All acceptance criteria implemented and verified
388
+ - [ ] Unit tests written and passing (>80% coverage)
389
+ - [ ] Integration tests written and passing
390
+ - [ ] Code follows CLAUDE.md patterns
391
+ - [ ] Code reviewed and approved
392
+ - [ ] No linting errors
393
+ - [ ] Documentation updated
394
+ - [ ] PR merged to epic branch
395
+ ```
396
+
397
+ ## Story Sizing
398
+
399
+ ### Size Guide
400
+
401
+ | Size | Duration | Complexity |
402
+ |------|----------|------------|
403
+ | XS | 2-4 hours | Trivial change |
404
+ | S | 0.5-1 day | Simple feature |
405
+ | M | 1-2 days | Standard feature |
406
+ | L | 2-3 days | Complex feature |
407
+ | XL | 3-5 days | Very complex, consider splitting |
408
+
409
+ ### Too Big? Split!
410
+
411
+ If story is XL or larger:
412
+ 1. Split by layer (domain, application, infrastructure)
413
+ 2. Split by operation (create, read, update, delete)
414
+ 3. Split by scenario (happy path, error handling)
415
+
416
+ ## Story Order Within Epic
417
+
418
+ Recommended order:
419
+ 1. Domain layer (aggregates, value objects)
420
+ 2. Repository interfaces
421
+ 3. Use cases
422
+ 4. Repository implementations
423
+ 5. HTTP handlers
424
+ 6. Event publishers
425
+ 7. Integration tests
426
+
427
+ ## Test Scenarios
428
+
429
+ ```markdown
430
+ ## Test Scenarios
431
+
432
+ ### Unit Tests
433
+ 1. Product aggregate creation with valid data
434
+ 2. Product aggregate validation rules
435
+ 3. Price value object constraints
436
+ 4. Use case handler happy path
437
+ 5. Use case handler validation errors
438
+
439
+ ### Integration Tests
440
+ 1. Create product via HTTP API
441
+ 2. Retrieve product via HTTP API
442
+ 3. Product persisted in PostgreSQL
443
+ 4. Event published to Kafka
444
+ ```
445
+
446
+ ---
447
+
448
+ ## TODO Comments for Future Work
449
+
450
+ ### When to Add TODO
451
+
452
+ | Situation | TODO Type | Example |
453
+ |-----------|-----------|---------|
454
+ | Interface for next task | `TASK` | `TODO(TASK:T3): Implement this method` |
455
+ | Basic impl, enhanced later | `STORY` | `TODO(STORY:S05-04): Add pagination` |
456
+ | Sync now, async later | `EPIC` | `TODO(EPIC:E06): Make event-driven` |
457
+ | Performance fix planned | `SPRINT` | `TODO(SPRINT:SP3): Optimize to O(n)` |
458
+ | Nice to have, not planned | `BACKLOG` | `TODO(BACKLOG): Add retry logic` |
459
+ | Known shortcut/hack | `TECH_DEBT` | `TODO(TECH_DEBT): Extract common logic` |
460
+
461
+ ### TODO Format (IDE-compatible)
462
+
463
+ ```go
464
+ // TODO({TYPE}:{ID}): {Short description}
465
+ // Context: {Why this TODO exists}
466
+ // Blocked by: {What must happen first}
467
+ // See: {Link to story/epic if applicable}
468
+ ```
469
+
470
+ **IDE Detection:**
471
+ - GoLand: Settings → Editor → TODO → Pattern: `\bTODO\b.*`
472
+ - VS Code: Highlight extension or built-in
473
+ - Pattern matches: `TODO`, `FIXME`, `HACK`
474
+
475
+ ### Examples
476
+
477
+ ```
478
+ // Interface for next task
479
+ interface ProductRepository {
480
+ save(product: Product): void
481
+
482
+ // TODO(TASK:T4): Add findById method
483
+ // Implemented in task T4
484
+ }
485
+
486
+ // Use case - pagination in next story
487
+ function list(): Product[] {
488
+ // TODO(STORY:CATALOG-S05-04): Add pagination support
489
+ // Current: returns all products (OK for MVP)
490
+ // Next story adds: limit, offset, cursor-based pagination
491
+ return repo.findAll()
492
+ }
493
+
494
+ // Repository - batch operations in future epic
495
+ function save(product: Product): void {
496
+ // TODO(EPIC:CATALOG-E08): Add batch save for bulk imports
497
+ // Current: single insert
498
+ // Epic 8 adds bulk operations
499
+ }
500
+
501
+ // API handler - rate limiting not planned yet
502
+ function createProduct(request): Response {
503
+ // TODO(BACKLOG): Add rate limiting per merchant
504
+ // Not planned, but would prevent abuse
505
+ }
506
+
507
+ // Known tech debt
508
+ function calculateDiscount(items: Item[]): number {
509
+ // TODO(TECH_DEBT): Extract discount rules to domain service
510
+ // Currently hardcoded, should be configurable
511
+ }
512
+
513
+ // Bug to fix
514
+ function findById(id: string): Product {
515
+ // FIXME(BUG:GH-234): Race condition when concurrent updates
516
+ // Needs optimistic locking with version field
517
+ // Ticket: https://github.com/org/repo/issues/234
518
+ }
519
+
520
+ // Temporary workaround
521
+ function authenticate(request): void {
522
+ // HACK: Bypass auth for internal services
523
+ // Temporary until service mesh is implemented
524
+ // Remove in: EPIC:INFRA-E02
525
+ }
526
+ ```
527
+ ```
528
+
529
+ ### Story Template Section
530
+
531
+ Add to each story:
532
+
533
+ ```markdown
534
+ ## TODO Placeholders
535
+
536
+ | Location | TODO | Type | Reference |
537
+ |----------|------|------|-----------|
538
+ | `src/domain/repository/` | Add Update method | TASK | T5 |
539
+ | `src/application/usecase/` | Add caching | STORY | S05-06 |
540
+ | `src/api/` | Add rate limiting | BACKLOG | - |
541
+
542
+ ## Related Future Work
543
+
544
+ | ID | Type | Description | When |
545
+ |----|------|-------------|------|
546
+ | T5 | Task | Update method | This story |
547
+ | S05-06 | Story | Caching layer | Sprint 2 |
548
+ | E08 | Epic | Bulk operations | Sprint 4 |
549
+ ```
550
+
551
+ ---
552
+
553
+ ## Validation Checklist
554
+
555
+ Before completing story:
556
+ - [ ] Story ID is unique
557
+ - [ ] User story follows format
558
+ - [ ] **Acceptance criteria in Given/When/Then** (MANDATORY!)
559
+ - [ ] At least 3 AC (happy path, error, edge case)
560
+ - [ ] Technical tasks are specific
561
+ - [ ] **TODO placeholders defined for future work**
562
+ - [ ] Definition of Done is complete
563
+ - [ ] Estimate is reasonable
564
+ - [ ] Links to epic are correct
565
+
566
+ ## Output
567
+
568
+ Save to: `docs/sprint-artifacts/sprint-[N]/stories/story-[EPIC]-[NN]-[description].md`
569
+
570
+ ## Related Skills
571
+
572
+ - `acceptance-criteria` - For detailed AC writing
573
+ - `epic-writing` - For parent epic structure
574
+ - `jira-integration` - For syncing to Jira