bugfix
npx skills add https://github.com/acedergren/agentic-tools --skill bugfix
Agent 安装分布
Skill 文档
Bugfix
Autonomous end-to-end bug fix pipeline. Diagnoses from evidence, finds root cause, implements minimal fix, verifies correctness, and commits.
Pipeline
Step 1: Gather Evidence (no code yet)
Parse $ARGUMENTS for:
- Error message / stack trace
- Failing test name / file
- CI log excerpt
- Reproduction steps
Then collect full context autonomously:
- Run the failing test to see the exact error output:
npx vitest run apps/api --reporter=verbose 2>&1 | grep -A 20 "FAIL\|Error" - Read the failing test file to understand what it expects
- Read the source file under test
- Check git log for recent changes to the affected files:
git log --oneline -10 -- <affected-file> - If it’s a runtime error, check logs and relevant route/plugin/service
Do NOT ask the user for more information unless the bug description is completely ambiguous. Use the tools to find it.
Step 2: Root Cause Hypothesis
State a clear hypothesis:
- “The test is failing because X, caused by Y”
- “The runtime error is thrown at line N because Z”
Distinguish between:
- Code bug â implementation is wrong
- Test bug â test expectation is wrong (question the test first)
- Mock wiring issue â
mockReset: truepattern not followed - Type error â TypeScript compilation failure
- Import error â wrong package path
If it’s a mock wiring issue, reference the mock patterns in CLAUDE.md before writing any fix.
Step 3: Minimal Fix
Implement the minimum change that fixes the root cause:
- Do NOT refactor unrelated code
- Do NOT fix other bugs you noticed (create a new task instead)
- Do NOT add features
- If the test itself is wrong, fix the test â but explain why the test was wrong
For mock wiring issues, use the correct pattern from CLAUDE.md:
- Forwarding pattern for simple mocks
- Object-bag pattern for plugins with many exports
- Counter-based sequencing for multi-query operations
Step 4: Verify
- Run the specific failing test â it must now pass:
npx vitest run apps/api --reporter=verbose -t "test name" - Run the full workspace test suite to check for regressions:
npx vitest run apps/api - Run typecheck on the affected workspace:
cd apps/api && npx tsc --noEmit
If step 2 reveals a regression caused by your fix, diagnose and resolve before proceeding.
Step 5: Scope Guard
Run git diff --name-only and verify every changed file relates to the bug. Revert anything that doesn’t.
Step 6: Commit
Stage only the changed files (never git add -A). Commit:
fix(scope): <what was broken and how it was fixed>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Abort Conditions
Stop and ask the user only if:
- The bug is in a security-sensitive area (auth, RBAC, IDOR) â confirm the fix approach before applying
- The fix requires changing more than 5 files â the scope may be too large for a single fix
- Root cause requires an architectural decision (e.g., changing the mock strategy for an entire test suite)
Arguments
$ARGUMENTS: Bug description â error message, failing test name, CI log URL, or reproduction steps- If empty, ask for the error message or failing test name
Examples
/bugfix "TypeError: Cannot read property 'orgId' of undefined in resolveOrgId"/bugfix apps/api/src/tests/routes/tools.test.tsâ diagnose all failures in that file/bugfix "CI failing on PR #123 â vitest run apps/frontend exits with code 1"