defense-in-depth

Add validation at every data layer to prevent invalid input bugs.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/Theopsguide/claude-agents --skill defense-in-depth-theopsguide
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: defense-in-depth
Source: https://github.com/Theopsguide/claude-agents/tree/main/plugins/debugging/skills/defense-in-depth
Command: npx skills add https://github.com/Theopsguide/claude-agents --skill defense-in-depth-theopsguide

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill addresses the fragility of single-point validation by advocating for validation at every layer data passes through. This makes bugs caused by invalid data structurally impossible, preventing bypasses from different code paths, refactoring, or mocks, and significantly increasing system robustness and reliability.

Core Features & Use Cases

  • Entry Point Validation: Reject obviously invalid input at the API or function boundary.
  • Business Logic Validation: Ensure data makes sense for the specific operation being performed.
  • Environment Guards: Prevent dangerous operations in specific contexts (e.g., refusing git init outside temp directories in tests).
  • Debug Instrumentation: Capture context (stack traces, environment variables) for forensic analysis when other layers fail.
  • Use Case: After fixing a bug where an empty directory caused a system failure, apply this Skill to add validation at the API entry point, within the business logic, as an environment guard for tests, and with debug logging, ensuring that an empty directory can never again lead to a critical error.

Quick Start

Example: Entry Point Validation

function createProject(name: string, workingDirectory: string) { if (!workingDirectory || workingDirectory.trim() === '') { throw new Error('workingDirectory cannot be empty'); } if (!existsSync(workingDirectory)) { throw new Error(workingDirectory does not exist: ${workingDirectory}); } if (!statSync(workingDirectory).isDirectory()) { throw new Error(workingDirectory is not a directory: ${workingDirectory}); }

... proceed

}