debug-issue
Skill1 starsChanged 18 days agoMITView on GitHub
Diagnose a hard bug or performance regression with a loop that can go red, ranked against the repo's invariants and untested dependents. Triggers — "diagnose", "debug this", or a test or feature that is broken, failing, flaky or slow.
17 other projects use a version of this.
Adopted by
Most recently taken up by
- rumotion/ai-agent-project-templatetheir own version, first seen Nov 1, 2026
- NVIDIA/kumo-enginetheir own version, first seen Oct 20, 2026
- ashvin-to/BaseMemtheir own version, first seen Oct 19, 2026
- rikilamadrid/lorekeepertheir own version, first seen Oct 13, 2026
- Arasz/ai-badgertheir own version, first seen Oct 11, 2026
- glowingkitty/OpenMatestheir own version, first seen Oct 8, 2026
Used with
Projects with it also use explore-codebase, refactor-safely and 7 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
srclightSkillexplore-codebase
This skill should be used when the user asks to "explore this codebase", "understand this project", "give me an overview", "how does this work", "onboard me", "walk me through the architecture", "map the codebase", or any request to understand a codebase's structure, architecture, or design.
Also in 5 projects that use this
srclightSkillrefactor-safely
This skill should be used when the user asks to "refactor", "rename", "move", "change a function signature", "extract a method", "delete unused code", "clean up", or any modification that could break callers or dependents. Provides a pre-change safety checklist using srclight's graph tools to assess blast radius before touching code.
Also in 5 projects that use this
zbruhnkeSkillrefactor-code
Refactor code to improve clarity and maintainability without changing behavior. Use when improving readability, reducing complexity, or eliminating duplication.
Also in 3 projects that use this
DockerSkillreview-changes
Review uncommitted or recently committed documentation changes for correctness, coherence, and style compliance. Use before creating a PR to catch issues. "review my changes", "review the diff", "check the fix before submitting", "does this look right".
Also in 4 projects that use this
xfstudioSkillreverse-engineer
Expert reverse engineer specializing in binary analysis,
Also in 3 projects that use this
SentrySkillcreate-pr
Create pull requests following Sentry conventions. Use when opening PRs, writing PR descriptions, or preparing changes for review. Follows Sentry's code review guidelines.
Also in 4 projects that use this
Other versions17 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 17
- tirth8205/code-review-graph★ 33ksame name
- glowingkitty/OpenMates★ 53same name
- NVIDIA/kumo-engine★ 50same name
- samirpatil2000/skills★ 17same name
- emaraschio/cursor-commands★ 9same name
- phmatray/ai-migration-kit★ 4same name
- phmatray/tagout★ 4same name
- Arasz/ai-badger★ 3same name
- imMamdouhaboammar/get-things-done★ 2same name
- ashvin-to/BaseMem★ 1same name
7 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository43 other files it gives its agents.
- AGENTS.mdAGENTS.md
- core/AGENTS.mdAGENTS.md
- evals/AGENTS.mdAGENTS.md
- index/AGENTS.mdAGENTS.md
- mcp/AGENTS.mdAGENTS.md
- tools/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- architecture-reviewSkill
- audit-notesSkill
- challenge-planSkill
- change-impactSkill
- clarify-requestSkill
- connect-mcpSkill
- create-teamSkill
- daily-planSkill
- define-termsSkill
- design-specSkill
- end-of-day-summarySkill
- handover-notesSkill
- join-teamSkill
- merge-workSkill
- migrate-legacy-engineSkill
- personal-setupSkill
- quick-noteSkill
- register-projectsSkill
- repo-mapSkill
- resolve-conflictsSkill
- resume-workSkill
- retrospectiveSkill
- review-changeSkill
- set-profileSkill
- setup-repoSkill
- story-mapSkill
- suggest-skillsSkill
- summarize-filesSkill
- sync-websiteSkill
- trim-agent-docsSkill
- update-pluginSkill
- weekly-reviewSkill
- whats-changedSkill
- write-agent-docsSkill
- write-area-briefSkill
- write-context-docsSkill
The file
We split this skill into the rules it gives an agent
10 rules. 0 are common, 9 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 16 edited versions we read keep these.
9
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 23
If the redacted material no longer shows the bug, say that and ask for another way in.
- Distinctive: line 66
If you notice you are building a theory from the source and this command does not exist yet, stop and return here.
- Distinctive: line 71
Prefer the earlier options.
- Distinctive: line 106
Run the command and watch it fail.
- Very specific: line 137
Put a unique tag on every temporary log line, for example [DEBUG-a4f2], so one search finds them all at cleanup.
- Distinctive: line 144
Write the regression test first, at a seam that reproduces the real failure: one where the calls run the way they do in production.
- Distinctive: line 154
Run it and confirm it fails, for the reason you expect.
- Distinctive: line 159
Run the test and confirm it passes.
- Distinctive: line 160
Run the step 2 command on the original, unreduced case.
- Distinctive: line 164
Check each before saying the bug is fixed:
“Common” is measured: kept by at least 6 in 10 of the 16 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
/debug-issue — a red command before a theory
For a bug that survived the first read of the code. The work runs in seven steps, and each one ends on a condition you can check. Skipping a step is allowed when you can state the reason.
The order matters more than any single step. Theories formed before there is a command that fails on the bug are cheap to produce and expensive to be wrong about, so the theories come fourth.
Keep secrets out of what you show
You will paste commands, output and captured requests. Replace every credential with <REDACTED>
before it appears. Drive the loop from environment variables so the value never has to be typed
into a command. A captured trace usually carries auth headers; quote the lines that matter and
leave the rest out.
If the redacted material no longer shows the bug, say that and ask for another way in.
1. Orient on what the repo already records
The repo has an index and a context layer; read them before forming any view. Skip this step only
when there is no .cortex/ index.
node "${CLAUDE_PLUGIN_ROOT}/index/cortex-impact.mjs" <suspect files> # dependents, and which of them no test covers
node "${CLAUDE_PLUGIN_ROOT}/index/cortex-review.mjs" <suspect files> # the documents that govern or name these filesTake four things from the output:
- Untested dependents. Bugs collect where nothing runs the code. An uncovered dependent is a place to look first, and it is also where the regression test in step 6 will live.
- Stated invariants. The governing
AGENTS.md,CONTEXT.mdand ADRs often describe the bug directly: "the raw body is required for signature verification", "this must never reach memory". A broken invariant is a suspect with written evidence. - Document and code that disagree. One of them is wrong. Do not assume it is the document.
- Where the file sits.
index.layersgives its depth. A failing depth-0 file puts everything above it in question; a failing entry point rarely implicates the kernel.
Carry these into step 4 as candidates. They are not a diagnosis. A cause read off a document stays a guess until a command fails on it.
2. Get one command that fails on the bug
Most of the effort belongs here. Once a command goes red on this bug and green when it is fixed, bisection, probing and fixing all become mechanical. Without it, reading more code does not converge.
What the command must be
You are done with this step when you have run the command at least once and can show it with its output, redacted, and it is:
- Red on the user's symptom. It exercises the real failing path and checks for the exact behaviour the user reported. "Exits without error" is not a check.
- Repeatable. The same verdict every run, or a known, high failure rate.
- Quick. Seconds.
- Unattended. You can run it yourself, without a person.
If you notice you are building a theory from the source and this command does not exist yet, stop and return here. Step 3 does not start without it.
Where to get one
Prefer the earlier options; use a later one when the earlier ones cannot reach the bug.
- A test that fails, at whichever level reaches the path: unit, integration or end to end.
- An HTTP request,
curlor a short script, against a running dev server. - The CLI run on a fixture, with its output diffed against a known-good copy.
- A headless browser script that drives the page and checks the DOM, console or network.
- A captured request, payload or event log replayed on its own.
- A small harness that boots only the part of the system that reaches the code.
- A property or fuzz run, when the output is only sometimes wrong.
- A script
git bisect runcan drive, when the bug arrived between two known commits. - The same input through two versions or two configurations, with the outputs diffed.
- A script that tells a person what to click and records what they see. Last, because it needs a person, but it still gives the loop a fixed shape and returns its result to you.
Make it worth running a hundred times
Once one exists, improve it before using it. Cut setup time and narrow the scope. Check the exact symptom rather than the absence of a crash. Remove the sources of variation: fix the clock, seed the random number generator, give it its own temporary directory, stub the network. A slow command that fails one run in three will mislead you; a fast one that always agrees with itself will not.
When the bug is intermittent
Aim for a higher failure rate, not a perfect reproduction. Run the trigger in a loop, in parallel, under load, with sleeps added to widen the race window. Fifty percent is workable and one percent is not, so keep pushing the rate up.
When no command is possible
Say so and stop. List what you tried, and ask for one of: an environment where the bug reproduces, a redacted capture of the failure, or permission to add temporary instrumentation. Do not move to theories without the command.
3. Confirm it, then shrink it
Run the command and watch it fail. Check that the failure is the one the user described and not a neighbouring one, since fixing the wrong failure is a common way to close a bug that is still open. Record the exact symptom; step 6 has to show it is gone.
Then remove things one at a time: inputs, callers, configuration, data, steps. Re-run after each removal. Stop when every remaining piece is needed, meaning removing any one of them makes the command pass. The smaller case narrows step 4 and becomes the regression test in step 6.
4. Write down candidate causes, ranked
List three to five causes before testing any of them. Testing the first idea that fits tends to confirm it.
Give each a prediction that could prove it wrong: "if X causes this, changing Y makes the failure go away." A cause with no such prediction cannot be tested; sharpen it or drop it.
A broken invariant found in step 1 goes near the top. It is the only kind of candidate that comes with evidence already written down.
Show the ranked list to the user before you test it. They often know something that reorders it at once, such as a change deployed to the third candidate yesterday, or a cause already ruled out. If they are away, carry on with your own order.
5. Probe one prediction at a time
Each probe tests one prediction from step 4, and changes one thing.
A debugger or REPL is better than logging when the environment has one. Otherwise, log at the boundaries where the candidates would behave differently. Logging everything and searching the output is not a probe.
Put a unique tag on every temporary log line, for example [DEBUG-a4f2], so one search finds them
all at cleanup.
For a performance regression, measure instead of logging: take a baseline, then bisect against it.
6. Fix behind a test that fails for the right reason
Write the regression test first, at a seam that reproduces the real failure: one where the calls run the way they do in production. A test that cannot reproduce the chain of calls that caused the bug will pass whether or not the bug is fixed.
If there is no such seam, report that as a finding. The code's shape is stopping this bug from being pinned down, and that problem will outlast this bug.
Where the seam exists:
- Turn the reduced case from step 3 into a test there.
- Run it and confirm it fails, for the reason you expect. A test that passes before the fix proves nothing. One that fails for some other reason is worse: it will pass after the fix and look like proof. This repo has shipped four assertions that passed for the wrong reason, and each was found only by breaking the code on purpose and watching the test.
- Make the fix.
- Run the test and confirm it passes.
- Run the step 2 command on the original, unreduced case.
7. Close out
Check each before saying the bug is fixed:
- The step 2 command passes on the original case. Run it; do not infer it.
- The regression test passes now and failed before the fix, for the expected reason.
- No
[DEBUG-...]lines remain. Search for the tag. - Temporary harnesses are deleted or clearly labelled as such.
- The commit or PR message states the cause that turned out to be true, so the next person
to touch the code has it. If that contradicts a sentence in
AGENTS.md,CONTEXT.mdor an ADR, correct the sentence in the same change. A bug caused by a wrong document comes back.
Then return to the list from step 4 and mark each candidate confirmed, ruled out (naming the probe that ruled it out) or not tested, and report the list with the fix.
An untested candidate is acceptable when the confirmed cause accounts for every symptom. It is not acceptable when it could change the fix: two causes can produce the same symptom, and fixing one leaves the other. Test it before calling the diagnosis finished, or report it as still open.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

