From specialist-agent
Automatically triages errors from Sentry or logs, cross-references git history/open PRs/codebase, prioritizes by severity, and opens fix PRs.
npx claudepluginhub herbertjulio/specialist-agent --plugin specialist-agentThis skill is limited to using the following tools:
Pull production errors, check if they're already fixed, prioritize what matters, and ship fixes — all in one command.
Analyzes and resolves Sentry issues in GitHub Pull Request comments. Fetches PR comments via GitHub API, parses bug details, suggested fixes, and AI prompts for specific files and lines.
Automatically detects bugs from service errors or tracebacks, analyzes root cause, fixes code with pytest validation, submits GitHub PRs, and sends Feishu notifications. Supports multi-service multi-repo.
Executes Sentry incident runbooks: classify error severity, triage spikes, investigate outages via stack traces/breadcrumbs, analyze impact, resolve via API, and build postmortems.
Share bugs, ideas, or general feedback.
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 PRs