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,62 @@
1
+ ---
2
+ name: release-rollback
3
+ description: Use when the user asks to run /rollback, plan or execute a release rollback, validate rollback prerequisites, record rollback evidence, or verify rollback completion.
4
+ command: /rollback
5
+ display_name: "Rollback Release"
6
+ version: 1.0.0
7
+ status: READY
8
+ owner_agent: scrum-master
9
+ consults_agents:
10
+ - tech-lead
11
+ - qa-tester
12
+ model_preference: opus
13
+ args:
14
+ - name: version
15
+ required: true
16
+ format: "vMAJOR.MINOR.PATCH"
17
+ preconditions:
18
+ - release_exists: true
19
+ - rollback_plan_exists: true
20
+ postconditions:
21
+ - rollback_record_created: true
22
+ - verification_completed: true
23
+ ---
24
+
25
+ # /rollback
26
+
27
+ > Coordinates reverting a release when production health is unacceptable.
28
+
29
+ ## 🎯 Purpose
30
+
31
+ Restore service safely, preserve audit trail, and start follow-up remediation.
32
+
33
+ ## 🔄 Execution Flow
34
+
35
+ 1. Confirm rollback trigger and incident severity.
36
+ 2. Load release record and rollback plan.
37
+ 3. Get Tech Lead confirmation for technical risk.
38
+ 4. Notify stakeholders and freeze related deploys.
39
+ 5. Execute documented rollback steps.
40
+ 6. Verify service health and core flows.
41
+ 7. Record rollback result in `project/releases/`.
42
+ 8. Create follow-up bug/ticket and incident notes.
43
+
44
+ ## 🔒 Hard Rules
45
+
46
+ - MUST NOT rollback without known target version or backup plan.
47
+ - MUST verify after rollback.
48
+ - MUST document data migration impact.
49
+ - MUST create follow-up RCA work.
50
+
51
+ ## 📤 Outputs
52
+
53
+ - Rolled back version
54
+ - Current production version
55
+ - Verification result
56
+ - Incident/follow-up links
57
+
58
+ ## 🔗 Related Commands
59
+
60
+ - `/release`
61
+ - `/hotfix`
62
+ - `/report-bug`
@@ -0,0 +1,418 @@
1
+ ---
2
+ name: review-create-pr
3
+ description: Use when the user asks to run /create-pr, prepare or open a pull request, perform pre-PR checks, link a ticket to a PR, or move a ticket into review.
4
+ command: /create-pr
5
+ display_name: "Create Pull Request"
6
+ version: 1.0.0
7
+ owner_agent: developer
8
+ model_preference: sonnet
9
+ args:
10
+ - name: draft
11
+ required: false
12
+ type: boolean
13
+ default: false
14
+ description: "Create as draft PR (not ready for review)"
15
+ - name: skip-self-review
16
+ required: false
17
+ type: boolean
18
+ default: false
19
+ description: "Skip self-review step (not recommended)"
20
+ preconditions:
21
+ - on_feature_branch: true
22
+ - ticket_exists_for_branch: true
23
+ - ticket_status: IN_PROGRESS
24
+ - all_tests_passing: true
25
+ - diff_coverage_met: "≥80%"
26
+ - lint_passing: true
27
+ - no_uncommitted_changes: true
28
+ - branch_pushed: true
29
+ postconditions:
30
+ - pr_created: true
31
+ - ticket_status: IN_REVIEW
32
+ - pr_linked_to_ticket: true
33
+ - reviewer_assigned: "tech-lead"
34
+ ---
35
+
36
+ # /create-pr
37
+
38
+ > Create a Pull Request with quality gates, template filled, reviewer assigned.
39
+ > **Gate**: IN_PROGRESS → IN_REVIEW transition.
40
+
41
+ ## 🎯 Purpose
42
+
43
+ Developer has finished implementing the ticket and must create a PR. This command:
44
+ 1. Run all quality gates (tests, coverage, lint)
45
+ 2. Do self-review
46
+ 3. Generate PR title + description from template
47
+ 4. Push branch if not already pushed
48
+ 5. Create PR via GitHub CLI or web
49
+ 6. Assign reviewer (Tech Lead)
50
+ 7. Update ticket state → IN_REVIEW
51
+
52
+ ## 🚦 Trigger
53
+
54
+ **Manual** (primary):
55
+ ```
56
+ /create-pr
57
+ ```
58
+
59
+ **With options**:
60
+ ```
61
+ /create-pr --draft # Draft PR (WIP)
62
+ /create-pr --skip-self-review # Skip self-review (only with justification)
63
+ ```
64
+
65
+ **Auto**: No. Developer MUST explicitly invoke it after self-review.
66
+
67
+ ## 📋 Preconditions (STRICT)
68
+
69
+ ### 1. On feature branch
70
+ ```bash
71
+ current_branch=$(git rev-parse --abbrev-ref HEAD)
72
+ # Must match: ^(feature|bugfix|hotfix|chore|refactor)/TICKET-\d+-[a-z0-9-]+$
73
+ if ! echo "$current_branch" | grep -qE '^(feature|bugfix|hotfix|chore|refactor)/TICKET-[0-9]+-[a-z0-9-]+$'; then
74
+ ABORT "Not on valid feature branch. Current: $current_branch"
75
+ fi
76
+ ```
77
+
78
+ ### 2. Ticket exists for branch
79
+ Extract TICKET-XXX from branch name, verify:
80
+ ```bash
81
+ TICKET_ID=$(echo "$current_branch" | grep -oE 'TICKET-[0-9]+')
82
+ test -f "project/tickets/${TICKET_ID}.json" || ABORT
83
+ ```
84
+
85
+ ### 3. Ticket in IN_PROGRESS
86
+ Read ticket.status. Must be `IN_PROGRESS`. Else:
87
+ - DRAFT/GROOMED/READY → ABORT, use `/implement-task` first
88
+ - IN_REVIEW → ABORT, PR likely already exists
89
+ - DONE → ABORT
90
+
91
+ ### 4. No uncommitted changes
92
+ ```bash
93
+ git status --porcelain | grep -q . && ABORT "Uncommitted changes. Commit or stash first."
94
+ ```
95
+
96
+ ### 5. All tests passing
97
+ ```bash
98
+ # Run full test suite
99
+ pnpm test || ABORT "Tests failing. Fix before PR."
100
+ ```
101
+
102
+ ### 6. Diff coverage ≥ 80%
103
+ ```bash
104
+ # Check coverage on diff vs develop
105
+ pnpm run coverage:diff --threshold=80 || ABORT "Diff coverage < 80%"
106
+ ```
107
+
108
+ ### 7. Linter passing
109
+ ```bash
110
+ pnpm run lint || ABORT "Lint errors. Fix before PR."
111
+ ```
112
+
113
+ ### 8. Branch pushed to remote
114
+ ```bash
115
+ git fetch origin
116
+ if ! git branch -r --contains HEAD | grep -q "origin/$current_branch"; then
117
+ # Push if not
118
+ git push -u origin "$current_branch" || ABORT "Failed to push"
119
+ fi
120
+ ```
121
+
122
+ ### 9. Branch up-to-date with develop
123
+ ```bash
124
+ git fetch origin develop
125
+ behind=$(git rev-list --count HEAD..origin/develop)
126
+ if [ "$behind" -gt 0 ]; then
127
+ WARN "Branch $behind commits behind develop. Consider rebasing."
128
+ # Not fatal, but notify
129
+ fi
130
+ ```
131
+
132
+ ## 🔄 Execution Flow
133
+
134
+ ```
135
+ ┌──────────────────────────────────────────────────────────┐
136
+ │ STEP 1: Validate preconditions (above) │
137
+ │ Any fail → ABORT with specific error │
138
+ ├──────────────────────────────────────────────────────────┤
139
+ │ STEP 2: Load context │
140
+ │ - Ticket JSON │
141
+ │ - AC scenarios │
142
+ │ - Grooming notes (technical approach) │
143
+ │ - Commit history since branch creation │
144
+ │ - Diff stats (files changed, +/- lines) │
145
+ ├──────────────────────────────────────────────────────────┤
146
+ │ STEP 3: Self-review (unless --skip-self-review) │
147
+ │ │
148
+ │ 3.1 Read own diff top-to-bottom │
149
+ │ 3.2 Checklist: │
150
+ │ - [ ] Every AC scenario has test │
151
+ │ - [ ] No TODO/FIXME without ticket │
152
+ │ - [ ] No console.log / print debug │
153
+ │ - [ ] No commented-out code │
154
+ │ - [ ] No hardcoded secrets │
155
+ │ - [ ] No unrelated changes (scope creep) │
156
+ │ - [ ] Commits follow conventional format │
157
+ │ - [ ] Docs updated if API changed │
158
+ │ │
159
+ │ 3.3 If issues found: FIX, commit, re-run │
160
+ ├──────────────────────────────────────────────────────────┤
161
+ │ STEP 4: Generate PR title │
162
+ │ Format: "<type>(TICKET-XXX): <short description>" │
163
+ │ Max: 72 chars │
164
+ │ Examples: │
165
+ │ feat(TICKET-042): add password reset via email │
166
+ │ fix(TICKET-089): handle + character in email login │
167
+ ├──────────────────────────────────────────────────────────┤
168
+ │ STEP 5: Generate PR description │
169
+ │ Use template: templates/pr/pull-request-template.md │
170
+ │ Auto-fill sections: │
171
+ │ - Summary (from ticket) │
172
+ │ - Changes (from diff) │
173
+ │ - How to test (from AC) │
174
+ │ - Checklist (self-review) │
175
+ │ - Screenshots (prompt if UI changes detected) │
176
+ ├──────────────────────────────────────────────────────────┤
177
+ │ STEP 6: Determine reviewers │
178
+ │ - Primary: tech-lead (mandatory) │
179
+ │ - Secondary: suggest from codeowners (if file) │
180
+ │ - Label: "needs-review" │
181
+ ├──────────────────────────────────────────────────────────┤
182
+ │ STEP 7: Create PR via GitHub CLI │
183
+ │ gh pr create \ │
184
+ │ --base develop \ │
185
+ │ --head <current_branch> \ │
186
+ │ --title "<title>" \ │
187
+ │ --body-file <generated-body.md> \ │
188
+ │ --reviewer <tech-lead> \ │
189
+ │ --label "TICKET-XXX" \ │
190
+ │ [--draft if --draft flag] │
191
+ │ │
192
+ │ Capture PR URL from output. │
193
+ ├──────────────────────────────────────────────────────────┤
194
+ │ STEP 8: Update ticket │
195
+ │ - state: IN_PROGRESS → IN_REVIEW │
196
+ │ - pr_url: <captured URL> │
197
+ │ - state_history append │
198
+ │ - updated_at timestamp │
199
+ ├──────────────────────────────────────────────────────────┤
200
+ │ STEP 9: Notify │
201
+ │ - Output PR URL │
202
+ │ - Suggest reviewer action: /techlead-review PR-XXX │
203
+ │ - (Optional) Slack notification via webhook │
204
+ ├──────────────────────────────────────────────────────────┤
205
+ │ STEP 10: Log metrics │
206
+ │ project/metrics/create-pr.jsonl │
207
+ └──────────────────────────────────────────────────────────┘
208
+ ```
209
+
210
+ ## 🔒 Hard Rules
211
+
212
+ ### RULE PR-001: All preconditions must pass
213
+ **MUST NOT** bypass preconditions with flags like `--skip-tests`. Exception: `--draft` allowed with failing tests (WIP), but NOT allowed for ready PRs.
214
+
215
+ ### RULE PR-002: Ticket MUST be IN_PROGRESS
216
+ PR creation transitions ticket to IN_REVIEW. If ticket not IN_PROGRESS, something wrong with workflow.
217
+
218
+ ### RULE PR-003: Self-review mandatory by default
219
+ `--skip-self-review` requires justification in PR body:
220
+ ```
221
+ > ⚠️ Self-review skipped: [reason]
222
+ ```
223
+ Tech Lead can reject PR if justification weak.
224
+
225
+ ### RULE PR-004: Branch must match ticket
226
+ Regex check: branch name contains `TICKET-XXX` matching ticket file. No mismatch allowed.
227
+
228
+ ### RULE PR-005: PR against develop (not main)
229
+ Base branch **MUST** be `develop`. Exception: hotfix branches target `main`.
230
+
231
+ ### RULE PR-006: One PR per ticket
232
+ If PR already exists for this ticket → ABORT. Don't create duplicate.
233
+
234
+ Check:
235
+ ```bash
236
+ existing_pr=$(gh pr list --head "$current_branch" --json number --jq '.[0].number')
237
+ [ -n "$existing_pr" ] && ABORT "PR #$existing_pr already exists"
238
+ ```
239
+
240
+ ### RULE PR-007: Reviewer auto-assigned
241
+ **MUST** assign tech-lead as reviewer. No PR without reviewer (dead PR).
242
+
243
+ If tech-lead = PR author (self), escalate:
244
+ - Suggest another tech-lead in team
245
+ - Or escalate human
246
+
247
+ ### RULE PR-008: Labels required
248
+ **MUST** apply labels:
249
+ - `TICKET-XXX` (for tracking)
250
+ - `needs-review` (initial state)
251
+ - Type label: `feature`, `bugfix`, `hotfix`, `refactor`, `chore`
252
+ - Size label: `size/S` (< 100 lines), `size/M` (100-500), `size/L` (500+)
253
+
254
+ ### RULE PR-009: Description from template
255
+ **MUST** use PR template. No freestyle descriptions.
256
+
257
+ ### RULE PR-010: Link ticket bidirectionally
258
+ - PR description references ticket ID
259
+ - Ticket JSON has `pr_url` field
260
+ - Commit body has `Closes: TICKET-XXX`
261
+
262
+ ## 📥 Input Examples
263
+
264
+ ```
265
+ /create-pr # Standard PR, ready for review
266
+ /create-pr --draft # WIP PR (CI runs, but not ready for review)
267
+ /create-pr --skip-self-review # Risky, requires justification
268
+ ```
269
+
270
+ ## 📤 Output Format (Success)
271
+
272
+ ```markdown
273
+ ## ✅ PR Created: #123
274
+
275
+ **Title**: feat(TICKET-042): add password reset via email
276
+ **URL**: https://github.com/org/repo/pull/123
277
+ **Branch**: feature/TICKET-042-password-reset → develop
278
+ **Reviewer**: @tech-lead
279
+
280
+ ### Quality Gates
281
+ | Check | Status |
282
+ |-------|--------|
283
+ | Tests | ✅ 47 passed, 0 failed |
284
+ | Coverage (diff) | ✅ 87% (target: 80%) |
285
+ | Coverage (overall) | ✅ 73% (+1.2%) |
286
+ | Lint | ✅ 0 errors, 2 warnings |
287
+ | Type check | ✅ Pass |
288
+ | Security scan | ✅ No high-severity issues |
289
+
290
+ ### Self-Review Checklist
291
+ - [x] Every AC scenario has test (4/4 scenarios)
292
+ - [x] No TODO/FIXME without ticket
293
+ - [x] No debug statements
294
+ - [x] No commented-out code
295
+ - [x] No hardcoded secrets
296
+ - [x] Scope matches ticket (no creep)
297
+ - [x] Commits conventional format
298
+ - [x] API docs updated
299
+
300
+ ### PR Stats
301
+ - **Files changed**: 12 (+8, ~4)
302
+ - **Lines**: +234, -45
303
+ - **Commits**: 7 (atomic, TDD pattern)
304
+
305
+ ### Commits (verified TDD flow)
306
+ 1. `test(TICKET-042): add failing tests for happy path`
307
+ 2. `feat(TICKET-042): implement password reset endpoint`
308
+ 3. `test(TICKET-042): add edge case tests for invalid email`
309
+ 4. `feat(TICKET-042): handle invalid email cases`
310
+ 5. `test(TICKET-042): add rate limiting tests`
311
+ 6. `feat(TICKET-042): add rate limiting middleware`
312
+ 7. `docs(TICKET-042): update API docs`
313
+
314
+ ### Ticket Updated
315
+ - **State**: IN_PROGRESS → IN_REVIEW ✅
316
+ - **PR URL**: saved to ticket
317
+
318
+ ### Next Steps
319
+ 1. **Tech Lead**: `/techlead-review PR-123`
320
+ 2. **Developer**: Respond to review comments promptly
321
+ 3. **After approval**: `/merge-pr PR-123`
322
+
323
+ ---
324
+ HANDOFF → tech-lead
325
+ PR ready for review.
326
+ ```
327
+
328
+ ## 📤 Output Format (Failure)
329
+
330
+ ```markdown
331
+ ## ❌ Cannot create PR
332
+
333
+ **Reason**: Diff coverage below threshold
334
+
335
+ ### Details
336
+ - Current diff coverage: **62%**
337
+ - Required: **80%**
338
+ - Uncovered lines: 45
339
+
340
+ ### Uncovered files:
341
+ - `src/auth/reset-password.ts:23-45` (error handling branch)
342
+ - `src/auth/reset-password.ts:78-82` (email validation)
343
+ - `src/email/send.ts:12-18` (retry logic)
344
+
345
+ ### Action Required
346
+ Add tests covering the uncovered branches. Then retry:
347
+ ```
348
+ /write-unit-tests # for guidance
349
+ # Manually add tests for the above files
350
+ pnpm test --coverage # verify
351
+ /create-pr # retry
352
+ ```
353
+
354
+ ### Ticket State
355
+ Unchanged: IN_PROGRESS (no transition).
356
+ ```
357
+
358
+ ## 📤 Output Format (Duplicate PR)
359
+
360
+ ```markdown
361
+ ## ⚠️ PR Already Exists
362
+
363
+ An open PR exists for this branch:
364
+ - **PR #123**: https://github.com/org/repo/pull/123
365
+ - **Status**: Open, awaiting review
366
+
367
+ ### Options
368
+ 1. Update existing PR: `git push` (current commits will update it)
369
+ 2. Close old PR and create new: `gh pr close 123 && /create-pr`
370
+ 3. Check PR state: `gh pr view 123`
371
+
372
+ ### No action taken.
373
+ ```
374
+
375
+ ## 🚨 Failure Modes
376
+
377
+ | Precondition | Error | Recovery |
378
+ |--------------|-------|----------|
379
+ | Wrong branch | Not on feature/TICKET-* | Checkout correct branch |
380
+ | No ticket | TICKET not found | `/analyze-requirements` first |
381
+ | Wrong status | Ticket not IN_PROGRESS | Check /implement-task workflow |
382
+ | Tests failing | Test count failed | Fix tests, commit, retry |
383
+ | Low coverage | Diff coverage < 80% | Add tests |
384
+ | Lint errors | Lint failed | Fix lint, commit, retry |
385
+ | Uncommitted | Dirty working dir | Commit or stash |
386
+ | Not pushed | Branch not on remote | Auto-push |
387
+ | Behind develop | Branch stale | WARN, offer rebase |
388
+ | Existing PR | Duplicate | Use existing or close |
389
+
390
+ ## 🔗 Related Commands
391
+
392
+ - **Before**: `/implement-task` (must complete implementation)
393
+ - **After**: `/techlead-review` (reviewer's next step)
394
+ - **If blocked**: `/check-coverage`, `/run-tests`, `/write-unit-tests`
395
+ - **Emergency close**: `gh pr close <num>` (manual)
396
+
397
+ ## 📊 Metrics Tracked
398
+
399
+ ```json
400
+ {
401
+ "timestamp": "2026-04-18T14:30:00Z",
402
+ "ticket_id": "TICKET-042",
403
+ "pr_number": 123,
404
+ "files_changed": 12,
405
+ "lines_added": 234,
406
+ "lines_removed": 45,
407
+ "commits_count": 7,
408
+ "coverage_diff": 87.0,
409
+ "lint_warnings": 2,
410
+ "tdd_compliant": true,
411
+ "self_review_skipped": false,
412
+ "duration_seconds": 38
413
+ }
414
+ ```
415
+
416
+ ---
417
+ **Last updated**: 2026-04-18
418
+ **Maintainer**: Developer agent