본문으로 건너뛰기
Skillpedia
일반 코딩29k · #9770

structured-debugging

하는 일

이 스킬은 추측하지 않고 어려운 버그를 해결하는 방법입니다. 예상치 못한 동작, 간헐적으로 실패하는 테스트, 빠른 수정으로 해결되지 않은 문제에 직면한 개발자와 에이전트를 위한 스킬입니다.

사용하는 경우

  • ✓버그가 어렵고 첫 수정 시도가 효과가 없었을 때.
  • ✓테스트가 간헐적으로 실패하거나 동작이 불가능해 보일 때.
  • ✓증거 없이 외부 시스템 탓을 하고 싶은 유혹이 들 때.

스킬 링크

https://github.com/QwenLM/qwen-code/blob/main/.qwen/skills/structured-debugging/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/QwenLM/qwen-code/blob/main/.qwen/skills/structured-debugging/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“이 버그는 가끔만 발생하고 빠른 수정으로는 해결되지 않았어요. 단계별로 디버깅하는 것을 도와주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트가 먼저 구체적인 가설을 적고, 대상 로그나 확인 절차를 추가해 실행한 뒤, 결과로 원인 범위를 좁힙니다. 어려운 버그에는 세션을 넘어 유지되는 조사 일지를 남기고, 원인이 확인된 뒤에만 고칩니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Structured Debugging

When debugging hard issues, the natural instinct is to form a theory and immediately apply a fix. This fails more often than it works. The fix addresses the wrong cause, adds complexity, creates false confidence, and obscures the real issue. Worse, after several failed attempts you lose track of what's been tried and start guessing randomly.

This methodology replaces guessing with a disciplined cycle that converges on the root cause. Each iteration narrows the search space. It's slower per attempt but dramatically faster overall because you stop wasting runs on wrong theories.

The Cycle

1. Hypothesize

Before touching code, write down what you think is happening and why. Be specific about the expected state at each step in the execution path.

Bad: "Something is wrong with the wait loop." Good: "The leader hangs because hasActiveTeammates() returns true after all agents have reported completed, likely because terminal status isn't being set on the agent object after the backend process exits."

For bugs you expect to take more than one round, create a side note file for the investigation in whichever location the project uses for such notes.

Write your hypothesis there. This file persists across conversation turns and even across sessions — it's your investigation journal.

2. Design Instrumentation

Add targeted debug logs or assertions at the exact decision points that would confirm or reject your hypothesis. Think about what data you need to see.

Don't scatter console.log everywhere. Identify the 2-3 places where your hypothesis makes a testable prediction, and instrument those.

Prefer logging values (return codes, payload contents, stream types, message bodies, env state) over presence checks ("was this function called?", "was this branch taken?"). Code-path traces tell you what ran; data traces tell you what it ran on. Most non-trivial bugs are correct code processing wrong data.

Ask yourself: "If my hypothesis is correct, what will I see at point X? If it's wrong, what will I see instead?"

3. Verify Data Collection

Before running, confirm that your instrumentation output will actually be captured and accessible.

Common traps:

  • stderr discarded by 2>/dev/null in the test command
  • Process killed before flush (logs lost)
  • Logging to a file in a directory that doesn't exist
  • Output piped through something that truncates it
  • Looking at log files from a previous run, not the current one

A test run that produces no data is wasted.

4. Run and Observe

Execute the test. Read the actual output — every line of it. Don't assume what it says.

When the data contradicts your hypothesis, believe the data. Don't rationalize it away. The whole point of this step is to let reality override your theory.

5. Document Findings

Update the side note with:

  • What the data showed (quote specific log lines)
  • What was confirmed vs. disproved
  • Updated hypothesis for the next iteration

This is critical for not losing context across attempts. Hard bugs typically take 3-5 rounds. Without notes, you'll forget what you ruled out and waste runs re-checking things.

6. Iterate

Update the hypothesis based on the new evidence. Go back to step 2. Each round should narrow the search space.

If you're not making progress after 3 rounds, step back and question your assumptions. The bug might be in a layer you haven't considered.

Failure Modes to Avoid

These are the specific traps this methodology is designed to prevent. When you notice yourself drifting toward any of them, stop and return to the cycle.

Jumping to fixes without evidence

The most common failure. You have a plausible theory, so you "fix" it and run again. If the theory was wrong, you've added complexity, wasted a test run, and possibly introduced a new bug. The side note should always show "hypothesis verified by [specific data]" before any fix is applied.

Blaming external systems

"The model is hallucinating." "The API is flaky." "The library has a bug." These conclusions feel satisfying because they put the problem outside your control. They're also usually wrong.

Before blaming an external system, inspect what it actually received. A model that appears to hallucinate may be responding rationally to stale data you didn't know was there. An API that appears flaky may be receiving malformed requests. Look at the inputs, not just the outputs.

Inspecting code paths but not data

You

자주 묻는 질문

왜 바로 수정을 시도하지 않나요?

추측은 엉뚱한 원인을 고치고 복잡성을 더하기 쉬우므로, 이 방법은 먼저 검증 가능한 가설을 요구합니다.

메모를 남기나요?

네, 어려운 버그에는 세션을 넘어 유지되는 조사 일지를 남깁니다.

한 가지 프로그래밍 언어에만 맞나요?

아니요, 복잡한 시스템에서 문제를 추적하는 일반적인 방법입니다.

상세 정보

작성자의 원본 설명

Hypothesis-driven debugging methodology for hard bugs. Use this skill whenever you're investigating non-trivial bugs, unexpected behavior, flaky tests, or tracing issues through complex systems. Activate proactively when debugging requires more than a quick glance — especially when the first attempt at a fix didn't work, when behavior seems "impossible", or when you're tempted to blame an external system (model, API, library) without evidence.

repo: QwenLM/qwen-code

인기도

GitHub 스타
29k
순위
#9770
라이선스
Apache-2.0
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬