ai-core-framework 0.1.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 (103) hide show
  1. package/.claude-plugin/plugin.json +21 -0
  2. package/.codex-plugin/plugin.json +35 -0
  3. package/.cursor-plugin/plugin.json +22 -0
  4. package/README.md +173 -0
  5. package/bin/ai-core-framework.js +110 -0
  6. package/core/README.md +162 -0
  7. package/core/agents/README.md +32 -0
  8. package/core/agents/business-analyst.md +269 -0
  9. package/core/agents/developer.md +375 -0
  10. package/core/agents/qa-tester.md +477 -0
  11. package/core/agents/scrum-master.md +136 -0
  12. package/core/agents/tech-lead.md +345 -0
  13. package/core/config/backlog.schema.json +38 -0
  14. package/core/config/docs-policy.default.json +37 -0
  15. package/core/config/release.schema.json +120 -0
  16. package/core/config/ticket.schema.json +253 -0
  17. package/core/rules/00-global-rules.md +373 -0
  18. package/core/rules/01-git-workflow.md +388 -0
  19. package/core/rules/02-code-quality.md +77 -0
  20. package/core/rules/03-security.md +78 -0
  21. package/core/rules/04-documentation.md +72 -0
  22. package/core/rules/05-testing-mandatory.md +374 -0
  23. package/core/rules/06-approval-gates.md +388 -0
  24. package/core/rules/07-definition-of-ready.md +112 -0
  25. package/core/rules/08-definition-of-done.md +149 -0
  26. package/core/scripts/ai-core.sh +456 -0
  27. package/core/scripts/generate-views.sh +210 -0
  28. package/core/scripts/install-codex-prompts.sh +127 -0
  29. package/core/scripts/log-user-request.sh +113 -0
  30. package/core/scripts/setup-project.sh +183 -0
  31. package/core/scripts/sync-platforms.sh +322 -0
  32. package/core/scripts/validate-audit-log.sh +73 -0
  33. package/core/scripts/validate-docs.sh +365 -0
  34. package/core/scripts/validate-permissions.sh +132 -0
  35. package/core/scripts/validate-state.sh +611 -0
  36. package/core/scripts/workflow.sh +513 -0
  37. package/core/skills/README.md +21 -0
  38. package/core/skills/ai-core-commands/SKILL.md +86 -0
  39. package/core/skills/brainstorming/SKILL.md +40 -0
  40. package/core/skills/development-implement-task/SKILL.md +308 -0
  41. package/core/skills/executing-ticket/SKILL.md +28 -0
  42. package/core/skills/git-branch-status/SKILL.md +56 -0
  43. package/core/skills/git-cleanup-branches/SKILL.md +57 -0
  44. package/core/skills/git-scan-untracked/SKILL.md +50 -0
  45. package/core/skills/meta-generate-views/SKILL.md +54 -0
  46. package/core/skills/meta-request-log/SKILL.md +61 -0
  47. package/core/skills/meta-sprint-report/SKILL.md +59 -0
  48. package/core/skills/meta-sync-platforms/SKILL.md +53 -0
  49. package/core/skills/meta-ticket-health/SKILL.md +61 -0
  50. package/core/skills/meta-validate-audit-log/SKILL.md +42 -0
  51. package/core/skills/meta-validate-docs/SKILL.md +58 -0
  52. package/core/skills/meta-validate-permissions/SKILL.md +53 -0
  53. package/core/skills/meta-validate-state/SKILL.md +58 -0
  54. package/core/skills/planning-analyze-requirements/SKILL.md +471 -0
  55. package/core/skills/planning-backlog-status/SKILL.md +57 -0
  56. package/core/skills/planning-document-existing-requirements/SKILL.md +246 -0
  57. package/core/skills/planning-estimate-task/SKILL.md +60 -0
  58. package/core/skills/planning-groom-ticket/SKILL.md +442 -0
  59. package/core/skills/planning-mark-ready/SKILL.md +111 -0
  60. package/core/skills/planning-plan-refactor/SKILL.md +66 -0
  61. package/core/skills/planning-plan-sprint/SKILL.md +112 -0
  62. package/core/skills/planning-prioritize-backlog/SKILL.md +62 -0
  63. package/core/skills/planning-write-plan/SKILL.md +68 -0
  64. package/core/skills/project-detect-stack/SKILL.md +71 -0
  65. package/core/skills/project-discover-codebase/SKILL.md +74 -0
  66. package/core/skills/project-setup-project/SKILL.md +113 -0
  67. package/core/skills/qa-bug-status/SKILL.md +52 -0
  68. package/core/skills/qa-report-bug/SKILL.md +518 -0
  69. package/core/skills/qa-smoke-test/SKILL.md +387 -0
  70. package/core/skills/qa-triage-bug/SKILL.md +62 -0
  71. package/core/skills/qa-verify-fix/SKILL.md +446 -0
  72. package/core/skills/release-hotfix/SKILL.md +117 -0
  73. package/core/skills/release-release/SKILL.md +123 -0
  74. package/core/skills/release-rollback/SKILL.md +62 -0
  75. package/core/skills/review-create-pr/SKILL.md +418 -0
  76. package/core/skills/review-merge-pr/SKILL.md +425 -0
  77. package/core/skills/review-techlead-review/SKILL.md +547 -0
  78. package/core/skills/using-ai-core/SKILL.md +72 -0
  79. package/core/skills/verification-before-done/SKILL.md +35 -0
  80. package/core/skills/writing-implementation-plan/SKILL.md +45 -0
  81. package/core/templates/ci/ai-core-governance.yml +112 -0
  82. package/core/templates/ci/node-pnpm.yml +35 -0
  83. package/core/templates/pm/retrospective-template.md +47 -0
  84. package/core/templates/pm/sprint-plan-template.md +45 -0
  85. package/core/templates/pr/pull-request-template.md +247 -0
  86. package/core/templates/project/CODEOWNERS +11 -0
  87. package/core/templates/project/docs-policy.json +3 -0
  88. package/core/templates/project/project-config.yaml +137 -0
  89. package/core/templates/project/project-structure.yaml +76 -0
  90. package/core/templates/qa/bug-report-template.md +371 -0
  91. package/core/templates/qa/test-plan-template.md +57 -0
  92. package/core/templates/release/release-record-template.json +67 -0
  93. package/core/templates/requirements/PRD-template.md +58 -0
  94. package/core/templates/requirements/user-story-template.md +381 -0
  95. package/core/templates/technical/ADR-template.md +46 -0
  96. package/core/templates/technical/refactor-plan-template.md +84 -0
  97. package/core/templates/technical/tech-design-template.md +71 -0
  98. package/core/workflows/bug-lifecycle.md +56 -0
  99. package/core/workflows/feature-lifecycle.md +347 -0
  100. package/core/workflows/hotfix-lifecycle.md +65 -0
  101. package/core/workflows/sprint-lifecycle.md +56 -0
  102. package/lib/install-codex.js +85 -0
  103. package/package.json +36 -0
@@ -0,0 +1,442 @@
1
+ ---
2
+ name: planning-groom-ticket
3
+ description: Use when the user asks to run /groom-ticket, refine a DRAFT ticket, validate acceptance criteria, estimate effort, document risks, or move a ticket to GROOMED/BLOCKED.
4
+ command: /groom-ticket
5
+ display_name: "Groom Ticket"
6
+ version: 1.0.0
7
+ owner_agent: tech-lead
8
+ requires_agents:
9
+ - tech-lead # Main executor
10
+ consults_agents:
11
+ - business-analyst # If AC needs refinement
12
+ - developer # Optional: sanity check on estimate
13
+ model_preference: opus
14
+ args:
15
+ - name: ticket_id
16
+ required: true
17
+ format: "TICKET-XXX"
18
+ description: "Ticket ID to groom"
19
+ preconditions:
20
+ - ticket_exists: "project/tickets/${ticket_id}.json"
21
+ - ticket_status: DRAFT
22
+ - has_user_story: true
23
+ - has_acceptance_criteria: true (min 3 scenarios)
24
+ postconditions:
25
+ - ticket_status: GROOMED | BLOCKED
26
+ - has_estimate: true (1, 2, 3, 5, or 8 points)
27
+ - has_technical_approach: true
28
+ - has_risks_documented: true
29
+ ---
30
+
31
+ # /groom-ticket
32
+
33
+ > Technical grooming: Tech Lead analyzes ticket, estimates, flags risks.
34
+ > Gate: DRAFT → GROOMED transition.
35
+
36
+ ## 🎯 Purpose
37
+
38
+ After BA creates a DRAFT ticket, Tech Lead must:
39
+ 1. Validate feasibility
40
+ 2. Propose technical approach (WHAT + HOW at high level)
41
+ 3. Identify risks, unknowns, dependencies
42
+ 4. Estimate story points
43
+ 5. Decide: transition to GROOMED, send back to BA, or split ticket
44
+
45
+ ## 🚦 Trigger
46
+
47
+ **Manual**:
48
+ ```
49
+ /groom-ticket TICKET-042
50
+ ```
51
+
52
+ **Batch** (multiple):
53
+ ```
54
+ /groom-ticket TICKET-042 TICKET-043 TICKET-044
55
+ ```
56
+
57
+ **Auto**: Config option to auto-trigger after `/analyze-requirements` (default: false, prefer human invocation).
58
+
59
+ ## 📋 Preconditions (STRICT)
60
+
61
+ ### 1. Ticket exists
62
+ ```bash
63
+ test -f "project/tickets/${TICKET_ID}.json" || ABORT "Ticket not found"
64
+ ```
65
+
66
+ ### 2. Ticket status = DRAFT
67
+ Grooming applies only to DRAFT tickets.
68
+ - If GROOMED → suggest `/estimate-task` for re-estimate
69
+ - If READY/IN_PROGRESS/DONE → ABORT
70
+
71
+ ### 3. Has User Story + AC
72
+ Ticket JSON must have:
73
+ - `user_story` object (as_a, i_want, so_that)
74
+ - `acceptance_criteria` array with ≥3 scenarios
75
+
76
+ If missing → ABORT, send back to BA:
77
+ ```
78
+ ❌ TICKET-042 missing required fields.
79
+ → Send to BA: /analyze-requirements (refine)
80
+ ```
81
+
82
+ ### 4. Tech Lead agent enabled
83
+ Check config.
84
+
85
+ ## 🔄 Execution Flow
86
+
87
+ ```
88
+ ┌──────────────────────────────────────────────────────────┐
89
+ │ STEP 1: Load ticket context │
90
+ │ - Read ticket JSON │
91
+ │ - Read user story + AC │
92
+ │ - Note priority, type │
93
+ ├──────────────────────────────────────────────────────────┤
94
+ │ STEP 2: Explore codebase for context │
95
+ │ - Grep related features (by keywords from ticket) │
96
+ │ - Read related ADRs in docs/runtime/adr/ │
97
+ │ - Read related modules/files │
98
+ │ - Look for similar completed tickets (anchor estimate) │
99
+ ├──────────────────────────────────────────────────────────┤
100
+ │ STEP 3: Feasibility assessment │
101
+ │ Verdict: FEASIBLE | FEASIBLE_WITH_CAVEATS | NOT_FEASIBLE│
102
+ │ │
103
+ │ If NOT_FEASIBLE: document reasons, HANDOFF → BA │
104
+ │ for requirement revision. Transition → BLOCKED. │
105
+ ├──────────────────────────────────────────────────────────┤
106
+ │ STEP 4: Propose technical approach │
107
+ │ - 2-3 paragraphs │
108
+ │ - Reference existing patterns │
109
+ │ - Identify key technical decisions │
110
+ │ - Flag decisions needing ADR │
111
+ ├──────────────────────────────────────────────────────────┤
112
+ │ STEP 5: Identify dependencies │
113
+ │ - Internal: other tickets blocking this │
114
+ │ - External: 3rd party services, APIs │
115
+ │ - Data: schema changes, migrations │
116
+ │ - Infrastructure: new services, config │
117
+ ├──────────────────────────────────────────────────────────┤
118
+ │ STEP 6: Risk assessment │
119
+ │ For each risk: │
120
+ │ - Description │
121
+ │ - Probability: LOW | MEDIUM | HIGH │
122
+ │ - Impact: LOW | MEDIUM | HIGH │
123
+ │ - Mitigation strategy │
124
+ │ │
125
+ │ Overall risk level: LOW | MEDIUM | HIGH │
126
+ ├──────────────────────────────────────────────────────────┤
127
+ │ STEP 7: Estimate (Fibonacci) │
128
+ │ Method: │
129
+ │ 1. Find similar past ticket(s) as anchor │
130
+ │ 2. Identify complexity factors │
131
+ │ 3. Add buffer for unknowns │
132
+ │ 4. Pick: 1, 2, 3, 5, or 8 points │
133
+ │ 5. Self-challenge: "$100 bet this fits?" │
134
+ │ │
135
+ │ If result > 8: SUGGEST SPLIT, don't estimate higher │
136
+ ├──────────────────────────────────────────────────────────┤
137
+ │ STEP 8: Split decision (if > 8 points) │
138
+ │ - Propose 2-3 sub-tickets │
139
+ │ - Each with own AC subset │
140
+ │ - Sequenced (dependencies) │
141
+ │ - HANDOFF → BA to execute split │
142
+ ├──────────────────────────────────────────────────────────┤
143
+ │ STEP 9: Open questions for BA │
144
+ │ List any AC ambiguity discovered. │
145
+ │ - If critical: don't transition, wait for BA answer │
146
+ │ - If minor: note in ticket, can clarify later │
147
+ ├──────────────────────────────────────────────────────────┤
148
+ │ STEP 10: Update ticket JSON │
149
+ │ - Add `estimate` object │
150
+ │ - Add `technical_approach` field │
151
+ │ - Add `risks` array │
152
+ │ - Add `dependencies` details │
153
+ │ - Add grooming comment │
154
+ │ - Transition state: DRAFT → GROOMED │
155
+ │ - Update state_history │
156
+ ├──────────────────────────────────────────────────────────┤
157
+ │ STEP 11: ADR check │
158
+ │ If technical approach involves decision needing ADR: │
159
+ │ - Suggest /create-adr │
160
+ │ - Block transition to GROOMED until ADR exists │
161
+ ├──────────────────────────────────────────────────────────┤
162
+ │ STEP 12: Output + HANDOFF │
163
+ │ - Print grooming report │
164
+ │ - HANDOFF → scrum-master for DoR check (/mark-ready) │
165
+ │ - Or HANDOFF → BA if questions unresolved │
166
+ └──────────────────────────────────────────────────────────┘
167
+ ```
168
+
169
+ ## 🔒 Hard Rules
170
+
171
+ ### RULE GR-001: Evidence-based estimate
172
+ **MUST NOT** estimate from gut. Must reference:
173
+ - At least 1 similar past ticket (if exists)
174
+ - Specific complexity factors
175
+ - Unknowns buffer justification
176
+
177
+ ### RULE GR-002: No estimate > 8
178
+ If analysis → > 8 points, **MUST** propose split. Do not estimate 13 or 21 for sprint work.
179
+
180
+ ### RULE GR-003: Risks documented
181
+ **MUST** identify ≥1 risk (unless truly trivial). Empty risks array on non-trivial ticket = incomplete grooming.
182
+
183
+ ### RULE GR-004: No implementation code
184
+ Grooming = WHAT + HOW-at-high-level. **MUST NOT** write code snippets, only pseudo/approach.
185
+
186
+ ### RULE GR-005: ADR trigger check
187
+ If approach requires:
188
+ - New framework/library
189
+ - Database schema major change
190
+ - Breaking API change
191
+ - Security model change
192
+ - New external service integration
193
+
194
+ **MUST** flag need for ADR. Block grooming completion until ADR created (or tracked as separate ticket).
195
+
196
+ ### RULE GR-006: Unclear AC sends back
197
+ If AC genuinely ambiguous (not just Tech Lead preference), **MUST** HANDOFF → BA for refinement. Do not "fill in the gaps" unilaterally.
198
+
199
+ ### RULE GR-007: Dependencies explicit
200
+ **MUST** list all dependencies. If none, explicitly state "No dependencies".
201
+
202
+ ### RULE GR-008: Respect BA's WHAT
203
+ **MUST NOT** change user story or AC. Only technical layer. If disagreement with BA's approach → escalate, don't rewrite.
204
+
205
+ ### RULE GR-009: Schema validation
206
+ After update, **MUST** run `scripts/validate-state.sh`. If fails, retry.
207
+
208
+ ### RULE GR-010: State transition logged
209
+ Every state change logged in `state_history` with:
210
+ - Timestamp
211
+ - From/to states
212
+ - Agent name
213
+ - Reason
214
+
215
+ ## 📥 Input Examples
216
+
217
+ ```
218
+ /groom-ticket TICKET-042
219
+ /groom-ticket TICKET-042 TICKET-043 TICKET-044 # Batch
220
+ /groom-ticket TICKET-042 --skip-ci-check # Option flags
221
+ ```
222
+
223
+ ## 📤 Output Format (Success)
224
+
225
+ ```markdown
226
+ ## 🔍 Grooming Report: TICKET-042
227
+
228
+ **Title**: Password Reset via Email
229
+ **Type**: Feature | **Priority**: MUST
230
+
231
+ ### Technical Feasibility
232
+ ✅ FEASIBLE
233
+
234
+ ### Proposed Technical Approach
235
+
236
+ Implement stateless password reset flow using JWT tokens sent via email:
237
+
238
+ 1. **Endpoint**: `POST /auth/request-reset` accepts email, validates format, generates secure token, sends email. Returns 202 always (prevent email enumeration).
239
+
240
+ 2. **Token**: `crypto.randomBytes(32)` hashed with bcrypt before DB storage. TTL 24h. Table: `password_reset_tokens`.
241
+
242
+ 3. **Email**: Use existing SendGrid integration (ADR-0007). Template: HTML with link `/auth/reset?token=XXX`.
243
+
244
+ 4. **Reset endpoint**: `POST /auth/reset-password` validates token, updates password (bcrypt), invalidates token, notifies user via email.
245
+
246
+ **Reference**: Similar to TICKET-031 (email verification flow).
247
+
248
+ ### Key Technical Decisions
249
+ - ✓ Token storage: DB (not JWT stateless) - need revocability
250
+ - ⚠️ Rate limiting: middleware-level (new pattern) - **ADR needed**
251
+ - ✓ Email service: SendGrid (existing, per ADR-0007)
252
+
253
+ ### Dependencies
254
+ - **Internal**: None blocking
255
+ - **External**: SendGrid API credentials (verified active)
256
+ - **Data**: New table `password_reset_tokens` (migration needed)
257
+ - **Infrastructure**: Redis for rate limiting (already deployed)
258
+
259
+ ### Risks
260
+
261
+ | # | Risk | Probability | Impact | Mitigation |
262
+ |---|------|-------------|--------|------------|
263
+ | 1 | Rate limit bypass via email case variation | MEDIUM | HIGH | Normalize email to lowercase before rate check |
264
+ | 2 | Token prediction if RNG weak | LOW | HIGH | Use `crypto.randomBytes(32)`, not `Math.random` |
265
+ | 3 | Email not delivered (spam filter) | MEDIUM | MEDIUM | Add SPF/DKIM, fallback to resend |
266
+ | 4 | Concurrent resets (race condition) | LOW | LOW | DB unique constraint on active token |
267
+
268
+ **Overall risk level**: MEDIUM (rate limit bypass is realistic attack)
269
+
270
+ ### Estimate
271
+
272
+ **5 story points**
273
+
274
+ Reasoning:
275
+ - Anchor: TICKET-031 (email verification) was 3 points
276
+ - Complexity: password reset has extra flow (2 endpoints vs 1)
277
+ - New: rate limiting middleware (+1 point, includes tests)
278
+ - Unknowns: first SendGrid template integration in this project (+1 buffer)
279
+
280
+ Self-challenge: "Bet $100 this fits 5 points?" → Yes, assuming rate limit approach decided quickly.
281
+
282
+ ### Split Recommendation
283
+
284
+ N/A - within 8 points.
285
+
286
+ ### Open Questions for BA
287
+
288
+ - [ ] Token expiration: Spec says 24h. Confirm OK? (Industry: 15min-24h)
289
+ - [ ] Rate limit: 5 req/hour/email OK? Or per-IP?
290
+ - [ ] Email copy: Use existing template or design new?
291
+ - [ ] Notification on successful reset: email yes/no?
292
+
293
+ ### ADR Required
294
+
295
+ ⚠️ **Yes** - Rate limiting strategy is a new pattern. Suggest:
296
+ - `/create-adr "Rate limiting middleware for auth endpoints"`
297
+
298
+ Block transition to GROOMED until ADR created OR explicit decision to defer.
299
+
300
+ ### Ticket Update
301
+
302
+ **State**: DRAFT → GROOMED ✅ (assuming questions minor)
303
+ **Updated**: `project/tickets/TICKET-042.json`
304
+
305
+ Added fields:
306
+ - `estimate`: `{ story_points: 5, estimated_by: "tech-lead-agent", estimated_at: "..." }`
307
+ - `technical_approach`: (see above)
308
+ - `risks`: (4 risks documented)
309
+ - `dependencies`: (detailed)
310
+
311
+ ### Next Steps
312
+
313
+ 1. **BA**: Answer 4 open questions (can be async)
314
+ 2. **Tech Lead**: Create ADR for rate limiting
315
+ 3. **SM**: Run `/mark-ready TICKET-042` when above done
316
+
317
+ ---
318
+ HANDOFF → business-analyst
319
+ Action needed: Answer 4 open questions above.
320
+ ```
321
+
322
+ ## 📤 Output Format (Send Back to BA)
323
+
324
+ ```markdown
325
+ ## ⚠️ Grooming Blocked: TICKET-042
326
+
327
+ **Reason**: AC scenarios too ambiguous to estimate
328
+
329
+ ### Issues
330
+
331
+ **Scenario 2** ("Edge: email does not exist"):
332
+ - ❓ What does "generic message" mean exactly? Copy text?
333
+ - ❓ Should system log attempt for security monitoring?
334
+ - ❓ Response time: should be same as success (prevent timing attack)?
335
+
336
+ **Scenario 3** ("Error: link expired"):
337
+ - ❓ What's the exact expiration time? AC says "25 hours ago" but doesn't define TTL.
338
+ - ❓ After expiration, allow N more attempts or lock?
339
+
340
+ ### Cannot estimate until these resolved.
341
+
342
+ ### State
343
+
344
+ Ticket remains: DRAFT (not transitioned)
345
+
346
+ ---
347
+ HANDOFF → business-analyst
348
+ Action needed: /analyze-requirements to refine AC, then re-invoke /groom-ticket
349
+ ```
350
+
351
+ ## 📤 Output Format (Suggest Split)
352
+
353
+ ```markdown
354
+ ## ⚠️ Ticket Too Large: TICKET-042
355
+
356
+ **Proposed estimate**: 13 points (exceeds max 8)
357
+
358
+ ### Recommendation: Split into 3 tickets
359
+
360
+ **TICKET-042a**: Password reset core flow
361
+ - Scenarios: 1, 3 (happy path + expired)
362
+ - Estimate: 5 points
363
+ - Deliverable: Working reset WITHOUT rate limiting
364
+
365
+ **TICKET-042b**: Rate limiting for auth endpoints
366
+ - Scenarios: 4 (rate limit scenario)
367
+ - Estimate: 3 points
368
+ - Deliverable: Middleware + applied to reset + login
369
+ - Depends on: 042a
370
+
371
+ **TICKET-042c**: Security hardening
372
+ - Scenarios: 2 (email enumeration prevention)
373
+ - Estimate: 3 points
374
+ - Deliverable: Timing-safe responses, audit logging
375
+ - Depends on: 042a
376
+
377
+ **Total**: 11 points across 3 tickets (vs unmanageable 13 as one)
378
+
379
+ ### Rationale
380
+
381
+ Splitting allows:
382
+ - Parallel work (042a and 042b can overlap after 042a MVP)
383
+ - Smaller PRs = easier review
384
+ - Incremental deployment
385
+ - Clearer testing scope
386
+
387
+ ### Next Step
388
+
389
+ HANDOFF → business-analyst
390
+ Action needed: Review split, approve, then:
391
+ 1. `/split-ticket TICKET-042` (creates 042a/b/c)
392
+ 2. `/groom-ticket TICKET-042a` (estimate sub-tickets)
393
+ 3. `/groom-ticket TICKET-042b`
394
+ 4. `/groom-ticket TICKET-042c`
395
+
396
+ ### Original Ticket
397
+
398
+ State: DRAFT → BLOCKED (pending split)
399
+ ```
400
+
401
+ ## 🚨 Failure Modes
402
+
403
+ | Scenario | Action |
404
+ |----------|--------|
405
+ | Ticket not found | ABORT with clear error |
406
+ | Wrong ticket state | Suggest correct command |
407
+ | Missing user story / AC | HANDOFF → BA, don't groom |
408
+ | AC ambiguous | HANDOFF → BA with specific questions |
409
+ | Ticket too big (>8 points) | Propose split, don't estimate |
410
+ | ADR needed but not created | Block transition, suggest /create-adr |
411
+ | No similar past tickets for anchor | Flag uncertainty, add buffer, proceed |
412
+ | Schema validation fails after update | Retry 3x, then escalate |
413
+
414
+ ## 🔗 Related Commands
415
+
416
+ - **Before**: `/analyze-requirements` (must be done first)
417
+ - **After**: `/mark-ready` (DoR check) or `/create-adr` (if needed)
418
+ - **Alternative**: `/split-ticket` (if too big)
419
+ - **Related**: `/estimate-task` (re-estimate existing GROOMED ticket)
420
+
421
+ ## 📊 Metrics Tracked
422
+
423
+ Log to `project/metrics/groom-ticket.jsonl`:
424
+
425
+ ```json
426
+ {
427
+ "timestamp": "...",
428
+ "ticket_id": "TICKET-042",
429
+ "duration_seconds": 180,
430
+ "estimate": 5,
431
+ "risks_identified": 4,
432
+ "open_questions": 4,
433
+ "feasibility": "FEASIBLE",
434
+ "adr_needed": true,
435
+ "split_suggested": false,
436
+ "transitioned_to": "GROOMED"
437
+ }
438
+ ```
439
+
440
+ ---
441
+ **Last updated**: 2026-04-18
442
+ **Maintainer**: Tech Lead agent
@@ -0,0 +1,111 @@
1
+ ---
2
+ name: planning-mark-ready
3
+ description: Use when the user asks to run /mark-ready, validate a GROOMED ticket against Definition of Ready, resolve readiness gaps, or move a ticket to READY/BLOCKED.
4
+ command: /mark-ready
5
+ display_name: "Mark Ticket Ready"
6
+ version: 1.0.0
7
+ status: READY
8
+ owner_agent: scrum-master
9
+ requires_agents:
10
+ - scrum-master
11
+ consults_agents:
12
+ - business-analyst
13
+ - tech-lead
14
+ model_preference: sonnet
15
+ args:
16
+ - name: ticket_id
17
+ required: true
18
+ format: "TICKET-XXX"
19
+ description: "GROOMED ticket to verify against Definition of Ready"
20
+ preconditions:
21
+ - ticket_exists: "project/tickets/${ticket_id}.json"
22
+ - ticket_status: GROOMED
23
+ - has_estimate: true
24
+ - has_acceptance_criteria: true
25
+ - dependencies_resolved_or_planned: true
26
+ postconditions:
27
+ - ticket_status: READY | GROOMED | BLOCKED
28
+ - dor_checklist_recorded: true
29
+ - state_history_updated: true
30
+ ---
31
+
32
+ # /mark-ready
33
+
34
+ > Scrum Master gate for `GROOMED` → `READY`. Enforces Definition of Ready before sprint work can start.
35
+
36
+ ## 🎯 Purpose
37
+
38
+ Verify that a groomed ticket is truly ready for implementation. This prevents developers from starting work with unclear scope, unresolved dependencies, missing designs, or untestable acceptance criteria.
39
+
40
+ ## 🚦 Trigger
41
+
42
+ Manual only:
43
+
44
+ - `/mark-ready TICKET-042`
45
+ - `/mark-ready TICKET-042 --sprint=SPRINT-007`
46
+
47
+ ## 📋 Preconditions, STRICT
48
+
49
+ 1. Ticket exists in `project/tickets/`.
50
+ 2. Ticket status is exactly `GROOMED`.
51
+ 3. Ticket has user story, acceptance criteria, estimate, technical approach, risks, and dependencies.
52
+ 4. Ticket estimate is one of `1, 2, 3, 5, 8`.
53
+ 5. No unresolved blocking dependency unless a dated unblock plan exists.
54
+ 6. Scrum Master agent is invoking this command.
55
+
56
+ If any precondition fails, ABORT and keep the ticket in `GROOMED` or move to `BLOCKED` only if the blocker is explicit.
57
+
58
+ ## 🔄 Execution Flow
59
+
60
+ 1. Load ticket JSON and `core/rules/07-definition-of-ready.md`.
61
+ 2. Validate INVEST criteria.
62
+ 3. Validate acceptance criteria are testable and include happy path, edge case, and error case.
63
+ 4. Validate estimation evidence from grooming.
64
+ 5. Validate dependencies, design assets, data/API impacts, security/compliance needs, and test strategy.
65
+ 6. Record a `dor_checklist` object with each item as `PASS`, `FAIL`, or `N/A` plus evidence.
66
+ 7. If all mandatory items pass, update status to `READY` and append state history.
67
+ 8. If mandatory items fail, leave status as `GROOMED`, add comments, and HANDOFF to BA or Tech Lead.
68
+ 9. If external dependency blocks readiness, set status to `BLOCKED` with blocker metadata.
69
+ 10. Run `/validate-state` or `bash scripts/validate-state.sh`.
70
+ 11. Output readiness decision and next command.
71
+
72
+ ## 🔒 Hard Rules
73
+
74
+ ### RULE MR-001: No partial readiness
75
+ A ticket either passes DoR or it does not. Do not mark `READY` with pending mandatory items.
76
+
77
+ ### RULE MR-002: Scrum Master owns the gate
78
+ Developer, BA, and Tech Lead may provide evidence, but only Scrum Master marks `READY`.
79
+
80
+ ### RULE MR-003: Evidence required
81
+ Each DoR checklist item MUST reference ticket fields, linked docs, comments, or explicit `N/A` rationale.
82
+
83
+ ### RULE MR-004: No estimate above 8
84
+ If estimate is greater than 8, ABORT and HANDOFF to BA/Tech Lead to split.
85
+
86
+ ### RULE MR-005: Blockers must be explicit
87
+ If readiness fails because of dependency, record `blocked_reason`, `blocked_by`, `blocked_at`, `expected_unblock`, and `escalation`.
88
+
89
+ ### RULE MR-006: State history mandatory
90
+ Every successful transition MUST append state history with `from_state`, `to_state`, `at`, `by_agent`, `by_command`, and `reason`.
91
+
92
+ ## 📤 Outputs
93
+
94
+ Success:
95
+
96
+ - Ticket marked `READY`
97
+ - DoR checklist recorded
98
+ - State history appended
99
+ - Suggested next command: `/plan-sprint` or `/implement-task TICKET-XXX`
100
+
101
+ Failure:
102
+
103
+ - Ticket remains `GROOMED` or moves to `BLOCKED`
104
+ - Failed DoR items listed
105
+ - Specific handoff to BA, Tech Lead, or stakeholder
106
+
107
+ ## 🔗 Related Commands
108
+
109
+ - Before: `/groom-ticket`
110
+ - After: `/plan-sprint`, `/implement-task`
111
+ - Utility: `/validate-state`
@@ -0,0 +1,66 @@
1
+ ---
2
+ name: planning-plan-refactor
3
+ description: Use when the user asks to run /plan-refactor, plan a refactor for a module or architecture area, assess refactor scope, or propose a ticket breakdown for cleanup work.
4
+ command: /plan-refactor
5
+ display_name: "Plan Refactor"
6
+ version: 1.0.0
7
+ status: READY
8
+ owner_agent: tech-lead
9
+ consults_agents:
10
+ - developer
11
+ - qa-tester
12
+ - scrum-master
13
+ model_preference: opus
14
+ args:
15
+ - name: scope
16
+ required: true
17
+ description: "Module, area, or refactor goal"
18
+ preconditions:
19
+ - codebase_context_available: true
20
+ postconditions:
21
+ - refactor_plan_created: true
22
+ - ticket_breakdown_proposed: true
23
+ ---
24
+
25
+ # /plan-refactor
26
+
27
+ > Creates a project-specific refactor plan in `docs/runtime/refactor/` and breaks it into executable tickets.
28
+
29
+ ## 🎯 Purpose
30
+
31
+ Plan large refactors without putting project-specific design into `core/`.
32
+
33
+ ## 🔄 Execution Flow
34
+
35
+ 1. Load `config/project-structure.yaml`.
36
+ 2. Inspect affected code areas and docs.
37
+ 3. Identify current problem, target state, constraints, and risks.
38
+ 4. Determine whether ADR is required.
39
+ 5. Create `docs/runtime/refactor/<slug>-refactor-plan.md` from `core/templates/technical/refactor-plan-template.md`.
40
+ 6. Propose ticket breakdown for `project/tickets/`.
41
+ 7. Propose backlog entries for `project/backlog/backlog.json`.
42
+ 8. Define testing, rollout, and rollback plan.
43
+ 9. HANDOFF to BA for ticket creation or Tech Lead for ADR.
44
+
45
+ ## 🔒 Hard Rules
46
+
47
+ - MUST NOT modify production code during planning.
48
+ - MUST keep plan in `docs/runtime/refactor/`, not `core/`.
49
+ - MUST create characterization test ticket before risky behavior-preserving refactors.
50
+ - MUST require ADR for architectural decisions.
51
+ - MUST split work into tickets of 8 points or less.
52
+
53
+ ## 📤 Outputs
54
+
55
+ - Refactor plan path
56
+ - ADR requirement
57
+ - Ticket breakdown
58
+ - Risk matrix
59
+ - Verification strategy
60
+
61
+ ## 🔗 Related Commands
62
+
63
+ - `/discover-codebase`
64
+ - `/create-adr`
65
+ - `/analyze-requirements`
66
+ - `/groom-ticket`