moicle 2.0.0 → 2.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.
@@ -33,16 +33,32 @@ Before responding:
33
33
  2. Stack-specific doc for the affected service
34
34
  3. Runbook for the affected component (`docs/runbooks/` or wiki)
35
35
 
36
- ---
36
+ ## Severity
37
+
38
+ Use `~/.claude/architecture/_shared/severity-levels.md` (incident severity table — P1-P4 with response times).
39
+
40
+ ### Ambiguous severity (P2 vs P3)?
41
+ Decide UP if any apply:
42
+ - Revenue impact (checkout, payment, signups blocked)
43
+ - Security risk (auth, data exposure)
44
+ - Data integrity at risk (writes might be lost / corrupted)
45
+ - Regulatory / SLA breach
46
+ - Pattern matches a prior P2+ (e.g., same DB instance flaky again)
47
+
48
+ Otherwise: P3.
37
49
 
38
- ## Severity Levels
50
+ ### Escalation criteria
39
51
 
40
- | Level | Description | Response Time | Examples |
41
- |-------|-------------|---------------|----------|
42
- | **P1** | Critical — complete outage / data loss / security breach | <15 min | Site down, DB corrupted, secret leak |
43
- | **P2** | High — major degradation, 50%+ users affected | <1 h | Login broken, payment failing |
44
- | **P3** | Medium partial degradation, <50% users | <4 h | One feature broken |
45
- | **P4** | Low minor issue, no significant impact | <24 h | UI glitch |
52
+ Page or escalate when:
53
+
54
+ | Trigger | Action |
55
+ |---------|--------|
56
+ | P1 on customer-facing system | Page CTO / engineering lead within 15 min |
57
+ | P1 + data loss / breach | Page legal + security lead immediately |
58
+ | P2 lasting >2 hours without mitigation | Page engineering lead, consider promoting to P1 |
59
+ | P1/P2 spanning >1 shift | Schedule formal handoff (see Phase 1.5) |
60
+ | Customer-facing comms required | Notify support + comms lead within 30 min |
61
+ | Public disclosure may be needed (security) | Notify legal + comms + leadership |
46
62
 
47
63
  ---
48
64
 
@@ -52,14 +68,15 @@ Before responding:
52
68
 
53
69
  ### Actions
54
70
  1. Capture: what, when, who's affected, error messages, recent deploys
55
- 2. Assign severity (P1–P4)
71
+ 2. Assign severity (P1–P4) — use ambiguous-severity rule above
56
72
  3. Open incident channel (`#incident-{date}-{short-name}`)
57
73
  4. Assign roles:
58
74
  - **Incident Commander (IC)** — coordinates, makes decisions
59
75
  - **Tech Lead** — investigates / fixes
60
76
  - **Comms Lead** — updates stakeholders
61
77
  5. Page on-call for affected service
62
- 6. Send first status update (template below)
78
+ 6. Check escalation criteria above page additional people if any trigger
79
+ 7. Send first status update (template below)
63
80
 
64
81
  ### First update template
65
82
  ```
@@ -71,13 +88,60 @@ Next update: {time}
71
88
  ```
72
89
 
73
90
  ### Gate
74
- - [ ] Severity assigned
91
+ - [ ] Severity assigned (and escalation triggered if applicable)
75
92
  - [ ] IC + Tech Lead identified
76
93
  - [ ] Incident channel open
77
94
  - [ ] First status sent
78
95
 
79
96
  ---
80
97
 
98
+ ## Phase 1.5: HANDOFF (only if shift change during incident)
99
+
100
+ For incidents spanning >1 shift, do a formal handoff. Skip if same team handles end-to-end.
101
+
102
+ ### Handoff template
103
+ ```markdown
104
+ ## Incident Handoff: {service} {date}
105
+
106
+ **From:** {outgoing IC} → **To:** {incoming IC}
107
+ **Channel:** #incident-{slug}
108
+ **Severity:** {current}
109
+
110
+ ### Current state
111
+ - Impact: {what users see right now}
112
+ - Mitigations applied: {list with timestamps}
113
+ - What worked: {list}
114
+ - What didn't: {list}
115
+
116
+ ### Active investigations
117
+ - {open question + who was looking into it}
118
+
119
+ ### Active hypotheses
120
+ - {hypothesis + evidence for/against}
121
+
122
+ ### Open decisions
123
+ - {decision needed + options + recommended choice}
124
+
125
+ ### Next steps
126
+ - {action + owner + ETA}
127
+
128
+ ### People paged / informed
129
+ - {list with role + when paged}
130
+
131
+ ### Pending comms
132
+ - {next update due at HH:MM}
133
+ - {customer-facing status due}
134
+ ```
135
+
136
+ Live walkthrough (5-10 min): outgoing IC walks incoming IC through the timeline + open questions in the incident channel. Both confirm understanding before handoff completes.
137
+
138
+ ### Gate
139
+ - [ ] Handoff doc posted in incident channel
140
+ - [ ] Incoming IC acknowledges + confirms understanding
141
+ - [ ] Stakeholders notified of new IC
142
+
143
+ ---
144
+
81
145
  ## Phase 2: INVESTIGATE (parallel with comms)
82
146
 
83
147
  **Goal:** find what's broken — don't fix yet, identify it.
@@ -216,23 +280,47 @@ Next update: {time}
216
280
 
217
281
  ---
218
282
 
219
- ## Communication Templates
283
+ ## Communication
284
+
285
+ ### Update frequency by severity
220
286
 
221
- **Status update (every {N} min during incident)**
287
+ | Severity | Update cadence | Channels |
288
+ |----------|---------------|----------|
289
+ | P1 | Every 15 min while investigating; every 30 min after mitigation | Incident channel + status page + customer email if >30 min outage |
290
+ | P2 | Every 30 min while investigating; hourly after mitigation | Incident channel + status page |
291
+ | P3 | Hourly | Incident channel |
292
+ | P4 | At start, on mitigation, on resolution | Incident channel |
293
+
294
+ If nothing new to report, post anyway: "No update — still investigating, next update at HH:MM." Silence creates panic.
295
+
296
+ ### Templates
297
+
298
+ **Status update**
299
+ ```
300
+ [UPDATE {time} UTC] {severity} {service}
301
+ Impact: {what users see — specific, not "issues"}
302
+ Action: {what we're doing right now}
303
+ ETA mitigation: {time or "unknown"}
304
+ Next update: {time}
305
+ ```
306
+
307
+ **Mitigation applied**
222
308
  ```
223
- [UPDATE {time}] {service} {status}
224
- Impact: {what users see}
225
- Action: {what we're doing}
309
+ [MITIGATED {time} UTC] {severity} {service}
310
+ Impact: {reduced from X to Y}
311
+ Mitigation: {what we did}
312
+ Permanent fix: {ETA}
226
313
  Next update: {time}
227
314
  ```
228
315
 
229
316
  **Resolved**
230
317
  ```
231
- [RESOLVED {time}] {service}
318
+ [RESOLVED {time} UTC] {service}
319
+ Total duration: {detected → resolved}
232
320
  Root cause: {one line}
233
321
  Mitigation: {what we did}
234
- Permanent fix: {ETA or done}
235
- Postmortem: {date}
322
+ Permanent fix: {deployed at HH:MM | scheduled by DATE}
323
+ Postmortem: {date} — link to come
236
324
  ```
237
325
 
238
326
  ---
@@ -6,290 +6,164 @@ args: PR_NUMBER
6
6
 
7
7
  # Fix PR Comment Workflow
8
8
 
9
- Workflow for fetching and fixing review comments from a pull request.
9
+ Fetch all review comments on an open PR, address each, push, and respond back to GitHub.
10
10
 
11
- ## When to use this skill
11
+ **ARGUMENTS:** `PR_NUMBER` the PR you authored.
12
12
 
13
- - Reviewer left comments on an open PR and you need to address each one
14
- - ✅ You want to track which comments are resolved vs still open
15
- - ✅ Need to post structured responses back to GitHub
16
- - ❌ Reviewing PR yourself (you're the reviewer) → use `/review:pr`
17
- - ❌ No PR yet, just want to clean up branch → use `/review:branch`
18
- - ❌ Need to fix a brand-new bug found by reviewer → use `/fix:hotfix` first, then this skill
13
+ ## When to use this skill
19
14
 
20
- ## Usage
15
+ - ✅ Reviewer left comments and you need to address each one
16
+ - ✅ Want to track which comments are resolved vs still open
17
+ - ✅ Need structured responses posted back to GitHub
18
+ - ❌ You are the reviewer → use `/review:pr`
19
+ - ❌ No PR yet → use `/review:branch`
20
+ - ❌ Fix is a brand-new bug surfaced by reviewer → `/fix:hotfix` first, then this skill
21
21
 
22
- ```
23
- /fix:pr-comment {PR_NUMBER}
24
- ```
22
+ ---
25
23
 
26
- ## Workflow Overview
24
+ ## Workflow
27
25
 
28
26
  ```
29
- ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
30
- │ 1. FETCH │──▶│ 2. ANALYZE │──▶│ 3. FIX │──▶│ 4. RESPOND │
31
- │ Comments │ │ Comments │ │ Issues │ │ to PR │
32
- └──────────────┘ └──────────────┘ └──────────────┘ └──────────────┘
27
+ FETCH → ANALYZE → FIX → RESPOND
33
28
  ```
34
29
 
35
30
  ---
36
31
 
37
32
  ## Phase 1: FETCH
38
33
 
39
- **Goal**: Fetch all review comments from the PR
40
-
41
- ### Actions
42
-
43
- 1. Get PR details:
44
- ```bash
45
- gh pr view {PR_NUMBER} --json number,title,state,headRefName,baseRefName
46
- ```
47
-
48
- 2. Fetch all review comments:
49
- ```bash
50
- gh api repos/{owner}/{repo}/pulls/{PR_NUMBER}/comments --jq '.[] | {id: .id, path: .path, line: .line, body: .body, user: .user.login, created_at: .created_at}'
51
- ```
52
-
53
- 3. Fetch PR review threads (for threaded discussions):
54
- ```bash
55
- gh api repos/{owner}/{repo}/pulls/{PR_NUMBER}/reviews --jq '.[] | {id: .id, user: .user.login, state: .state, body: .body}'
56
- ```
57
-
58
- 4. Get the current diff:
59
- ```bash
60
- gh pr diff {PR_NUMBER}
61
- ```
62
-
63
- ### Output
64
- ```markdown
65
- ## PR #{NUMBER}: {TITLE}
66
-
67
- ### Branch
68
- - Head: {headRefName}
69
- - Base: {baseRefName}
70
-
71
- ### Review Comments
72
- 1. **[{file}:{line}]** by @{user}
73
- > {comment body}
74
-
75
- 2. **[{file}:{line}]** by @{user}
76
- > {comment body}
34
+ ```bash
35
+ PR={number}
36
+ gh pr view $PR --json number,title,state,headRefName,baseRefName,author
37
+ gh pr diff $PR
38
+ gh api repos/{owner}/{repo}/pulls/$PR/comments \
39
+ --jq '.[] | {id, path, line, body, user: .user.login, created_at}'
40
+ gh api repos/{owner}/{repo}/pulls/$PR/reviews \
41
+ --jq '.[] | {id, user: .user.login, state, body}'
77
42
  ```
78
43
 
44
+ Collect into a list. Each comment has: `id`, `file:line`, `author`, `body`, `created_at`.
45
+
79
46
  ### Gate
80
- - [ ] PR details fetched
81
- - [ ] Review comments fetched
82
- - [ ] Current branch checked out
47
+ - [ ] All comments fetched (line-level + review-level)
48
+ - [ ] Current diff loaded
49
+ - [ ] PR is open (closed/merged PR → ask if user really wants to revisit)
83
50
 
84
51
  ---
85
52
 
86
53
  ## Phase 2: ANALYZE
87
54
 
88
- **Goal**: Categorize and prioritize comments
89
-
90
- ### Comment Categories
91
-
92
- | Category | Description | Priority |
93
- |----------|-------------|----------|
94
- | 🔴 **Bug** | Code bug or logic error | Must fix |
95
- | 🟠 **Security** | Security concern | Must fix |
96
- | 🟡 **Architecture** | Design/structure issue | Should fix |
97
- | 🟢 **Style** | Code style/formatting | Nice to fix |
98
- | 💬 **Question** | Needs clarification | Respond |
99
- | 💡 **Suggestion** | Optional improvement | Consider |
100
-
101
- ### Analysis Output
102
- ```markdown
103
- ## Comment Analysis
55
+ For each comment, classify:
104
56
 
105
- ### Must Fix (Critical)
106
- 1. [{file}:{line}] - {summary}
107
- 2. [{file}:{line}] - {summary}
57
+ | Category | Action |
58
+ |----------|--------|
59
+ | **Must-fix** (bug, security, broken test, arch violation) | Fix in this round |
60
+ | **Should-fix** (style, naming, missing test for new code) | Fix unless explicit reason not to |
61
+ | **Discussion** (asking a question, proposing alternative) | Reply with reasoning before fixing |
62
+ | **Nit / preference** (subjective) | Acknowledge + decide; OK to push back politely |
63
+ | **Outdated** (code already changed) | Reply "resolved by {commit}" and resolve thread |
108
64
 
109
- ### Should Fix
110
- 1. [{file}:{line}] - {summary}
65
+ Ambiguous comment (e.g., "this feels off")? Ask the reviewer for specifics before guessing.
111
66
 
112
- ### Nice to Fix
113
- 1. [{file}:{line}] - {summary}
67
+ Build a triage table:
114
68
 
115
- ### Questions to Answer
116
- 1. [{file}:{line}] - {question}
69
+ ```markdown
70
+ | # | File:line | Author | Category | Plan |
71
+ |---|-----------|--------|----------|------|
72
+ | 1 | handler.go:42 | @alice | must-fix | extract validation to DTO |
73
+ | 2 | store.go:88 | @bob | discussion | reply: prefer current approach because ... |
117
74
  ```
118
75
 
119
76
  ### Gate
120
- - [ ] All comments categorized
121
- - [ ] Priorities assigned
122
- - [ ] Fix order determined
77
+ - [ ] Every comment classified
78
+ - [ ] Plan written per comment
79
+ - [ ] Ambiguous comments → questions queued for reviewer
123
80
 
124
81
  ---
125
82
 
126
83
  ## Phase 3: FIX
127
84
 
128
- **Goal**: Address each comment systematically
129
-
130
- ### Fix Process
131
-
132
- For each comment (in priority order):
85
+ ### Rules
86
+ - Fix in order: must-fix → should-fix → discussion outcomes
87
+ - One concern per commit (`fix(handler): validate input in DTO per #pr-comment-1`)
88
+ - After each batch: run build + lint + tests locally
89
+ - Re-run `/review:branch` before pushing
133
90
 
134
- 1. **Read the file** at the specified location
135
- 2. **Understand the feedback**
136
- 3. **Apply the fix** following project conventions
137
- 4. **Mark as addressed** in your tracking
138
-
139
- ### Fix Template
140
- ```markdown
141
- ### Fixing: [{file}:{line}]
142
- **Comment**: {original comment}
143
- **Action**: {what you're changing}
144
- **Status**: ✅ Fixed / ❓ Need clarification / ⏭️ Skipped (reason)
145
- ```
146
-
147
- ### Commit Strategy
148
-
149
- Option A: Single commit for all fixes
150
- ```bash
151
- git add .
152
- git commit -m "fix: address PR review comments
153
-
154
- - Fix {issue 1}
155
- - Fix {issue 2}
156
- - Address {feedback 3}"
157
- ```
158
-
159
- Option B: Separate commits per fix (for complex changes)
160
- ```bash
161
- git commit -m "fix: {specific fix description}"
162
- ```
91
+ ### When the fix changes architecture
92
+ If a comment requests something structural (move logic between layers, add a port), use `/feature:refactor` for that subtree, then come back here to respond.
163
93
 
164
94
  ### Gate
165
- - [ ] All "Must Fix" addressed
166
- - [ ] All "Should Fix" addressed
167
- - [ ] Code compiles/builds
168
- - [ ] Tests pass
95
+ - [ ] All must-fix items addressed
96
+ - [ ] Build + lint + tests green
97
+ - [ ] Self-review with `/review:branch` clean
169
98
 
170
99
  ---
171
100
 
172
101
  ## Phase 4: RESPOND
173
102
 
174
- **Goal**: Push changes and respond to reviewers
175
-
176
- ### Actions
177
-
178
- 1. Push the fixes:
179
- ```bash
180
- git push
181
- ```
182
-
183
- 2. Reply to each comment on GitHub:
184
- ```bash
185
- # Reply to a specific comment
186
- gh api repos/{owner}/{repo}/pulls/{PR_NUMBER}/comments/{comment_id}/replies \
187
- -f body="Fixed in {commit_sha}. {additional context if needed}"
188
- ```
189
-
190
- 3. Request re-review:
191
- ```bash
192
- gh pr edit {PR_NUMBER} --add-reviewer {reviewer_username}
193
- ```
103
+ Push commits, then reply on GitHub.
194
104
 
195
- 4. Add summary comment to PR:
196
- ```bash
197
- gh pr comment {PR_NUMBER} --body "$(cat <<'EOF'
198
- ## Review Comments Addressed
199
-
200
- ### Fixed
201
- - ✅ [{file}:{line}] - {description}
202
- - ✅ [{file}:{line}] - {description}
105
+ ```bash
106
+ git push
107
+ # Reply to each thread
108
+ gh api repos/{owner}/{repo}/pulls/$PR/comments/{comment_id}/replies -f body="..."
109
+ # Or single summary review
110
+ gh pr review $PR --comment --body "$(cat reply.md)"
111
+ ```
203
112
 
204
- ### Clarifications
205
- - 💬 [{file}:{line}] - {response to question}
113
+ ### Reply patterns
206
114
 
207
- ### Deferred
208
- - ⏭️ [{file}:{line}] - {reason for deferring}
115
+ **Fixed**
116
+ > Fixed in {sha}. {one-line of what changed}.
209
117
 
210
- Ready for re-review!
211
- EOF
212
- )"
213
- ```
118
+ **Pushing back (politely)**
119
+ > Considered this — keeping current approach because {specific reason}. Happy to revisit if you have stronger evidence.
214
120
 
215
- ### Response Templates
121
+ **Asking back**
122
+ > Could you clarify what you mean by "this feels off"? Is it about {hypothesis A} or {hypothesis B}?
216
123
 
217
- **For bug fixes:**
218
- ```
219
- Fixed in {commit}. Good catch! The issue was {brief explanation}.
220
- ```
221
-
222
- **For style/suggestions:**
223
- ```
224
- Updated as suggested. Thanks for the feedback!
225
- ```
124
+ **Resolved by other change**
125
+ > Resolved by {sha} earlier in the chain — line {N} no longer exists.
226
126
 
227
- **For questions:**
228
- ```
229
- {Answer the question}. Let me know if you need more context.
230
- ```
127
+ ### Resolve threads
128
+ After replying, mark threads resolved (GitHub UI or API). Don't leave dangling threads — reviewer can't tell what's done.
231
129
 
232
- **For disagreements (respectful):**
233
- ```
234
- I considered this, but kept the current approach because {reason}. Happy to discuss further if you still have concerns.
130
+ ### Re-request review
131
+ ```bash
132
+ gh pr edit $PR --add-reviewer {original_reviewer}
235
133
  ```
236
134
 
237
135
  ### Gate
238
- - [ ] All fixes pushed
239
- - [ ] Comments replied to
240
- - [ ] Re-review requested
241
- - [ ] Summary posted
136
+ - [ ] Every comment has a reply
137
+ - [ ] Threads resolved where appropriate
138
+ - [ ] Commits pushed
139
+ - [ ] Reviewer re-requested
242
140
 
243
141
  ---
244
142
 
245
- ## Quick Reference
246
-
247
- ### GitHub CLI Commands
248
-
249
- ```bash
250
- # View PR
251
- gh pr view {NUMBER}
143
+ ## Final Report
252
144
 
253
- # Get PR comments
254
- gh api repos/{owner}/{repo}/pulls/{NUMBER}/comments
255
-
256
- # Get PR reviews
257
- gh api repos/{owner}/{repo}/pulls/{NUMBER}/reviews
258
-
259
- # Reply to comment
260
- gh api repos/{owner}/{repo}/pulls/{NUMBER}/comments/{comment_id}/replies -f body="message"
261
-
262
- # Add PR comment
263
- gh pr comment {NUMBER} --body "message"
264
-
265
- # Request reviewer
266
- gh pr edit {NUMBER} --add-reviewer {username}
145
+ ```markdown
146
+ ## PR #{N}: comments addressed
267
147
 
268
- # View PR diff
269
- gh pr diff {NUMBER}
148
+ | # | File:line | Category | Resolution | Commit |
149
+ |---|-----------|----------|------------|--------|
150
+ | 1 | handler.go:42 | must-fix | Extracted validation | abc123 |
151
+ | 2 | store.go:88 | discussion | Replied + kept approach | — |
152
+ | 3 | helper.go:5 | nit | Renamed | def456 |
270
153
 
271
- # Checkout PR branch
272
- gh pr checkout {NUMBER}
154
+ ### Build / Lint / Tests: PASS
155
+ ### Re-review requested: @{reviewer}
273
156
  ```
274
157
 
275
- ### Comment Response Etiquette
276
-
277
- 1. **Be grateful** - Reviewers spent time helping you
278
- 2. **Be clear** - Explain what you changed and why
279
- 3. **Be timely** - Address comments promptly
280
- 4. **Be thorough** - Don't leave comments unaddressed
281
- 5. **Be open** - Accept feedback gracefully
282
-
283
158
  ---
284
159
 
285
- ## Success Criteria
160
+ ## Hard Rules
286
161
 
287
- PR comments are properly addressed when:
288
- 1. All critical/must-fix comments resolved
289
- 2. All comments have responses
290
- 3. Changes pushed to the PR branch
291
- 4. Reviewers notified for re-review
292
- 5. No new issues introduced
162
+ - **Reply to every comment** — silence reads as ignoring
163
+ - **Push back politely** when you have a real reason; never just close threads
164
+ - **One concern per commit** — easier for reviewer to verify
165
+ - **Run `/review:branch` before pushing** catch easy issues before reviewer round 2
166
+ - **Don't argue style** when the team has a linter — let the tool decide
293
167
 
294
168
  ---
295
169
 
@@ -299,8 +173,8 @@ PR comments are properly addressed when:
299
173
  |------|-----|
300
174
  | You are the reviewer | `/review:pr` |
301
175
  | Self-review before pushing again | `/review:branch` |
302
- | Fixing a bug surfaced by review | `/fix:hotfix` |
303
- | Comment requests architecture refactor | `refactor` → then this skill |
176
+ | Reviewer asked for architectural refactor | `/feature:refactor` |
177
+ | Reviewer surfaced a bug needing investigation | `/fix:root-cause` |
304
178
 
305
179
  ## Recommended Agents
306
180
 
@@ -309,4 +183,4 @@ PR comments are properly addressed when:
309
183
  | ANALYZE | `@code-reviewer` | Triage comments by severity |
310
184
  | FIX | Stack-specific dev agent | Apply code changes |
311
185
  | FIX | `@security-audit` | If comment flagged security |
312
- | RESPOND | `@docs-writer` | Polish written responses |
186
+ | RESPOND | `@docs-writer` | Polish written replies |