Skip to content

Guide · Agent skill

How to use the Structured Debugging agent skill

Updated · written with AI from the project's own documentation and checked against our catalogue data

The structured-debugging skill is a debugging method for an AI coding agent. Instead of forming a theory and applying a fix straight away, the agent writes a specific hypothesis, adds a few targeted logs, checks that the output will be captured, runs the test and records what the data showed. This guide explains what the skill changes, how to install it, how to trigger it and when it is not worth using.

Structured DebuggingQwenLM/qwen-code · Apache-2.0

Quick start

  1. 1Download the ZIP. Get the structured-debugging skill ZIP from this page.
  2. 2Unzip the skill. Extract the archive so the structured-debugging folder containing SKILL.md is in place.
  3. 3Choose a location. Move the folder into ~/.claude/skills/ for personal use or into the project's .claude/skills/ for one project.
  4. 4Or upload in the Claude apps. In the Claude apps, go to Settings → Capabilities → Skills and upload the skill.
  5. 5Describe the hard bug. State the symptom, whether it is intermittent, and whether earlier fixes failed.
  6. 6Review the notes file. Read the hypothesis and evidence the agent records for each round, and check the root cause before a fix is applied.

What is an agent skill, and what does this one make the agent do?

An agent skill is a folder containing a SKILL.md file with instructions that an AI agent loads when a task matches the skill's description. This one is from the QwenLM/qwen-code project, licensed under Apache-2.0, and is designed for hard bugs such as flaky tests, intermittent failures and behaviour that seems impossible.

The skill follows a six-step cycle: hypothesize, design instrumentation, verify data collection, run and observe, document findings, and iterate. It also warns the agent against three traps: jumping to fixes without evidence, blaming external systems such as models or APIs without inspecting their inputs, and reframing the user's report instead of investigating it.

Install the structured-debugging skill

Download the ZIP from the skill's page on this directory and unzip it. Then place the skill folder in one of these locations, depending on how you want it available:

  • Personal use across projects: unzip into ~/.claude/skills/
  • One project only: unzip into the project's .claude/skills/ folder
  • Claude apps: upload the skill under Settings → Capabilities → Skills

Trigger the skill with natural requests

You do not need a special command. The SKILL.md description tells the agent to use the skill when investigating non-trivial bugs, unexpected behaviour, flaky tests, or issues traced through complex systems. It also asks the agent to activate proactively when a first fix attempt failed or when it is tempted to blame an outside system.

You can make it explicit in plain language, for example: "This test fails about one run in five. Use structured debugging to find the cause before changing anything."

  • Name the symptom and say it is intermittent, flaky or impossible
  • Mention that a previous fix did not work, so the agent starts from evidence
  • Ask for the investigation notes file if you want a record across sessions

What the investigation looks like in practice

For bugs expected to take more than one round, the method asks the agent to create a side note file in the location the project uses for such notes. The file holds the hypothesis, the evidence from each run and the next hypothesis. The agent re-reads it at the start of each round.

The worked example in the skill concerns a qwen-code command that printed nothing in a zsh terminal while output captured through a pipe looked correct. The skill uses it to show that a contradiction between environments is evidence, and that the data flowing through the code matters as much as whether the code runs.

  • Write a specific hypothesis before touching code
  • Log values (return codes, payloads, message bodies) rather than simple presence checks
  • Confirm logs are not discarded, for example by 2>/dev/null, before running
  • After 3 rounds without progress, question your assumptions
  • Apply a fix only once logs confirm the root cause, then remove instrumentation and verify with a clean run

Check persistent state first

The skill names persistent state as a common source of impossible bugs. Caches, session recordings, message queues, temp files and database rows can carry leftovers from previous runs, so the code is correct but the data is wrong. When behaviour seems irrational, the agent checks whether state persists across runs, whether it was cleared, and whether the system is reading stale data.

What people use it for

  • Tracking down a flaky test that passes most runs and fails occasionally
  • Investigating a command that prints nothing in one terminal but works when output is piped
  • Stopping an agent from blaming a model or API before it has inspected the inputs
  • Keeping a multi-session investigation journal for a bug that takes several rounds to isolate

Frequently asked questions

Is the structured-debugging skill free?

The skill is published under the Apache-2.0 licence, as listed for the QwenLM/qwen-code project. Check the licence text in the source repository for the terms that apply to your use.

What do I need to use this skill?

The skill page lists no specific requirements, does not run scripts and does not use the network. You need an agent environment that loads skills from the locations described above.

Where do I install the skill?

Unzip it into ~/.claude/skills/ for personal use, into a project's .claude/skills/ folder for one project, or upload it under Settings → Capabilities → Skills in the Claude apps.

Does the skill create files in my project?

Yes, for bugs expected to take more than one round. The method asks the agent to create a side note file in the project's notes location, so skip the skill if your project forbids side note files.

When should I not use this skill?

Avoid it for simple, obvious bugs where a quick fix is enough, because the multi-step process adds overhead. It is also a poor fit for projects that forbid agents from creating notes files.

How does it compare with just asking the agent to fix the bug?

A plain request often leads to a first guess and a fix. This skill asks the agent to test a stated hypothesis with data before changing code, which suits bugs where earlier attempts failed.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

Use this skill if you work on flaky tests, intermittent failures or behaviour that seems impossible, or if your agent keeps trying random fixes after one failure. Skip it for simple bugs or in projects that do not allow agents to write notes files, since the process adds overhead.

Download the skill