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,388 @@
1
+ # 🔒 RULE 06: Approval Gates & State Transitions (Strict)
2
+
3
+ > **State machine enforcement**. No skipping states. Every transition has a gate.
4
+ > Enforced by: agent rules + JSON schema + CI validation.
5
+
6
+ ---
7
+
8
+ ## 🎯 Core Principle
9
+
10
+ **A ticket's state reflects reality, not wishes.** Every transition requires passing gate criteria. No "let's move it along" without meeting conditions.
11
+
12
+ This prevents:
13
+ - Shipping unfinished work
14
+ - Missing quality gates
15
+ - Orchestration loops ("how did this get to DONE?")
16
+
17
+ ---
18
+
19
+ ## 🔄 Ticket State Machine
20
+
21
+ ### States
22
+
23
+ ```
24
+ ┌────────┐ /analyze-requirements ┌─────────┐
25
+ │ │ ──────────────────────────────▶ │ DRAFT │
26
+ │ (none) │ └────┬────┘
27
+ │ │ │ /groom-ticket
28
+ └────────┘ ▼
29
+ ┌──────────┐
30
+ │ GROOMED │
31
+ └────┬─────┘
32
+ │ /mark-ready
33
+
34
+ ┌──────────┐
35
+ │ READY │
36
+ └────┬─────┘
37
+ │ /implement-task
38
+
39
+ ┌──────────────┐
40
+ │ IN_PROGRESS │◀──────┐
41
+ └──────┬───────┘ │
42
+ │ /create-pr │
43
+ ▼ │
44
+ ┌──────────────┐ │
45
+ │ IN_REVIEW │ │ /reopen
46
+ └──────┬───────┘ │ (if bugs)
47
+ │ /merge-pr │
48
+ ▼ │
49
+ ┌──────────────┐ │
50
+ │ QA │───────┘
51
+ └──────┬───────┘
52
+ │ /smoke-test PASS
53
+
54
+ ┌──────────────┐
55
+ │ DONE │
56
+ └──────────────┘
57
+
58
+
59
+ Side states (can exit any state into these):
60
+ BLOCKED — external dependency waiting
61
+ CANCELLED — will not be done
62
+ ```
63
+
64
+ ### Allowed transitions matrix
65
+
66
+ | From | To | Gate command | Gate-holder agent |
67
+ |------|----|--------------|--------------------|
68
+ | (none) | DRAFT | `/analyze-requirements` | business-analyst |
69
+ | DRAFT | GROOMED | `/groom-ticket` | tech-lead |
70
+ | DRAFT | BLOCKED | manual | any agent |
71
+ | DRAFT | CANCELLED | manual | business-analyst |
72
+ | GROOMED | READY | `/mark-ready` | scrum-master |
73
+ | GROOMED | DRAFT | manual (if grooming reveals unclear AC) | business-analyst |
74
+ | GROOMED | BLOCKED | manual | tech-lead |
75
+ | READY | IN_PROGRESS | `/implement-task` | developer |
76
+ | READY | BLOCKED | manual | developer |
77
+ | IN_PROGRESS | IN_REVIEW | `/create-pr` | developer |
78
+ | IN_PROGRESS | BLOCKED | manual | developer |
79
+ | IN_REVIEW | IN_PROGRESS | review changes requested | developer |
80
+ | IN_REVIEW | QA | `/merge-pr` | tech-lead |
81
+ | QA | DONE | `/smoke-test` PASS | qa-tester |
82
+ | QA | IN_PROGRESS | `/smoke-test` FAIL | qa-tester |
83
+ | BLOCKED | (previous state) | `/unblock` | any agent |
84
+
85
+ ### Forbidden transitions
86
+
87
+ The following **MUST NEVER** happen:
88
+ - ❌ DRAFT → READY (skip grooming)
89
+ - ❌ DRAFT → IN_PROGRESS (skip grooming + DoR check)
90
+ - ❌ GROOMED → IN_PROGRESS (skip DoR check)
91
+ - ❌ READY → IN_REVIEW (skip implementation)
92
+ - ❌ IN_PROGRESS → QA (skip review + merge)
93
+ - ❌ IN_PROGRESS → DONE (skip everything)
94
+ - ❌ IN_REVIEW → DONE (skip QA)
95
+ - ❌ QA → IN_REVIEW (must go back to IN_PROGRESS then normal flow)
96
+ - ❌ DONE → any state (once done, stays done; new work = new ticket)
97
+
98
+ ---
99
+
100
+ ## 🔒 Rules
101
+
102
+ ### RULE AG-001: State machine enforcement
103
+
104
+ **MUST NOT** transition ticket state by directly editing JSON. **MUST** go through gate command.
105
+
106
+ Why: Commands enforce preconditions. Direct edit bypasses all quality gates.
107
+
108
+ **Enforcement**:
109
+ - Agent rule: agents MUST use commands
110
+ - JSON schema: `state_history` field required, each entry must reference command
111
+ - CI check: scripts/validate-state.sh verifies state_history is complete
112
+
113
+ ### RULE AG-002: Every gate has criteria
114
+
115
+ No command should say "approved, moving to next state" without:
116
+ 1. Criteria list (checklist)
117
+ 2. Verification each criterion
118
+ 3. Documentation in state_history
119
+
120
+ Each transition command (`/groom-ticket`, `/mark-ready`, `/create-pr`, `/merge-pr`, `/smoke-test`) **MUST** have documented preconditions (see individual command files).
121
+
122
+ ### RULE AG-003: Gate-holder agent only
123
+
124
+ Some transitions can only be executed by specific agent:
125
+
126
+ | Transition | Gate-holder | Cannot be done by |
127
+ |------------|-------------|-------------------|
128
+ | DRAFT → GROOMED | tech-lead | Developer, BA, anyone else |
129
+ | GROOMED → READY | scrum-master | Developer (bypassing SM) |
130
+ | IN_REVIEW → QA (merge) | tech-lead | Developer (self-merge forbidden) |
131
+ | QA → DONE | qa-tester | Developer, tech-lead, anyone |
132
+
133
+ This separation prevents conflict of interest:
134
+ - Dev can't approve own code
135
+ - Tech-lead can't skip QA
136
+ - Self-merge forbidden
137
+
138
+ ### RULE AG-004: Gates from checklists
139
+
140
+ Each gate has explicit checklist. Reference:
141
+ - GROOMED gate: see `commands/planning/groom-ticket.md`
142
+ - READY gate (DoR): see `rules/07-definition-of-ready.md`
143
+ - IN_REVIEW gate: see `commands/review/create-pr.md`
144
+ - QA gate: see `commands/review/techlead-review.md` + `commands/review/merge-pr.md`
145
+ - DONE gate (DoD): see `rules/08-definition-of-done.md`
146
+
147
+ ### RULE AG-005: Gate failures are OK
148
+
149
+ If gate fails:
150
+ - **MUST** document reason
151
+ - **MUST** leave ticket in current state (or send back to previous)
152
+ - **MUST NOT** "push through" despite failure
153
+
154
+ Gate failures are a feature, not a bug. They prevent bad code reaching prod.
155
+
156
+ ### RULE AG-006: BLOCKED state explicit
157
+
158
+ Ticket goes BLOCKED when:
159
+ - External dependency not ready (e.g., 3rd party API access)
160
+ - Infrastructure issue (env down)
161
+ - Decision pending (awaiting stakeholder)
162
+ - Resource unavailable (no test data)
163
+
164
+ BLOCKED **MUST** include:
165
+ - What's blocking
166
+ - Who can unblock
167
+ - Expected resolution time
168
+ - Escalation path
169
+
170
+ Example:
171
+ ```json
172
+ {
173
+ "status": "BLOCKED",
174
+ "blocked_reason": "Awaiting SendGrid API credentials from DevOps",
175
+ "blocked_by": "@devops-team",
176
+ "blocked_at": "2026-04-18T10:00:00Z",
177
+ "expected_unblock": "2026-04-19",
178
+ "escalation": "scrum-master"
179
+ }
180
+ ```
181
+
182
+ ### RULE AG-007: No zombie tickets
183
+
184
+ Tickets stuck in a state > X days trigger alerts:
185
+
186
+ | State | Max days (soft) | Max days (hard) | Action |
187
+ |-------|----------------|----------------|--------|
188
+ | DRAFT | 7 | 14 | SM reviews, either groom or cancel |
189
+ | GROOMED | 14 | 30 | SM reviews, either ready or re-groom |
190
+ | READY | Sprint length | 2x sprint | Include in sprint or deprioritize |
191
+ | IN_PROGRESS | 5 | 10 | Dev must report status, may need split |
192
+ | IN_REVIEW | 2 | 5 | Escalate to tech-lead for review |
193
+ | QA | 3 | 7 | Escalate to QA lead |
194
+ | BLOCKED | 7 | 30 | Weekly review, may cancel |
195
+
196
+ Alerts: `/ticket-health` command (scrum-master).
197
+
198
+ ### RULE AG-008: State history required
199
+
200
+ Every ticket **MUST** have complete `state_history` array:
201
+ ```json
202
+ {
203
+ "state_history": [
204
+ {
205
+ "from_state": null,
206
+ "to_state": "DRAFT",
207
+ "at": "2026-04-18T09:00:00Z",
208
+ "by_agent": "business-analyst-agent",
209
+ "by_command": "/analyze-requirements",
210
+ "reason": "Initial creation"
211
+ },
212
+ {
213
+ "from_state": "DRAFT",
214
+ "to_state": "GROOMED",
215
+ "at": "2026-04-18T11:00:00Z",
216
+ "by_agent": "tech-lead-agent",
217
+ "by_command": "/groom-ticket",
218
+ "reason": "Technical feasibility confirmed, estimated 5 points"
219
+ }
220
+ ]
221
+ }
222
+ ```
223
+
224
+ Schema validates this structure (see `config/ticket.schema.json`).
225
+
226
+ ### RULE AG-009: Audit trail preserved
227
+
228
+ State history **MUST NOT** be:
229
+ - Deleted
230
+ - Modified (historical entries immutable)
231
+ - Skipped
232
+
233
+ Even if ticket goes back-and-forth many times, every transition logged.
234
+
235
+ ### RULE AG-010: Emergency override (RARE)
236
+
237
+ In true emergency (system recovering from incident), human may override state machine.
238
+
239
+ **MUST**:
240
+ - Use `/admin-override TICKET-XXX --new-state=X --reason="..."`
241
+ - Command requires `--justification` flag with clear reason
242
+ - Logged in audit trail with `override=true`
243
+ - Post-mortem mandatory afterward
244
+ - Notify stakeholders
245
+
246
+ Agents **NEVER** override. Only humans.
247
+
248
+ ---
249
+
250
+ ## 🔐 Gate Criteria Summary
251
+
252
+ ### Gate 1: DRAFT → GROOMED
253
+ Owner: `/groom-ticket` (tech-lead)
254
+
255
+ - [ ] User story compliant with INVEST
256
+ - [ ] Minimum 3 AC scenarios
257
+ - [ ] Technical feasibility assessed
258
+ - [ ] Risks identified (≥1)
259
+ - [ ] Estimate assigned (Fibonacci, ≤8)
260
+ - [ ] Dependencies listed (or "none")
261
+ - [ ] ADR created (if needed)
262
+
263
+ ### Gate 2: GROOMED → READY
264
+ Owner: `/mark-ready` (scrum-master)
265
+
266
+ Definition of Ready checklist (see rules/07-definition-of-ready.md):
267
+ - [ ] All open questions answered
268
+ - [ ] Mockups/designs finalized (if UI)
269
+ - [ ] Dependencies resolved or acceptable
270
+ - [ ] Test data plan exists
271
+ - [ ] Team has capacity
272
+ - [ ] No blockers
273
+
274
+ ### Gate 3: READY → IN_PROGRESS
275
+ Owner: `/implement-task` (developer)
276
+
277
+ - [ ] Developer assigned
278
+ - [ ] Sprint has capacity (if sprint-scoped)
279
+ - [ ] Branch created following naming convention
280
+ - [ ] No existing PR for this ticket
281
+
282
+ ### Gate 4: IN_PROGRESS → IN_REVIEW
283
+ Owner: `/create-pr` (developer)
284
+
285
+ - [ ] All tests passing
286
+ - [ ] Diff coverage ≥ 80%
287
+ - [ ] Lint passing
288
+ - [ ] Self-review complete
289
+ - [ ] PR template filled
290
+ - [ ] Reviewer assigned
291
+ - [ ] Ticket linked to PR
292
+
293
+ ### Gate 5: IN_REVIEW → QA (merge)
294
+ Owner: `/merge-pr` (tech-lead)
295
+
296
+ - [ ] PR approved by tech-lead
297
+ - [ ] CI green
298
+ - [ ] All comments resolved
299
+ - [ ] No conflicts
300
+ - [ ] Not self-merge
301
+ - [ ] Branch up-to-date with target
302
+
303
+ ### Gate 6: QA → DONE
304
+ Owner: `/smoke-test` (qa-tester)
305
+
306
+ Definition of Done checklist (see rules/08-definition-of-done.md):
307
+ - [ ] All AC scenarios verified in test env
308
+ - [ ] No new regressions
309
+ - [ ] No open SEV-1/SEV-2 bugs in this area
310
+ - [ ] Performance within target
311
+ - [ ] Security spot-check passed
312
+ - [ ] Documentation updated
313
+ - [ ] CHANGELOG entry
314
+
315
+ ---
316
+
317
+ ## 🚨 Violation Consequences
318
+
319
+ | Violation | Consequence |
320
+ |-----------|-------------|
321
+ | Agent edits ticket state directly | Schema validation fails, state_history incomplete |
322
+ | Skip gate (e.g., IN_PROGRESS → DONE) | validate-state.sh CI check fails PR |
323
+ | Non-gate-holder agent transitions | Agent rule violation, human escalation |
324
+ | Override without justification | Post-mortem mandatory |
325
+ | Zombie tickets ignored | Health reports surface weekly |
326
+
327
+ ---
328
+
329
+ ## 🔧 Enforcement Mechanisms
330
+
331
+ ### Layer 1: Agent rules (soft)
332
+ Each agent's rules file references this doc. Agents refuse to bypass.
333
+
334
+ ### Layer 2: JSON schema (medium)
335
+ `config/ticket.schema.json` requires:
336
+ - Valid state value
337
+ - state_history array with required fields
338
+
339
+ ### Layer 3: Validation script (medium)
340
+ `scripts/validate-state.sh` runs:
341
+ - All transitions in state_history are valid (matrix)
342
+ - No gaps (e.g., DRAFT → READY missing GROOMED)
343
+ - Every transition has by_command + by_agent
344
+
345
+ ### Layer 4: CI gate (hard)
346
+ `.github/workflows/validate-state.yml` blocks PRs that:
347
+ - Modify tickets with invalid states
348
+ - Bypass transitions
349
+ - Delete state_history entries
350
+
351
+ ### Layer 5: Human review (backup)
352
+ Scrum-master weekly review of all ticket states.
353
+ Anomalies escalated.
354
+
355
+ ---
356
+
357
+ ## 💡 Common Scenarios
358
+
359
+ ### Scenario: Urgent feature, want to skip grooming
360
+
361
+ **Wrong**: Skip grooming, go DRAFT → IN_PROGRESS.
362
+
363
+ **Right**: Do expedited grooming (15 min), document risks as accepted. Still follows state machine.
364
+
365
+ ### Scenario: Bug fix small, skip review
366
+
367
+ **Wrong**: Dev merges own tiny bug fix.
368
+
369
+ **Right**: Still create PR, still get review. Small fixes break things too.
370
+
371
+ ### Scenario: QA blocked by env, want to mark DONE
372
+
373
+ **Wrong**: "It'll work, mark DONE."
374
+
375
+ **Right**: Ticket stays QA. Fix env first (possibly BLOCKED meanwhile).
376
+
377
+ ### Scenario: Post-mortem reveals ticket should have been split
378
+
379
+ **Wrong**: Delete/modify original ticket.
380
+
381
+ **Right**: Leave history intact. Create retrospective action item. Learn.
382
+
383
+ ---
384
+
385
+ **Version**: 1.0.0
386
+ **Last updated**: 2026-04-18
387
+ **Maintainer**: Scrum Master + Tech Lead
388
+ **Next review**: Every sprint retrospective
@@ -0,0 +1,112 @@
1
+ # 🎯 Definition of Ready (DoR)
2
+
3
+ > Mandatory checklist a ticket **MUST** pass before it transitions to state `READY`.
4
+ > Enforced by: `/mark-ready` command + `scrum-master` agent.
5
+
6
+ ## ⚠️ Enforcement
7
+
8
+ If a ticket does not pass DoR, it **MUST NOT** enter a sprint. There are no exceptions.
9
+
10
+ ---
11
+
12
+ ## ✅ Checklist
13
+
14
+ ### 1. User Story
15
+ - [ ] **INVEST-compliant**:
16
+ - [ ] **I**ndependent, not blocked by another ticket unless that blocker is resolved
17
+ - [ ] **N**egotiable, with scope open to refinement
18
+ - [ ] **V**aluable, with clear business value
19
+ - [ ] **E**stimable, so the team can estimate it
20
+ - [ ] **S**mall, ≤ 8 story points. If > 8, it **MUST** be split
21
+ - [ ] **T**estable, with a clear verification path
22
+ - [ ] Format: `As a <role>, I want <action>, so that <value>`
23
+ - [ ] Business value (`so_that`) is specific and unambiguous
24
+
25
+ ### 2. Acceptance Criteria
26
+ - [ ] At least **3 scenarios** (happy path + edge case + error case)
27
+ - [ ] Format Gherkin: `Given / When / Then`
28
+ - [ ] Every scenario is **testable**, and QA can write a test case directly from it
29
+ - [ ] Non-functional requirements are covered:
30
+ - Performance, if applicable
31
+ - Security, if applicable
32
+ - Accessibility, if user-facing
33
+
34
+ ### 3. Estimation
35
+ - [ ] Story points estimated (1, 2, 3, 5, 8)
36
+ - [ ] Estimate completed by ≥1 Dev + 1 Tech Lead. BA-only estimates are **FORBIDDEN**
37
+ - [ ] Estimate is not > 8 points. If > 8, the ticket **MUST** be split
38
+
39
+ ### 4. Technical Feasibility
40
+ - [ ] Tech Lead has reviewed it
41
+ - [ ] Technical approach is documented briefly in the ticket comment
42
+ - [ ] No critical "unknown unknowns" remain
43
+ - [ ] Spike tickets are created when research is required
44
+
45
+ ### 5. Dependencies
46
+ - [ ] `dependencies.blocked_by` is explicit
47
+ - [ ] Blockers are resolved, or there is a concrete plan to resolve them before the ticket starts
48
+ - [ ] External dependencies (API, external services) have confirmed availability
49
+
50
+ ### 6. Design & Assets
51
+ If the ticket has UI:
52
+ - [ ] Figma / mockup link is in the ticket
53
+ - [ ] Design has stakeholder approval
54
+ - [ ] Responsive behavior defined
55
+ - [ ] Dark mode defined, if the app supports it
56
+
57
+ ### 7. Data & API
58
+ If the ticket has data changes:
59
+ - [ ] Schema changes documented
60
+ - [ ] Migration strategy defined
61
+ - [ ] API contract (OpenAPI spec) available
62
+ - [ ] Breaking change impact assessed
63
+
64
+ ### 8. Security & Compliance
65
+ - [ ] Threat model reviewed, if auth or sensitive data is involved
66
+ - [ ] PII handling complies with policy
67
+ - [ ] Audit logging requirements identified
68
+
69
+ ### 9. Testability
70
+ - [ ] Test strategy defined:
71
+ - Unit test scope
72
+ - Integration test scope
73
+ - E2E test scope, if required
74
+ - [ ] Test data available
75
+ - [ ] Test environments ready
76
+
77
+ ### 10. Out of Scope
78
+ - [ ] Clearly list **WHAT IS NOT INCLUDED** in the ticket
79
+ - [ ] Related work is created as separate tickets
80
+
81
+ ---
82
+
83
+ ## 🔒 DoR Enforcement Rules
84
+
85
+ ### RULE DOR-001: No exception
86
+ **MUST NOT** override DoR "just this once". If the rule blocks delivery, raise it in retrospective.
87
+
88
+ ### RULE DOR-002: Who marks ready
89
+ Only the `scrum-master` agent or explicit human approval may mark a ticket READY.
90
+
91
+ ### RULE DOR-003: Re-check
92
+ If a ticket has been READY for > 2 sprints without being picked up, the team **MUST** re-check DoR because the ticket may be stale.
93
+
94
+ ### RULE DOR-004: Mid-sprint ticket
95
+ A ticket added to an active sprint **MUST** pass DoR and have explicit SM + PM approval.
96
+
97
+ ---
98
+
99
+ ## 💡 Common Failures
100
+
101
+ | Failure | Fix |
102
+ |---------|-----|
103
+ | AC too vague or not testable | BA rewrites using strict Gherkin |
104
+ | Estimate > 8 points | Split into sub-tickets |
105
+ | Dependency unclear | Tech Lead maps the dependency graph |
106
+ | "Figma later" | STOP. Do not accept. Wait for design |
107
+ | Non-functional requirements missing | Add performance/security AC |
108
+
109
+ ---
110
+
111
+ **Version**: 1.0.0
112
+ **Owner**: Scrum Master + Tech Lead
@@ -0,0 +1,149 @@
1
+ # ✅ Definition of Done (DoD)
2
+
3
+ > Mandatory checklist a ticket **MUST** pass before it transitions to state `DONE`.
4
+ > Enforced by: `/smoke-test` + `qa-tester` agent + CI pipeline.
5
+
6
+ ## ⚠️ Enforcement
7
+
8
+ If a ticket does not pass DoD, it **MUST NOT** be closed. "Ship it, we'll fix later" is **FORBIDDEN**.
9
+
10
+ ---
11
+
12
+ ## ✅ Checklist
13
+
14
+ ### 1. Code Complete
15
+ - [ ] All AC scenarios implemented
16
+ - [ ] Code merged into `develop` or the main branch
17
+ - [ ] No TODO/FIXME/HACK remains without a linked follow-up ticket
18
+ - [ ] No commented-out code
19
+ - [ ] Dead code removed
20
+
21
+ ### 2. Testing
22
+ - [ ] Unit tests for all AC scenarios
23
+ - [ ] Integration tests for new API endpoints
24
+ - [ ] **Diff coverage ≥ 80%**
25
+ - [ ] **All tests pass** (unit + integration + E2E, if present)
26
+ - [ ] Edge cases + error cases covered
27
+ - [ ] Test names descriptive (`should_X_when_Y`)
28
+ - [ ] No `.skip`, `xit`, or `@Disabled` without ticket justification
29
+
30
+ ### 3. Code Review
31
+ - [ ] PR approved by **≥1 Tech Lead**
32
+ - [ ] All review comments resolved
33
+ - [ ] **No self-approval** (G-008b)
34
+ - [ ] PR template fully completed
35
+
36
+ ### 4. Quality Gates
37
+ - [ ] **Linter pass** (0 errors)
38
+ - [ ] **Type check pass**, if the language is typed
39
+ - [ ] **CI pipeline green**
40
+ - [ ] **Security scan pass** (SAST, dependency check)
41
+ - [ ] **No new critical/high vulnerabilities**
42
+ - [ ] Performance regression check, if critical path
43
+
44
+ ### 5. Documentation
45
+ - [ ] **README** updated, if setup changed
46
+ - [ ] **API docs** updated, if endpoints are new or changed
47
+ - [ ] **CHANGELOG** entry added
48
+ - [ ] **ADR** created, if there is an architecture decision
49
+ - [ ] Inline code comments for complex logic
50
+ - [ ] Deprecation notices, if any
51
+
52
+ ### 6. QA Verification
53
+ - [ ] Smoke test passes on staging
54
+ - [ ] Every AC scenario verified manually or through automation
55
+ - [ ] Regression test passes, with no broken existing features
56
+ - [ ] Cross-browser check, if frontend and applicable
57
+ - [ ] Mobile responsive check, if applicable
58
+ - [ ] Accessibility check, WCAG AA for user-facing functionality
59
+
60
+ ### 7. Non-Functional Requirements
61
+ - [ ] **Performance**: Response time within SLA
62
+ - [ ] **Security**: OWASP Top 10 checklist pass
63
+ - [ ] **Observability**: Logs, metrics, traces added
64
+ - [ ] **Error handling**: Graceful degradation
65
+ - [ ] **Internationalization**: i18n keys, if multi-language
66
+
67
+ ### 8. Deployment
68
+ - [ ] Deployed to staging environment
69
+ - [ ] Staging smoke test pass
70
+ - [ ] Feature flag configured, if the project uses feature flags
71
+ - [ ] Rollback plan documented
72
+ - [ ] Database migration tested, if any
73
+
74
+ ### 9. Business Verification
75
+ - [ ] Product Owner / Stakeholder approval, if visible feature
76
+ - [ ] Analytics / tracking events implemented
77
+ - [ ] Help docs updated, if user-facing
78
+
79
+ ### 10. Ticket Hygiene
80
+ - [ ] Ticket state updated in `project/tickets/`
81
+ - [ ] `completed_at` timestamp set
82
+ - [ ] PR URL linked
83
+ - [ ] Release version tagged after release
84
+ - [ ] Related tickets updated (dependencies)
85
+
86
+ ---
87
+
88
+ ## 🔒 DoD Enforcement Rules
89
+
90
+ ### RULE DOD-001: No exception
91
+ There are no "temporary" skips. If the sprint is ending and the ticket has not passed DoD, the ticket rolls over. It **MUST NOT** be closed.
92
+
93
+ ### RULE DOD-002: Automated gates first
94
+ Automatable items (tests, lint, coverage, CI) **MUST** pass before human DoD review.
95
+
96
+ ### RULE DOD-003: QA has veto
97
+ The QA agent **MUST** reject a "Done" claim if it finds an issue. State returns to `IN_PROGRESS`.
98
+
99
+ ### RULE DOD-004: Ship debt tracking
100
+ If any DoD item is skipped with justification, the team **MUST** create a tech-debt ticket.
101
+
102
+ ### RULE DOD-005: No self-sign-off
103
+ Developers **MUST NOT** mark their own tickets DONE. QA or Tech Lead verification is required.
104
+
105
+ ### RULE DOD-006: Machine-readable DoD required
106
+ Ticket status `DONE` MUST include `dod_checklist` fields set to true for code, tests, docs, review, QA, release notes, and security. `completed_at`, `pr_url`, and `qa_evidence.path` are required and validated by `scripts/validate-state.sh` and `scripts/validate-docs.sh`.
107
+
108
+ ---
109
+
110
+ ## 🎯 DoD Tiers (by ticket type)
111
+
112
+ ### Feature / Enhancement
113
+ Apply the **full checklist** (1-10).
114
+
115
+ ### Bug Fix
116
+ Apply the full checklist plus extras:
117
+ - [ ] Root cause analysis documented
118
+ - [ ] Regression test for this specific bug
119
+ - [ ] Similar bugs pattern check
120
+
121
+ ### Tech Debt / Refactor
122
+ Apply 1-7. Skip 8-9 only if there is no user-facing change:
123
+ - [ ] Performance benchmark (before/after)
124
+ - [ ] Behavior preservation verified (tests still pass)
125
+
126
+ ### Hotfix
127
+ **Emergency path** (relaxed):
128
+ - [ ] Minimum: Fix works + basic test + Tech Lead review + deployed
129
+ - [ ] **Follow-up ticket** to complete full DoD in the next sprint (MANDATORY)
130
+
131
+ ### Spike
132
+ - [ ] Research documented in ADR or design doc
133
+ - [ ] Recommendation clear
134
+ - [ ] Follow-up tickets created
135
+
136
+ ---
137
+
138
+ ## 📊 DoD Metrics
139
+
140
+ Track in retrospective:
141
+ - % tickets pass DoD first try
142
+ - Which DoD items commonly fail
143
+ - Time wasted on rework
144
+
145
+ ---
146
+
147
+ **Version**: 1.0.0
148
+ **Owner**: Scrum Master + QA Lead
149
+ **Review cadence**: End of each sprint