# sentry-errors — Auto-Triage Subagent for Sentry > Open-source Claude Code subagent that pulls recent Sentry errors via MCP, groups by component, and suggests fix priorities. Inspired by Boris Cherny. ## Install Save the content below to `.claude/skills/` or append to your `CLAUDE.md`: # sentry-errors — Auto-Triage Subagent for Sentry ## Quick Use 1. Install Sentry MCP first: see TokRepo workflow id 665 (Sentry MCP). 2. Save the file below to `.claude/agents/sentry-errors.md`. 3. Restart Claude Code (or `/agents reload`). 4. Each morning, say: > "Use sentry-errors to triage what came in overnight." You get a grouped, prioritized digest of Sentry errors with suggested next actions. > Inspired by Boris Cherny's described workflow on howborisusesclaudecode.com — he uses Sentry MCP plus a triage subagent to "fetch and triage error logs autonomously." This is a community-written equivalent. --- ## Intro sentry-errors is a Claude Code subagent that pulls recent Sentry errors via the official Sentry MCP, groups them by component and root cause, and emits a prioritized triage list. It is built for the morning-standup pattern: instead of you scrolling Sentry, the subagent reads it for you and tells you what actually matters. Boris Cherny describes this exact pattern as part of his Claude Code setup — he names error triage as one of the things subagents handle for him while he works on something else. This entry packages that pattern. Works with: Claude Code 1.x + Sentry MCP. Setup: under 2 minutes once Sentry MCP is configured. --- ## How sentry-errors Works Save to `.claude/agents/sentry-errors.md`: ```markdown --- name: sentry-errors description: Pull recent Sentry errors, group them by component and root cause, suggest priorities. Use for morning triage or after a deploy. tools: mcp__sentry__*, Bash, Read --- You are the sentry-errors subagent. Your single responsibility is to triage Sentry — not fix bugs, not write code, just turn a noisy event stream into an ordered action list. ## Workflow 1. Fetch errors from the last 24h via Sentry MCP (`list_issues` or `list_events` with `dateFrom = 24h ago`). 2. Group by `culprit` (file + function) and root-cause hash. 3. For each group, capture: count, first/last seen, affected users, any new release link. 4. Score priority: - P0: > 100 occurrences AND > 10 affected users AND seen first in the last release - P1: > 100 OR new in the last release - P2: everything else 5. For P0 + P1 groups, attach a one-line hypothesis and the most-recent commit that touched the culprit file (`git log -1 --format='%h %s' -- `). 6. Emit the report below. ## Output format sentry-errors triage — last 24h ================================ Total events: N Distinct issues: N P0: N | P1: N | P2: N P0: 1. — N events, N users, first seen Hypothesis: Last touch: P1: 1. ... P2 (collapsed): N issues, see Sentry for details. ## Boundaries - Do not open issues, file PRs, or fix bugs. - Do not silence/ignore errors in Sentry without explicit user instruction. - If Sentry MCP is not installed, escalate: "Install Sentry MCP first." ``` ### When to use - Daily morning standup (before you start coding). - Right after a production deploy (15-minute check). - During an incident — fastest grouped view of what is actually breaking. ### When not to use - For a single specific error you are already debugging — just open Sentry. - For long-tail historical analytics (use Sentry's UI). --- ## Example session ``` You: "Run sentry-errors on overnight events." Claude: -> Sentry MCP -> fetch 24h -> groups 1,247 events into 28 issues -> 1 P0, 4 P1, 23 P2 -> reports: P0: src/checkout/charge.ts:88 — 412 events, 87 users, first in v3.4.2 Hypothesis: Stripe API key rotation broke production Last touch: a1b2c3d "Rotate Stripe key" ``` --- ## FAQ **Q: Does it require Sentry MCP?** A: Yes — Sentry MCP is the data source. Install it first (TokRepo id 665). **Q: Will it suppress or ignore events?** A: No — read-only by design. Triage only, no destructive writes. **Q: How is priority scored?** A: Volume + user impact + release proximity. The rules are explicit in the Workflow section so you can tune them. **Q: Can I scope to a specific Sentry project?** A: Yes — edit the Workflow's `list_issues` call to pass `project=`. **Q: Is this Boris Cherny's actual subagent?** A: No — community-written equivalent based on his public description. --- ## Source & Thanks > Inspired by Boris Cherny's "fetch and triage error logs autonomously" pattern on howborisusesclaudecode.com. Citations: - howborisusesclaudecode.com (Sentry section) - Sentry MCP (TokRepo id 665): https://tokrepo.com/en/featured - Pragmatic Engineer: https://newsletter.pragmaticengineer.com/p/building-claude-code-with-boris-cherny ## 快速使用 前置:先装 Sentry MCP(TokRepo id 665)。 1. 落 `.claude/agents/sentry-errors.md` 2. `/agents reload` 3. 早会前问 Claude:"Use sentry-errors to triage what came in overnight." 输出按 P0/P1/P2 分级,每条带 hypothesis + 最近一次改动 culprit 文件的 commit。 ## 边界 - 只读不写:不开 issue、不关 issue、不静默 - 不修 bug:触发只输出 triage 报告,修复留给人/code-fixer - Sentry MCP 没装就报错让你先装 --- Source: https://tokrepo.com/en/workflows/sentry-errors-auto-triage-subagent-for-sentry-676b8063 Author: Skill Factory