From specialist-agent
Automatically triages errors from Sentry or logs, cross-references git history/open PRs/codebase, prioritizes by severity, and opens fix PRs.
How this skill is triggered — by the user, by Claude, or both
Slash command
/specialist-agent:autofixThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Pull production errors, check if they're already fixed, prioritize what matters, and ship fixes — all in one command.
Pull production errors, check if they're already fixed, prioritize what matters, and ship fixes — all in one command.
Target: $ARGUMENTS
If using Sentry, first inform the user and verify the Sentry CLI is installed:
"This workflow requires the Sentry CLI. Checking if
sentry-cliis available..."
sentry-cli --version
If not installed, stop and instruct: npm install -g @sentry/cli or see https://docs.sentry.io/cli/installation/
Then check which error source is available:
# Check for Sentry
echo $SENTRY_AUTH_TOKEN | head -c 4
# Check for error log files
ls logs/ error.log *.log 2>/dev/null
| Source | Detection |
|---|---|
| Sentry | $SENTRY_AUTH_TOKEN + $SENTRY_ORG + $SENTRY_PROJECT set |
| Log files | logs/ directory or *.log files present |
| Manual | User provides error text or screenshot |
If no source detected, ask user:
"No error source detected. Set
SENTRY_AUTH_TOKEN,SENTRY_ORG,SENTRY_PROJECTfor Sentry, or provide error logs."
Sentry mode:
curl -s -H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \
"https://sentry.io/api/0/projects/$SENTRY_ORG/$SENTRY_PROJECT/issues/?query=is:unresolved&statsPeriod=${TIMEFRAME:-24h}&sort=freq"
Log mode:
# Extract unique errors from logs
grep -E "(Error|Exception|FATAL|CRITICAL)" logs/*.log | sort -u
Parse each error: message, stack trace, frequency, timestamp.
For each error, run three checks in parallel:
git log --since="${TIMEFRAME:-24 hours ago}" --all -- {file} for recent fixesgh pr list --state open --search "{error-keyword}" for in-progress fixesGrep for the exact error location to verify it still existsClassify:
FIXED — Recent commit addresses the errorPR_OPEN — Open PR targets the file/errorNEEDS_FIX — No existing fix| Tier | Criteria | Recommended Action |
|---|---|---|
| P0 Critical | >100 events OR >50 users OR security/data-loss | Fix now, create PR immediately |
| P1 Important | >10 events OR >5 users OR broken UX flow | Fix this sprint |
| P2 Low | <10 events AND edge-case/cosmetic | Add to backlog |
For log-based errors without event counts, use recency and frequency in log file.
Display the triage to the user:
## Autofix Report — {date}
Period: Last {timeframe}
Source: {sentry|logs}
ALREADY FIXED (3):
- "Connection timeout" → fixed in abc1234
- "Null ref in CartService" → PR #42 open
P0 CRITICAL (1):
1. TypeError in src/api/users.ts:45 — 342 events, 89 users
Root cause: Missing null check on user.profile
P1 IMPORTANT (2):
2. UnhandledRejection in src/services/payment.ts:112 — 28 events
3. RangeError in src/utils/date.ts:67 — 15 events
P2 LOW (4):
4-7. [listed with brief descriptions]
Select issues to fix: [1,2,3] or "all-p0" or "all"
For each selected issue:
fix/autofix-{id}-{short-desc}npm test or detected test runner--auto-pr flag set, create PR automatically:
gh pr create --title "fix: {error-title}" --body "..."
## /autofix Results
**Source:** {sentry|logs}
**Period:** {timeframe}
**Triaged:** {n} issues
| Tier | Count | Fixed | PR Created |
|------|-------|-------|------------|
| P0 | {n} | {n} | {n} |
| P1 | {n} | {n} | {n} |
| P2 | {n} | {n} | {n} |
### PRs Created
- `fix/autofix-123-null-check` → PR #45
- `fix/autofix-456-timeout-handler` → PR #46
| Excuse | Reality |
|---|---|
| "I'll check Sentry later" | Later never comes. Errors compound. Triage now takes 2 minutes. |
| "Low event count = not important" | Low count can mean high severity for specific users. Check userCount. |
| "The fix might break something" | A tested fix in a PR is safer than an unhandled production error. |
| "It's already been reported" | Reported != fixed. Check the PR status. |
--timeframe flag (default: 24h)--auto-pr is not set, always ask before creating PRsnpx claudepluginhub herbertjulio/specialist-agent --plugin specialist-agentAnalyzes and resolves Sentry issues posted as GitHub PR review comments. Fetches comments, parses bug details, and applies fixes.
Executes Sentry incident runbooks: classify error severity, triage spikes, investigate outages via stack traces/breadcrumbs, analyze impact, resolve via API, and build postmortems.
Fixes GitHub issues using parallel analysis, hypothesis-based root cause analysis, similar issue detection, and prevention recommendations. Use for debugging errors, regressions, bugs, or triaging.