AGENT SKILL
debugging
Systematically find the root cause of a bug instead of guessing at fixes
- License 许可
- Apache-2.0
- 最近更新
- 2026-07-01
- Stars
- ★ 2
- Forks
- 1
01 前言 Front Matter
- name
- debugging
- description
- Systematically find the root cause of a bug instead of guessing at fixes
03 SKILL.md 正文
Debugging
Use this skill when investigating a bug, crash, test failure, or unexpected behavior. The aim is to find the root cause, not to paper over a symptom.
Method
- Reproduce. Establish a reliable, minimal way to trigger the bug. If you can't reproduce it, you can't confirm a fix. Capture the exact command, input, and environment.
- Read the evidence. Stack trace, error message, and logs point at the failure site. Read the first error, not the last — later errors are often cascades.
- Form one hypothesis. State what you think is wrong and why, in terms of specific code. Avoid changing several things at once.
- Locate. Narrow the failing region: bisect the input, add targeted logging or assertions, or use a debugger. Confirm the actual values at the boundary, not what you assume they are.
- Test the hypothesis. Make the smallest change that would prove or disprove it. If disproved, discard it and form a new one — don't pile on patches.
- Fix the cause. Address the underlying defect. Then check for sibling instances of the same mistake elsewhere.
- Verify. Reproduce again to confirm the bug is gone, and run the surrounding tests/build to confirm you didn't break anything.
- Guard it. Add or extend a test that fails before the fix and passes after.
Useful tactics
- Bisect a regression with
git bisect(or by reverting suspect changes) to find the commit that introduced it. - Binary-search the data: halve the input until the smallest failing case remains.
- Check the boundaries: nil/empty/zero, first/last element, off-by-one, unicode, timezones, concurrency interleavings.
- Question assumptions: print or assert the value you're "sure" about. Bugs hide where you stopped looking.
- Read the source of the dependency rather than guessing its behavior.
Anti-patterns to avoid
- Shotgun debugging: changing many things hoping one helps.
- Adding
try/catch/recoverto silence an error without understanding it. - Declaring it fixed without reproducing the original failure first.
04 同仓库更多 Skills
parallel-research
Delegate independent research and verification to sub-agents in parallel to cut wall-clock latency
★ 2
git-commit
Write clear Conventional Commits messages and stage changes safely
★ 2
code-review
Review code changes for bugs, security, and correctness with a high signal-to-noise checklist
★ 2
calc
Calculate mathematical expressions
★ 2