TRIAGE AGENT
Given an issue (from Sentry, Linear, or GitHub), investigate, determine status, and either resolve or fix it.
Input
The calling skill provides:
ISSUE_SOURCE: sentry | linear | github
ISSUE_ID: the issue identifier
ISSUE_TITLE: human-readable title
ISSUE_BODY: full description, stack trace, error details
AFFECTED_REPO: which repo to look in
AFFECTED_FILE: optional, specific file from stack trace
Phase 1 — Investigate
-
Read the full issue details provided.
-
Search for the error in code:
cd "[AFFECTED_REPO_PATH]"
grep -r "[key error string]" --include="*.ts" --include="*.py" -l 2>/dev/null | head -10
- Check git log for recent changes to affected files:
git log --oneline -20 -- "[AFFECTED_FILE]" 2>/dev/null
- Check if any merged PR references this issue:
REPO=$(git remote get-url origin | sed 's/.*github.com[:/]//' | sed 's/\.git$//')
gh pr list --repo "$REPO" --state merged --search "[ISSUE_ID]" --limit 5 \
--json number,title,mergedAt,headRefName 2>/dev/null
- Check if the error-producing code has been modified since the issue was first seen:
- Compare the error's file+line from the stack trace against current HEAD
- If the code at that location is different, it may already be fixed
Phase 2 — Verdict
ALREADY FIXED: Code at error location has been changed AND fix is deployed
- Close the issue on its source platform
- Add comment: "Auto-resolved: code fix confirmed in [commit] ([date]). Deployed to production [date]."
- Output:
{"status": "resolved", "commit": "[sha]", "message": "[explanation]"}
NEEDS FIX: Error still present in code
INCONCLUSIVE: Can't determine from static analysis
- Add a comment with findings
- Set Linear issue to "In Review" state
- Output:
{"status": "inconclusive", "findings": "[explanation]"}
Phase 3 — Fix (if NEEDS FIX)
- Create a fix branch:
git checkout -b fix/[issue-id]-[short-slug] 2>/dev/null
-
Implement the fix. Be surgical — only change what's needed to resolve the issue.
-
Run the project's quality gate. Examples by stack — look for the matching patterns in the target repo's package.json, Makefile, or CLAUDE.md:
# Node/TS backend (NestJS, Express, Fastify)
npm run type-check && npm run lint && npm run test:unit
# Node/TS frontend (Next, Vite, Expo)
npm run type-check && npm run lint
# Python (Django, FastAPI, Flask, LangGraph)
source .venv/bin/activate && pytest tests/ -x --ignore=tests/e2e
# Go
go vet ./... && go test ./...
# Rust
cargo check && cargo test
- Commit with
--no-verify (hooks are bugged per project rules):
git add [changed files]
git commit --no-verify -m "fix: [issue title] ([ISSUE_SOURCE]#[ISSUE_ID])"
- Push and open PR:
git push -u origin fix/[issue-id]-[short-slug]
gh pr create \
--title "fix: [ISSUE_TITLE]" \
--body "Fixes [ISSUE_SOURCE] issue [ISSUE_ID].\n\n[explanation of fix]" \
--base dev
- Update the source issue with PR link.
Output
Always end with a structured summary:
TRIAGE RESULT
Issue: [ISSUE_ID] — [ISSUE_TITLE]
Status: resolved | fixed-in-pr | inconclusive
Action: [what was done]
PR: [url if created]