Skip to content
Agentmart
Submit a tool

debug

Use when encountering any bug, test failure, unexpected behavior, or performance regression — before proposing any fix.

Skill by AbdurRafay2004

IndexedMIT★ 4
Write a review

Chalk Labs

Need help deploying debug?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/abdurrafay2004-debug

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Use when encountering any bug, test failure, unexpected behavior, or performance regression — before proposing any fix. Root-cause discipline plus a feedback-loop method; applies at every tier.

Use cases: testing

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/debug

What's inside

Skill name
debug
Description
Use when encountering any bug, test failure, unexpected behavior, or performance regression — before proposing any fix. Root-cause discipline plus a feedback-loop method; applies at every tier.
License
MIT
Instructions
215 lines in SKILL.md · view on GitHub

Files (4)

  • SKILL.md
  • condition-based-waiting.md · references/
  • defense-in-depth.md · references/
  • root-cause-tracing.md · references/

SKILL.md (first lines)

# Debug

Part of the **Build/Verify** phases — see the `workflow` skill for tiers and sequencing.

Random fixes waste time and create new bugs. Quick patches mask underlying issues.

**The Iron Law: NO FIXES WITHOUT ROOT-CAUSE INVESTIGATION FIRST.**

Use for any technical issue — test failures, production bugs, unexpected behavior,
performance problems, build failures, integration issues. Especially when under
time pressure, when "just one quick fix" seems obvious, or when previous fixes
didn't work. Debugging discipline is tier-independent: a T1 bug still gets a root
cause (the process is fast for simple bugs).

## Phase 0 — Read the local context

Before exploring, read the nearest `CONTEXT.md` and `.handoff/` state if they
exist — a correct mental model of the modules involved beats an hour of tracing.

## Phase 1 — Build a feedback loop

**This is the skill; everything else is mechanical.** A **tight** pass/fail
signal that goes red on *this* bug is what bisection, hypotheses, and
instrumentation all consume. Without one, no amount of staring at code helps.
Spend disproportionate effort here.

Ways to construct one, roughly in order:

1. **Failing test** at whatever seam reaches the bug — unit, integration, e2e.
2. **Curl / HTTP script** against a running dev server.
3. **CLI invocation** with a fixture input, diffing stdout against known-good.
4. **Headless browser script** (Playwright) — drives the UI, asserts on DOM/console/network.
5. **Replay a captured trace** — save a real request/payload/event log, replay it in isolation.
6. **Throwaway harness** — minimal subset of the system exercising the bug path.
7. **Property/fuzz loop** — for "sometimes wrong output", run 1000 random inputs.
8. **Bisection harness** — bug appeared between two known states? Automate the check and `git bisect run` it.
9. **Differential loop** — same input through old vs new version, diff outputs.

Then **tighten it**: faster (cache setup, narrow scope), sharper (assert the
exact symptom, not "didn't crash"), deterministic (pin time, seed RNG, isolate
filesystem). A 2-second deterministic loop is a debugging superpower; a
30-second flaky one is barely better than none.

**Non-deterministic bugs:** raise the reproduction rate, don't chase a clean
repro — loop the trigger 100×, add stress, narrow timing windows. A 50%-flake
is debuggable; 1% is not.

**Loop criteria before proceeding:** red-capable (catches this specific bug),
deterministic, fast (seconds), runnable unattended — and you have run it at
least once. If you're reading code to build a theory before this exists, stop:
jumping straight to a hypothesis is the exact failure this skill prevents.

**Genuinely can't build one?** Say so explicitly, list what you tried, and ask
the user for a reproducing environment, a captured artifact (HAR, log dump,
recording), or permission to add temporary instrumentation. Don't hypothesize
without a loop.

## Phase 2 — Reproduce, minimise, investigate

Run the loop; watch it go red. Confirm it produces the failure **the user
described** — not a nearby different failure. Wrong bug = wrong fix.

**Minimise:** shrink to the smallest scenario that still goes red, cutting
inputs/callers/config one at a time and re-running after each cut. Done when
every remaining element is load-bearing. The minimal repro shrinks the
hypothesis space and becomes the regression test later.

**Investigate:**
- **Read error messages carefully** — stack traces completely; they often
  contain the exact answer. Note line numbers, paths, error codes.
- **Check recent changes** — git diff, recent commits, new dependencies,
  config or environment differences.
- **Multi-component systems** (CI → build → deploy, API → service → DB): before
  proposing anything, instrument each component boundary — log what enters and
  exits each layer, verify config propagation — run once, and let the evidence
  show WHERE it breaks before investigating WHY.
- **Error deep in the call stack?** Trace backward to the original trigger —
  see `references/root-cause-tracing.md`. Fix at the source, not the symptom.

**Pattern signatures** — check the symptom against known cause families first:

| Signature | Likely family — where to look |
|-----------|-------------------------------|
| Intermittent, timing-dependent | Race condition — concurrent access to shared state |
| Type/nil errors on values that "can't" be nil | Null propagation — missing guards on optionals |
| Inconsistent data, partial updates | State corruption — transactions, callbacks, hooks |
| Timeouts, unexpected response shapes | Integration failure — external calls, service seams |
| Works locally, fails in staging/prod | Configuration drift — env vars, flags, DB state |
| Old data, fixed by a cache clear | Stale cache — Redis, CDN, browser, framework cache |

## Phase 3 — Hypothesise (plural)

Generate **3–5 ranked hypotheses** before testing any. Single-hypothesis
generation anchors on the first plausible idea.

Each must be **falsifiable**: "If X is the cause, then changing Y will make the
bug disappear." If you can't state the prediction, it's a vibe — discard or
sharpen.

**Show the ranked list to the user before testing.** They often have domain
knowledge that re-ranks instantly ("we just deployed a change to #3"). Cheap
checkpoint; don't block on it if they're away.

Also compare against working examples: find similar code that works in the same
codebase, read reference implementations completely (don't skim), and list every
difference, however small — don't assume "that can't matter."

> A broad search for those examples (vs. a couple of targeted greps) is a
> delegate trigger — ask the user delegate-or-inline first (`delegate` skill).

## Phase 4 — Instrument and test hypotheses

- Each probe maps to a specific prediction. **One variable at a time.**
- Prefer a **debugger/REPL breakpoint** over logs; targeted logs at the
  boundaries that distinguish hypotheses over "log everything and grep".
- **Tag every debug log** with a unique prefix (e.g. `[DEBUG-a4f2]`) — cleanup
  becomes a single grep. Untagged logs survive; tagged logs die.
- **Performance regressions:** logs are usually wrong. Establish a baseline
  measurement (timing harness, profiler, query plan), then bisect. Measure

From AbdurRafay2004/handoff, MIT.

More from AbdurRafay2004/handoff

Signals

Stars
4
Forks
0
Open issues
0
Last commit (this folder)
Jul 11, 2026 (3 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from AbdurRafay2004

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get debug running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying debug?

CallGet help
Cite this page

debug skill. Agent Mart. https://agentmart.dev/skills/abdurrafay2004-debug (last updated 2026-10-24)