debugging-and-error-recovery
하는 일
코드의 오류를 체계적으로 찾아 고치도록 돕는 가이드입니다. 추측하지 말고 멈추고, 조사하고, 문제를 해결하도록 가르칩니다.
사용하는 경우
- ✓변경 후 테스트가 실패할 때.
- ✓프로그램이 기대대로 작동하지 않을 때.
- ✓예상치 못한 오류를 만났을 때.
스킬 링크
https://github.com/addyosmani/agent-skills/blob/main/skills/debugging-and-error-recovery/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“사용자를 저장하려고 할 때 이상한 오류가 나는데, 원인을 찾도록 도와주실 수 있나요?”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
먼저 오류를 재현하도록 요청하고, 오류가 어디서 발생하는지 찾고, 문제를 단순화한 다음, 마지막으로 진짜 원인을 고칩니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Debugging and Error Recovery
Overview
Systematic debugging with structured triage. When something breaks, stop adding features, preserve evidence, and follow a structured process to find and fix the root cause. Guessing wastes time. The triage checklist works for test failures, build errors, runtime bugs, and production incidents.
When to Use
- Tests fail after a code change
- The build breaks
- Runtime behavior doesn't match expectations
- A bug report arrives
- An error appears in logs or console
- Something worked before and stopped working
The Stop-the-Line Rule
When anything unexpected happens:
1. STOP adding features or making changes
2. PRESERVE evidence (error output, logs, repro steps)
3. DIAGNOSE using the triage checklist
4. FIX the root cause
5. GUARD against recurrence
6. RESUME only after verification passes
Don't push past a failing test or broken build to work on the next feature. Errors compound. A bug in Step 3 that goes unfixed makes Steps 4-6 wrong.
The Triage Checklist
Work through these steps in order. Do not skip steps.
Step 1: Reproduce
Make the failure happen reliably. If you can't reproduce it, you can't fix it with confidence.
Can you reproduce the failure?
├── YES → Proceed to Step 2
└── NO
├── Gather more context (logs, environment details)
├── Try reproducing in a minimal environment
└── If truly non-reproducible, document conditions and monitor
When a bug is non-reproducible:
Cannot reproduce on demand:
├── Timing-dependent?
│ ├── Add timestamps to logs around the suspected area
│ ├── Try with artificial delays (setTimeout, sleep) to widen race windows
│ └── Run under load or concurrency to increase collision probability
├── Environment-dependent?
│ ├── Compare Node/browser versions, OS, environment variables
│ ├── Check for differences in data (empty vs populated database)
│ └── Try reproducing in CI where the environment is clean
├── State-dependent?
│ ├── Check for leaked state between tests or requests
│ ├── Look for global variables, singletons, or shared caches
│ └── Run the failing scenario in isolation vs after other operations
└── Truly random?
├── Add defensive logging at the suspected location
├── Set up an alert for the specific error signature
└── Document the conditions observed and revisit when it recurs
For test failures (npm shown — substitute the repository's own test command, per the test-driven-development skill's Discover the Stack First section):
# Run the specific failing test
npm test -- --grep "test name"
# Run with verbose output
npm test -- --verbose
# Run in isolation (rules out test pollution)
npm test -- --testPathPattern="specific-file" --runInBand
Step 2: Localize
Narrow down WHERE the failure happens:
Which layer is failing?
├── UI/Frontend → Check console, DOM, network tab
├── API/Backend → Check server logs, request/response
├── Database → Check queries, schema, data integrity
├── Build tooling → Check config, dependencies, environment
├── External service → Check connectivity, API changes, rate limits
└── Test itself → Check if the test is correct (false negative)
Use bisection for regression bugs:
# Find which commit introduced the bug
git bisect start
git bisect bad # Current commit is broken
git bisect good <known-good-sha> # This commit worked
# Git will checkout midpoint commits; run your test at each
git bisect run npm test -- --grep "failing test" # substitute the repository's focused-test command
Step 3: Reduce
Create the minimal failing case:
- Remove unrelated code/config until only the bug remains
- Simplify the input to the smallest example that triggers the failure
- Strip the test to the bare minimum that reproduces the issue
A minimal reproduction makes the root cause obvious and prevents fixing symptoms instead of causes.
Step 4: Fix the Root Cause
Fix the underlying issue, not the symptom:
Symptom: "The user list shows duplicate entries"
Symptom fix (bad):
→ Deduplicate in the UI component: [...new Set(users)]
Root cause fix (good):
→ The API endpoint has a JOIN that produces duplicates
→ Fix the query, add a DISTINCT, or fix the data model
Ask: "Why does this happen?" until you reach the actual cause, not just where it manifests.
Step 5: Guard Against Recurrence
…
자주 묻는 질문
'preserve evidence'는 무슨 뜻인가요?
오류 메시지, 로그, 또는 오류를 재현하기 위해 밟은 단계 등 오류에 관한 중요한 정보를 저장한다는 뜻입니다.
무언가 고장 났을 때 왜 새 기능을 추가하면 안 되나요?
코드를 더 추가하면 문제가 악화되거나 원인을 숨길 수 있어, 고치기 더 어려워지기 때문입니다.
'bisection'이란 무엇인가요?
작동하던 버전을 찾을 때까지 이전 버전의 코드를 테스트해서, 어떤 변경이 문제를 일으켰는지 찾는 기법입니다.
상세 정보
작성자의 원본 설명
Guides systematic root-cause debugging. Use when tests fail, builds break, something that worked yesterday broke, behavior doesn't match expectations, or you encounter any unexpected error. Use when you need to figure out what broke and why — a systematic approach to finding and fixing the root cause rather than guessing.
repo: addyosmani/agent-skills
인기도
- GitHub 스타
- 107k
- 순위
- #768
- 라이선스
- MIT
- 업데이트
- 2026. 10. 13.
댓글
- …
이 저장소의 다른 스킬
api-and-interface-design
107k잘 정의된 API와 인터페이스를 만드는 데 도움을 줍니다. 소프트웨어의 서로 다른 부분이 통신하는 방식을 설계할 때 유용합니다.
browser-testing-with-devtools
107k에이전트가 실제 브라우저에서 코드를 직접 테스트하도록 돕습니다. 사용 환경에서 어떻게 작동하는지 확인하고, 오류와 성능 문제를 찾는 데 유용합니다.
ci-cd-and-automation
107k반복 작업을 자동화하고, 프로젝트를 배포하며, 인프라를 관리하도록 에이전트에게 가르칩니다.
code-review-and-quality
107k여러 측면에서 상세한 코드 검토를 수행합니다. 새 변경 사항을 병합하기 전에 품질을 확인하고 향후 문제를 막는 데 유용합니다.
비슷한 스킬
test-driven-development
311k에이전트가 기능이나 수정을 만들기 전에 실패하는 테스트를 먼저 쓰고, 그것을 통과시키는 가장 작은 코드를 작성하도록 가르칩니다.
verification-before-completion
311k에이전트가 작업, 수정, 빌드가 완료되었거나 통과했다고 말하기 전에 실제 점검을 실행하고 결과를 읽도록 가르칩니다.
migrate-to-shoehorn
310k테스트 파일의 위험한 타입 캐스팅을 shoehorn 라이브러리로 바꿔, 테스트가 일부 데이터만 써도 타입 검사를 통과하도록 돕습니다.