Defense in depth validation debugging technique
Defense-in-Depth Validation is a guide in the Superpowers systematic-debugging skill for developers fixing bugs caused by invalid data. Its core rule is to validate at every layer the data passes through, so the bug becomes structurally impossible instead of being blocked at a single check that other code paths can bypass.
What it does
It defines four layers: entry point validation at the API boundary, business logic checks, environment guards that block dangerous actions in certain contexts, and debug logging for when the other layers fail. TypeScript examples show each layer.
How to use it
After finding a root cause, add a check at each layer the bad value crossed, such as refusing git init outside temp directories during tests.
Requirements and limits
It is meant to follow root cause work, not replace it.
More in Guides and the Claude Code library.
What it covers
- Overview
- Why Multiple Layers
- The Four Layers
- Layer 1: Entry Point Validation
- Layer 2: Business Logic Validation
- Layer 3: Environment Guards
- Layer 4: Debug Instrumentation
- Applying the Pattern
- Example from Session
- Key Insight
The full text is in the members library
Book a call and we will give you access to the full Claude Code library: every entry in full, search by meaning, copy and download.
Source and license
Source: https://github.com/obra/superpowers/blob/main/skills/systematic-debugging/defense-in-depth.md
Author: obra, Superpowers skills. License: MIT.