Claude-skill-registry find-and-fix-bugs
Find, triage, and fix bugs with or without user input. Autonomously scan codebases, produce an issues list, implement a fix, create a fix branch, commit via semantic-commit, and open a PR with gh.
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/find-and-fix-bugs" ~/.claude/skills/majiayu000-claude-skill-registry-find-and-fix-bugs && rm -rf "$T"
manifest:
skills/data/find-and-fix-bugs/SKILL.mdsource content
Find and Fix Bugs
Contract
Prereqs:
- Run inside the target git repo.
available onrg
for codebase scanning.PATH
andgit
available ongh
, andPATH
succeeds.gh auth status
available for helper commands (recommended).$AGENT_KIT_HOME/scripts/kit-tools.sh
Inputs:
- Optional bug report (repro steps, expected vs actual, environment); otherwise autonomous discovery.
Outputs:
- An issues list (per
), a fix branch, commits, and a GitHub PR.references/ISSUES_TEMPLATE.md
Exit codes:
- N/A (multi-command workflow; failures surfaced from underlying commands)
Failure modes:
- Cannot reproduce or insufficient input to confirm impact (record as uncertainty rather than guessing).
- High-risk changes (auth/billing/migrations) should halt or be skipped per guardrails.
- Missing tooling (
/rg
/git
) or insufficient repo permissions.gh
Setup
- Load commands with
source $AGENT_KIT_HOME/scripts/kit-tools.sh
Trigger
Use this skill when the user asks to find or fix bugs, or when no concrete issue is provided and you are asked to proactively discover issues.
Intake rules
- If the user provides a bug report: ensure reproduction steps, expected vs actual, and environment. Ask only for missing details.
- If the user provides no input: do not ask; proceed autonomously.
Discovery
- Scope scanning to tracked files only (ignore untracked files).
- Use
to scan for bug-prone patterns (TODO, FIXME, BUG, HACK, XXX, panic, unwrap, throw, catch, console.error, assert).rg - Exclude generated, vendor, or codegen directories when present (node_modules, dist, build, vendor, .git, gen, generated, codegen).
- Keep scan rules general; do not add repo-specific patterns.
- Do not rely on grep results alone; use LLM analysis to confirm plausibility and impact.
- Produce an issues list using
.references/ISSUES_TEMPLATE.md - Use the ID format
(example:PR-<number>-BUG-###
). If the PR number is not known yet, usePR-128-BUG-001
as a placeholder and update after PR creation.PR-<number> - For project-specific skills, consider adding a minimal repro script requirement; see
.references/REPRO_GUIDE.md
Context window management
- Prioritize scanning changed files and adjacent code before wider searches.
- If
results are large, process in batches (for example: 20-50 hits per batch).rg - Stop after enough high-confidence issues are identified to proceed with a fix.
Selection
- If user input exists, fix that issue.
- If autonomous, fix the single most severe or highest-confidence issue.
- Only fix multiple issues when they share the same root cause and the diff remains small.
- Severity levels are fixed: critical, high, medium, low.
Severity rubric
- critical: security exploit, auth bypass, data loss/corruption, or production outage
- high: frequent crash, major feature broken, or incorrect core outputs
- medium: incorrect behavior with workaround, edge cases, or performance regression
- low: minor bug, UX issue, or noisy logs without functional impact
Confidence rubric
- high: clear reproduction or strong evidence, root cause identified, fix is validated
- medium: likely issue with partial evidence, root cause inferred, fix is plausible
- low: speculative issue, weak evidence, or no repro path
High-risk guardrails
- Do not auto-fix changes involving auth, permission/authorization, payment/billing, migration, or infrastructure/deployment.
- If autonomous and the top issue is high-risk, record it and move to the next eligible issue. If all issues are high-risk, stop after reporting.
Fix workflow
- Create a new branch:
using the fixed severity levels.fix/<severity>-<slug> - Implement the fix with minimal scope; avoid refactors.
- Add or update tests when possible; run lint/test/build commands when present (see Validation commands). If validation fails, follow Retry policy.
- Update the issues list with status.
Validation commands
- package.json scripts:
,lint
,test
(npm, pnpm, yarn, or bun)build - Makefile targets:
,lint
,testbuild - Justfile targets:
,lint
,testbuild - Taskfile targets:
,lint
,testbuild - Language defaults when applicable:
,go test ./...
,pytest
,cargo test
,mvn test
,gradle testdotnet test
Retry policy
- If validation fails, fix based on error output and retry up to 2 times.
- After 2 failed attempts, stop and report the failure with the last error output.
Commit
- Use the
skill to generate a Semantic Commit message.semantic-commit - Prefer a single commit unless there is a clear reason to split.
PR
- Use
and write the body usinggh pr create
.references/PR_TEMPLATE.md - Set the PR title to the primary issue or a short summary of the fix. Do not reuse the commit subject. Capitalize the first word.
- Replace the first H1 line in
with the same PR title.references/PR_TEMPLATE.md - The PR must include:
- Issues found (including those not fixed)
- Fix approach
- Testing results or "not run"
- Include the issues list in the PR body.
- Use
(orscripts/render_issues_pr.sh --pr
) to generate templates quickly.--issues
Output and clarification rules
- Use
as the response format.references/OUTPUT_TEMPLATE.md - The response must include, in order:
- Issues list
outputgit-scope- Tests run (commands and results)
- PR link