Defense-in-Depth Validation

Add validation at every layer data passes through to make bugs structurally impossible.

Updated Dec 4, 2025
One-click install
npx skills add https://github.com/dallascrilley/dowser --skill defense-in-depth-validation-dallascrilley
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: Defense-in-Depth Validation
Source: https://github.com/dallascrilley/dowser/tree/main/skills/defense-in-depth
Command: npx skills add https://github.com/dallascrilley/dowser --skill defense-in-depth-validation-dallascrilley

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Fixing a bug with a single validation check leaves the door open for the same invalid data to slip through other code paths, mocks, or refactors. This Skill guides you to place validation at every layer data traverses so the bug becomes structurally impossible rather than merely patched. ## Core Features & Use Cases - Four-Layer Validation Pattern: Entry point validation, business logic validation, environment guards, and debug instrumentation, each catching cases the others miss. - Systematic Bug Analysis: Trace the data flow from origin to failure point, map every checkpoint, and add targeted checks at each one. - Use Case: A test passes an empty projectDir that causes git init to run in the wrong directory. Apply the pattern to validate at Project.create, WorkspaceManager, and WorktreeManager layers, plus stack-trace logging, so no code path can reproduce the bug. ## Quick Start Ask the AI to apply defense-in-depth validation to a bug where invalid data caused a failure deep in the call stack.

Frequently Asked Questions about Defense-in-Depth Validation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent invalid data from causing bugs deep in the call stack?▼

Add validation at every layer the data passes through: entry point checks, business logic validation, environment guards, and debug instrumentation. Each layer catches cases the others miss, making the bug structurally impossible.

What is defense-in-depth validation in software debugging?▼

Defense-in-depth validation is a pattern where you place checks at multiple layers of the data flow instead of a single fix. Entry validation catches most bugs, business logic catches edge cases, environment guards block context-specific dangers, and debug logging aids forensics.

Why is one validation check not enough to fix a bug?▼

A single check can be bypassed by different code paths, mocks in tests, or later refactoring. Multiple layers ensure that even if one check is skipped, another catches the invalid data before it causes damage.

Does defense-in-depth validation work in any programming language?▼

Yes, the pattern is language-agnostic and applies to any codebase. The examples use TypeScript, but the four layers of entry validation, business logic, environment guards, and debug instrumentation translate to any stack.

When should I use environment guards in testing?▼

Use environment guards to prevent dangerous operations in specific contexts, such as refusing git init outside temp directories during test runs. They protect against context-specific risks that entry and business logic validation cannot anticipate.