|
| 1 | +--- |
| 2 | +name: triage |
| 3 | +description: > |
| 4 | + Triage a Bugsnag production issue — either the top open issue or a specific |
| 5 | + issue by URL/ID. Investigate with evidence from stack traces / logs / |
| 6 | + breadcrumbs, propose a fix direction, route through domain experts, and write |
| 7 | + a lean review brief. |
| 8 | +allowed-tools: |
| 9 | + - Bash |
| 10 | + - Read |
| 11 | + - Glob |
| 12 | + - Grep |
| 13 | + - Write |
| 14 | + - Edit |
| 15 | + - Agent |
| 16 | + - WebFetch |
| 17 | + - Skill |
| 18 | +--- |
| 19 | + |
| 20 | +# Triage: daily Bugsnag issue investigation |
| 21 | + |
| 22 | +You are a senior Android engineer performing daily Bugsnag triage for the |
| 23 | +Flipcash Android app. Follow the steps below exactly. |
| 24 | + |
| 25 | +## Step 1 — Fetch the issue |
| 26 | + |
| 27 | +If the user provided a Bugsnag URL or error ID, pass it to the helper script: |
| 28 | + |
| 29 | +```bash |
| 30 | +# Specific issue by URL |
| 31 | +bash .claude/skills/triage/scripts/bugsnag-top.sh --url "https://app.bugsnag.com/org/project/errors/abc123" |
| 32 | + |
| 33 | +# Specific issue by error ID |
| 34 | +bash .claude/skills/triage/scripts/bugsnag-top.sh --error-id abc123 |
| 35 | +``` |
| 36 | + |
| 37 | +Otherwise, fetch the top open issue automatically: |
| 38 | + |
| 39 | +```bash |
| 40 | +bash .claude/skills/triage/scripts/bugsnag-top.sh |
| 41 | +``` |
| 42 | + |
| 43 | +The script emits a single JSON object with: |
| 44 | + |
| 45 | +| Field | Description | |
| 46 | +|-------|-------------| |
| 47 | +| `error_id` | Bugsnag error group ID | |
| 48 | +| `error_url` | Deep link into the Bugsnag dashboard | |
| 49 | +| `event_url` | REST API URL for the latest event | |
| 50 | +| `title` | Error class + message | |
| 51 | +| `severity` | `error` / `warning` / `info` | |
| 52 | +| `events` | Total occurrences | |
| 53 | +| `users` | Unique affected users | |
| 54 | +| `first_seen` | ISO-8601 timestamp | |
| 55 | +| `release` | `app_version` from the latest event | |
| 56 | + |
| 57 | +If the script exits non-zero, stop and report the error to the user. |
| 58 | + |
| 59 | +## Step 2 — Pull event detail |
| 60 | + |
| 61 | +Fetch `event_url` (include header `Authorization: token $BUGSNAG_TOKEN`). |
| 62 | +Source `.env` from the repo root if the variable is not already set. |
| 63 | + |
| 64 | +Parse the response using the event shape documented in |
| 65 | +`.claude/skills/triage/references/event-shape.md`. |
| 66 | + |
| 67 | +Extract four evidence sources: |
| 68 | + |
| 69 | +1. **Stack trace** — `exceptions[0].stacktrace` (frames with `file`, `method`, |
| 70 | + `lineNumber`, `inProject`) |
| 71 | +2. **Exception info** — `exceptions[0].errorClass` + `exceptions[0].message` |
| 72 | +3. **App logs** — `metaData["App Logs"]["app_log"]` (single string, last ~64 KB |
| 73 | + of log output) |
| 74 | +4. **Breadcrumbs** — `breadcrumbs[]` (timestamped UI / state / network events) |
| 75 | + |
| 76 | +## Step 3 — Map stack frames to source |
| 77 | + |
| 78 | +Android stack frames use Java/Kotlin package-qualified class names (e.g. |
| 79 | +`com.flipcash.features.cash.CashViewModel`). To locate the source file: |
| 80 | + |
| 81 | +1. Convert the class name to a path fragment: replace `.` with `/` and append |
| 82 | + `.kt` (try `.java` as a fallback). |
| 83 | +2. Use `Glob` to find the file in the repo (e.g. `**/**/CashViewModel.kt`). |
| 84 | +3. Read the relevant lines (`lineNumber` from the frame +/- 30 lines of |
| 85 | + context). |
| 86 | + |
| 87 | +Only map frames where `inProject` is `true`. |
| 88 | + |
| 89 | +## Step 4 — Build the evidence timeline |
| 90 | + |
| 91 | +### 4a. Version check |
| 92 | + |
| 93 | +Read `.well-known/release-manifest.json` to get the current production and |
| 94 | +internal release versions: |
| 95 | + |
| 96 | +```json |
| 97 | +{ |
| 98 | + "tracks": { |
| 99 | + "production": { "versionCode": 3508, "versionName": "2026.5.2" }, |
| 100 | + "internal": { "versionCode": 3508, "versionName": "2026.5.2" } |
| 101 | + } |
| 102 | +} |
| 103 | +``` |
| 104 | + |
| 105 | +Compare the event's `app.version` against `tracks.production.versionName` to |
| 106 | +determine if the crash still affects the latest release. |
| 107 | + |
| 108 | +### 4b. Assemble evidence |
| 109 | + |
| 110 | +Collect: |
| 111 | + |
| 112 | +- The in-project stack frames mapped to source (file:line + code snippet) |
| 113 | +- The exception class and message |
| 114 | +- Relevant log lines (grep the `app_log` string for keywords from the exception) |
| 115 | +- The last 10-20 breadcrumbs before the crash |
| 116 | +- `app.version`, `device.manufacturer`, `device.model`, `os.version` |
| 117 | + |
| 118 | +## Step 5 — Investigate root cause |
| 119 | + |
| 120 | +Using the evidence from Step 4: |
| 121 | + |
| 122 | +1. Read the source files identified in the stack trace. |
| 123 | +2. Follow the call chain — read callers and callees within 2 hops. |
| 124 | +3. Check for known patterns: null-safety violations, lifecycle issues, |
| 125 | + threading bugs, uncaught coroutine exceptions, missing error handling. |
| 126 | +4. Form a hypothesis and verify it against the logs and breadcrumbs. |
| 127 | + |
| 128 | +## Step 6 — Propose a fix direction |
| 129 | + |
| 130 | +Write a concrete fix direction (NOT a full implementation): |
| 131 | + |
| 132 | +- Which file(s) to change and roughly where (`.kt:NN`) |
| 133 | +- What the fix involves (e.g. "add null check before accessing X", |
| 134 | + "move coroutine launch to lifecycleScope", "catch Y in Z") |
| 135 | +- Why this addresses the root cause |
| 136 | +- Any risks or side effects |
| 137 | + |
| 138 | +## Step 7 — Route through domain experts |
| 139 | + |
| 140 | +Based on the evidence, tag relevant experts by adding their labels to the brief. |
| 141 | +An issue may match multiple experts. |
| 142 | + |
| 143 | +| Expert | Trigger | |
| 144 | +|--------|---------| |
| 145 | +| `compose` | Touches files with `@Composable`, `Modifier`, `remember`, `LaunchedEffect`, or under `ui/`, `features/*/ui/` | |
| 146 | +| `kotlin-coroutines` | Stack contains `CoroutineScope`, `Dispatchers`, `suspend`, `launch`, `async`, `withContext`, `Job`, `SupervisorJob` | |
| 147 | +| `android-tdd` | Proposed fix direction adds or modifies test files | |
| 148 | +| `kotlin-flows` | Stack or fix involves `Flow`, `StateFlow`, `SharedFlow`, `collect`, `stateIn` | |
| 149 | + |
| 150 | +## Step 8 — Write the review brief |
| 151 | + |
| 152 | +Use the template in `.claude/skills/triage/references/brief-template.md`. |
| 153 | + |
| 154 | +Save the brief to `.claude/plans/triage-<error_id>.md`. |
| 155 | + |
| 156 | +Keep the brief under 300 words (excluding code snippets and the evidence |
| 157 | +appendix). |
| 158 | + |
| 159 | +## Step 9 — Next steps |
| 160 | + |
| 161 | +If the fix direction is clear and well-scoped, offer to draft an implementation |
| 162 | +plan using `superpowers:writing-plans`. |
| 163 | + |
| 164 | +If the root cause is ambiguous, suggest specific debugging steps (add logging, |
| 165 | +reproduce locally, check related Bugsnag issues). |
0 commit comments