targeted-debug
Skill2 starsChanged 3 months agoMITView on GitHub
Use when the user pastes a stack trace, traceback, panic, crash log, or error message with
In this repository46 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/commit-conventions.mdcCursor rule
- .cursor/rules/cross-platform-handoff.mdcCursor rule
- .cursor/rules/dev-files-workspace.mdcCursor rule
- .cursor/rules/documentation-standards.mdcCursor rule
- .cursor/rules/gh-cli-preference.mdcCursor rule
- .cursor/rules/github-repository-policy.mdcCursor rule
- .cursor/rules/git-worktree-agent-workflow.mdcCursor rule
- .cursor/rules/hooks-guide.mdcCursor rule
- .cursor/rules/plugin-structure.mdcCursor rule
- .cursor/rules/plugin-version-bump.mdcCursor rule
- .cursor/rules/skill-frontmatter.mdcCursor rule
- .cursor/rules/skill-quality-standards.mdcCursor rule
- .cursor/rules/skills-guide.mdcCursor rule
- .cursor/rules/user-facing-script-standards.mdcCursor rule
- run-tamirs-superpowersSkill
- field-notebook-uiSkill
- diagnose-refusalSkill
- decisionSkill
- deliver-devSkill
- diagnose-objectiveSkill
- orchestrate-devSkill
- plan-devSkill
- pr-devSkill
- start-devSkill
- switch-devSkill
- worker-devSkill
- changelog-reviewSkill
- dark-terminal-docSkill
- docs-reviewSkill
- platform-syncSkill
- mcp-builderSkill
- mcp-paginationSkill
- cleanupSkill
- github-policySkill
- multi-agent-repoSkill
- repo-scaffoldSkill
- repo-standardsSkill
- capture-configSkill
- find-skillSkill
- notify-setupSkill
- retroSkill
- session-reportSkill
- skill-creatorSkill
- usage-captureSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 7 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
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 102
Run the extractor (or extract manually if the trace is trivial):
- Distinctive: line 186
When an orchestrator asks for machine-readable output, emit the same fields as JSON and nothing else:
- Distinctive: line 216
never widen scope to "win" against a competing diagnosis.
- Very specific: line 234
No
Grepoutside in-scope files: Do not grep the whole repo for the exception class or method name. - Distinctive: line 235
No external tool calls: No observability, chat, issue-tracker, or GitHub MCP queries.
- Distinctive: line 238
No delivery: Never commit, push, or open a PR.
- Distinctive: line 256
Never: add speculative root causes to the report that aren't supported by in-scope evidence.
- Distinctive: line 260
If the user's question is genuinely "something's broken, I don't know where" with no concrete stack trace or file reference, that's a full …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Targeted Debug
Scope-bounded debugging. Reads only files explicitly named in the stack trace or by the user. Forms a hypothesis from observable evidence. Does NOT explore the codebase broadly. Does NOT launch a full investigation pipeline.
Find the repo root with git rev-parse --show-toplevel. If git is unavailable, treat every path as relative to the working directory and say so in the report rather than guessing a root.
Why this skill exists
When a stack trace or error message is already in hand, broad codebase exploration adds noise without improving signal. A full investigation session is for "I don't know what's happening" — this skill is for "here's the crash, tell me why." The strict scope constraint (read only what's named) is what makes it fast, token-efficient, and precise.
Path extraction (use the bundled script)
A deterministic path extractor is available at scripts/extract-error-paths.sh. Run it on the raw stack trace to get the exact file list — no manual parsing needed:
# From the repo root — feed a stack trace file to the extractor
bash scripts/extract-error-paths.sh < stacktrace.txt
# Or pass it inline
bash scripts/extract-error-paths.sh "at Foo.bar(Foo.java:42) caused by NullPointerException"Output is one path per line, sorted, deduplicated. Use this list as your in-scope file set.
Recognized trace shapes:
| Language | Example frame | Extracted path |
| Java/Scala | at Foo.bar(Foo.scala:42) | Foo.scala |
| JavaScript | at Object.<anon> (/repo/lib/foo.js:12:7) | /repo/lib/foo.js |
| Python | File "/repo/src/parser.py", line 87, in parse | /repo/src/parser.py |
| Bash | script.sh: line 42: | script.sh |
| Rust | at src/handlers/payment.rs:91:42 | src/handlers/payment.rs |
| Go | \t/app/services/order.go:114 +0x1c2 | /app/services/order.go |
| Generic (Vim) | path/to/file.py:42 | path/to/file.py |
Vendor/stdlib exclusion: The extractor automatically suppresses paths from ~/.cargo/, the Go cache under ~/go/pkg/, /usr/local/go/src/, and node_modules/. If a trace mixes project files with runtime internals, only project-source paths remain in the output.
For language-specific panic patterns and scope rules (Rust unwrap, Go nil pointer, Bash set -u), see references/language-patterns.md.
Workflow
1. Parse input and build the in-scope file set
Accept one or more of: pasted stack trace, error signature, explicit file paths, issue description with a concrete error.
Run the extractor (or extract manually if the trace is trivial):
# resolve relative paths against repo root
git rev-parse --show-toplevelIn-scope files = files the user named + files the extractor found in the trace. That's the complete list — nothing else.
2. Hypothesize from the trace ALONE (before reading any file)
State in chat: the thrown exception, the frame that threw it, the call chain leading to it. This step forces reasoning from the evidence already provided before adding new evidence.
Example hypothesis statement:
"The
NullPointerExceptionis thrown atUserService.java:142. The chain shows it was called fromOrderController.java:88. My hypothesis: a nullUserobject is being dereferenced — eitherfindUser()returned null and the caller didn't check."
3. Read only the in-scope files (targeted sections)
For each file, read the section relevant to the stack frame — the failing function and its immediate local callers within the same file. Do not read entire 1000-line files.
# Confirm the file exists before reading
ls -la path/to/File.java
# Check git blame on the failing lines to see when they changed
git log -n 5 --oneline -- path/to/File.java
git blame -L 138,148 path/to/File.java4. Refine the hypothesis
Combine trace evidence with code evidence. Three outcomes:
| Outcome | Meaning | Next step |
| Confirmed | Code clearly produces the observed error | Report root cause + fix |
| Refined | Trace was misleading; real cause is upstream | Report new hypothesis, name ONE additional file (ask user before reading) |
| Insufficient | In-scope files don't reveal a single root cause | Say so explicitly — name what additional evidence is needed |
5. Produce the structured diagnosis
The diagnosis is a structured finding, in the same shape every reviewer role in this
framework emits (core/roles/reviewer.md). That is deliberate: an orchestrator merging a
debugger's output with a reviewer's, a security reviewer's and a test engineer's must not
need a special case for this skill.
## Hypothesis (from stack trace, before reading code)
<one paragraph from step 2>
## Finding
| Field | Value |
|-------|-------|
| severity | critical \| high \| medium \| low |
| confidence | high \| medium \| low |
| files | <path:line>, <path:line> — in-scope files only |
| evidence | <the specific lines / signatures that confirm or refute the hypothesis> |
| recommended_fix | <the smallest concrete change, with file:line> |
| blocking | true \| false |
## Root cause
<the proximate cause — one sentence. If undetermined, write "undetermined" and set
confidence to low. Never invent one to fill the field.>
## Out-of-scope follow-ups
- <file NOT read but potentially relevant> — <one-line justification>
- Whether a broader investigation session is now warrantedField discipline:
- severity describes the defect's impact on the system, not how hard it was to find.
- confidence is about this diagnosis being correct. An "Insufficient" outcome in step 4
means
confidence: lowandroot cause: undetermined— it does not mean guessing harder. Low confidence stated plainly is a useful result; a confident wrong answer is not. - blocking is
truewhen the diagnosis names a defect that must be fixed before delivery,falsewhen it is a follow-up. Aconfidence: lowfinding is neverblocking. - files may only contain in-scope paths. Anything else goes under out-of-scope follow-ups.
The "Out-of-scope follow-ups" section is the escape hatch — list what you would read next if the user wants to go deeper. Do not silently cross the boundary.
Emitting machine-readable findings
When an orchestrator asks for machine-readable output, emit the same fields as JSON and nothing else:
{
"role": "debugger",
"severity": "high",
"confidence": "medium",
"files": ["src/handlers/payment.rs:91"],
"evidence": "unwrap() on a None returned by lookup_account() at line 88",
"recommended_fix": "replace unwrap() with a match that propagates the missing-account error",
"blocking": true,
"root_cause": "lookup_account returns None for closed accounts; the caller assumes Some",
"out_of_scope": ["src/db/accounts.rs — owns the None case, not read"]
}The scope rules apply unchanged in this mode.
Running under an orchestrator
This skill is a worker, and it composes with orchestration without loosening a single scope rule.
Competing diagnoses are supported and encouraged. An orchestrator may dispatch several independent instances of this skill against the same trace — different in-scope seeds, different hypotheses — and compare the structured findings. Each instance must:
- reason only from its own assigned scope, and never read another instance's output;
- report its own
confidencehonestly, including when it reachesundetermined; - never widen scope to "win" against a competing diagnosis.
Convergent independent findings are the signal an orchestrator is buying. Findings contaminated by cross-reading are worth nothing, so the isolation is the whole point.
Where subagents are unavailable (subagents capability absent), run sequentially in the
same session: complete and record one diagnosis, then start the next from the original trace
without reference to the first. State in the report that the diagnoses were sequential, so
the orchestrator knows they are less independent than parallel ones — do not present them as
if they had been isolated.
Never does this skill open a PR, commit, or apply a fix. It ends at a structured finding and hands off; delivery belongs to the integrator (spec §2.4).
Hard rules
- Read only what's named. In-scope = files the user named + files in the stack trace. Nothing else without asking.
- No
Globfor unrelated paths.Globis allowed only to resolve the exact paths from rule 1 (e.g., when the path is partial or relative). - No
Grepoutside in-scope files. Do not grep the whole repo for the exception class or method name. - No external tool calls. No observability, chat, issue-tracker, or GitHub MCP queries. This skill is offline. If the user wants those, they should ask explicitly.
- No pipeline launch. This skill does NOT invoke any broader investigation orchestrator. It stops at the evidence boundary and surfaces what it found. Being dispatched by an orchestrator is fine; dispatching one is not.
- Stop and ask if scope must expand. If analysis genuinely cannot proceed without reading a new file, ask — don't quietly read 10 more files. Under an orchestrator with no interactive user, do not expand: report
confidence: lowwith the file you would have needed listed under out-of-scope follow-ups. - No delivery. Never commit, push, or open a PR. The output is a finding.
What NOT to do
# WRONG — reading tests to "understand normal behavior"
Read /repo/tests/test_user_service.py
# WRONG — grepping the repo for the exception class
Grep "NullPointerException" /repo/src/
# WRONG — reading all files under the failing package
Glob "/repo/src/services/*.java"
# WRONG — reading node_modules, dist/, or generated code
Read /repo/dist/bundle.jsNever add speculative root causes to the report that aren't supported by in-scope evidence. If you don't know, say so.
When to escalate
If the user's question is genuinely "something's broken, I don't know where" with no concrete stack trace or file reference, that's a full investigation session — not this skill. Tell them:
"I need a concrete error message or stack trace to run targeted-debug. If you don't have one, a broader investigation session would be the right tool."
Signal phrases that belong in a full investigation: "something's broken," "it's not working," "check everything," "find the bug" (without a trace), "why is the app slow" (without a specific span/trace).
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.

