How Claude Code Debugs and Repairs Code: the Verification Stack
A practical toolkit and flow for pairing Claude Code with the right tools to trace failures, find the root cause, repair the codebase, and prove the fix actually works.
The hard part of a fix isn't writing it — it's proving it
When a build breaks, an AI coding agent like Claude Code can propose a repair in seconds. The real work is finding the actual cause and verifying that the change fixed it without breaking something else. These are not AI tools — they are the standard engineering toolkit that makes an AI-proposed fix trustworthy. Point Claude Code at them and you get a repair loop you can actually rely on.
The recovery flow:
broken build → dependency graph → root cause → AST repair → affected rebuild → tests → security scan → verified patch
Trace the damage
- dependency-cruiser — map dependencies and detect architectural violations.
- Madge — expose circular dependencies and module relationships.
- Knip — find unused files, exports, and dependencies.
- ts-morph — inspect and modify TypeScript code structurally.
Find the root cause
- TypeScript — catch unresolved imports and type errors.
- ESLint — detect code problems through configurable rules.
- Semgrep — identify risky code patterns with static analysis.
- ast-grep — search and rewrite code using AST patterns.
Repair the codebase
- jscodeshift — automate large code transformations.
- Comby — rewrite code using structural matching.
- Biome — lint and format code consistently.
- Renovate — automate dependency updates.
Rebuild only what changed
- Nx — identify affected projects and run their tasks.
- Turborepo — coordinate builds with task caching.
- Dagger — create reproducible build and test pipelines.
- Bazel — build and test large projects with precise dependency tracking.
Prove the fix works
- Vitest — run automated tests and catch regressions.
- Playwright — verify real browser behavior after changes.
- StrykerJS — mutation-test the tests themselves.
- CodeQL — detect security vulnerabilities through code analysis.
Three repair stacks worth stealing
- Import failures: dependency-cruiser → Madge → ts-morph → TypeScript
- Large refactors: Semgrep → ast-grep → jscodeshift → Nx → Vitest
- Production recovery: Renovate → Dagger → Playwright → CodeQL
An honest word
Claude Code can investigate a failure and propose a repair, but these tools are how you confirm what actually changed — the dependency graph shows the blast radius, the tests and mutation tests prove behavior, and the security scan catches what a fast fix might introduce. Don't merge an AI-generated patch on trust alone; let the graph, the tests, and the scan back it up. That is the difference between "it compiles" and "it's fixed."
Pairing these with ready-made agents and skills? See our hand-picked Claude Code agents, skills & plugins.