# Debug

> Systematic debugging when a failure's cause is unknown: reproduce first, isolate, fix the root cause once, prove it with a regression test. Use when a bug, crash, failing test or wrong output has no obvious cause, when a fix attempt did not work, or before claiming a stubborn bug fixed. For production incidents: stabilize first per `maintain`, then run this loop.

- **Type:** Skill
- **Install:** `agentstack add skill-tradebaas-groundwork-debug`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [Tradebaas](https://agentstack.voostack.com/s/tradebaas)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [Tradebaas](https://github.com/Tradebaas)
- **Source:** https://github.com/Tradebaas/Groundwork/tree/main/.agents/skills/debug
- **Website:** https://tradebaas.github.io/Groundwork/

## Install

```sh
agentstack add skill-tradebaas-groundwork-debug
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# debug: from symptom to proven root cause

A fix you never saw fail is a guess (`verify`). This loop turns an unknown failure into a
proven fix at the lowest cost. Production incident? Stabilize first per `maintain` (rollback
beats diagnosis under fire), then run this loop calmly.

## The loop

1. **Read the actual error.** The message, the stack, the failing line. Capture expected vs
   actual behavior verbatim before touching anything: the error usually says more than the
   first theory about it.
2. **Reproduce before fixing.** A failing automated test at the nearest seam is the goal; a
   minimal script is the fallback. Shrink the repro until removing anything makes the bug
   disappear. What you cannot reproduce you cannot fix, only disturb.
3. **Check what changed.** Most bugs live in the newest diff: recent commits, dependency
   bumps, config or environment changes. `git bisect` beats rereading the whole system.
4. **Hypothesize, test one change at a time.** Rank hypotheses by likelihood and cost of
   testing; each experiment changes exactly one thing and names its predicted outcome before
   running. Two simultaneous changes make the result unreadable. Expect horses, not zebras:
   the common cause outranks the exotic one until evidence says otherwise.
5. **Fix the root cause, once.** The fix goes where the cause lives, not where the symptom
   showed (decision ladder: understand, then fix the cause once). A symptom patch that leaves
   the cause in place is not progress, and per debug hygiene a change that demonstrably fixed
   nothing gets reverted, not left in.
6. **Prove and clean.** The repro test passes and stays as the regression test; every debug
   shim (prints, sleeps, forced branches, commented-out calls) is removed; the full gate
   chain runs green.

## On a platform stack

When the stack file's header declares a hosted platform, steps 2 and 3 keep their intent and
change their instrument; the rest of the loop is unchanged. Reproduce in a real dev environment,
against the platform's own record of the failure - run history, execution logs, the audit trail -
and with its test tooling where the platform has any. For what changed, the platform keeps its
own history: solution layers and version history, the audit log of who edited what, and the
vendor's release notes for the change nobody in the project made. That is the bisect equivalent,
and it reaches one thing bisect cannot - an edit made directly in the platform editor that never
became a commit.

## Record

A non-obvious cause is lesson material: one gotcha line in STATE.md's log, so the next
session skips the dead end. For production incidents, the ten-line post-mortem belongs to
`maintain`. ⚓

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [Tradebaas](https://github.com/Tradebaas)
- **Source:** [Tradebaas/Groundwork](https://github.com/Tradebaas/Groundwork)
- **License:** MIT
- **Homepage:** https://tradebaas.github.io/Groundwork/

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-tradebaas-groundwork-debug
- Seller: https://agentstack.voostack.com/s/tradebaas
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
