defense-in-depth

Adds validation at entry, business logic, environment and debug layers to prevent invalid data bugs.

19|4|Updated Dec 23, 2021
One-click install
npx skills add https://github.com/raas-dev/configent --skill defense-in-depth
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: defense-in-depth
Source: https://github.com/raas-dev/configent/tree/main/etc/claude-code/skills/defense-in-depth
Command: npx skills add https://github.com/raas-dev/configent --skill defense-in-depth

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill ensures that bugs caused by invalid data are structurally impossible by mandating validation at every layer data passes through, preventing single points of failure and ensuring robust system behavior.

Core Features & Use Cases

  • Four Layers of Validation: Guides adding checks at entry point, business logic, environment guards, and debug instrumentation for comprehensive protection.
  • Structural Bug Prevention: Ensures that even if one validation is bypassed, subsequent layers catch the invalid data, making bugs nearly impossible to reproduce.
  • Comprehensive Data Flow Protection: Applies to any data passing through multiple system components, securing your entire application.
  • Use Case: When a bug is found due to invalid data (e.g., an empty directory causing git init in the wrong place), use this skill to add validation at every point the data is used, making the bug impossible to reproduce and preventing future regressions.

Quick Start

Layer 1: Entry Point Validation

function createProject(name, workingDirectory) { if (!workingDirectory || workingDirectory.trim() === '') { throw new Error('workingDirectory cannot be empty'); }

...

}

Layer 2: Business Logic Validation

function initializeWorkspace(projectDir, sessionId) { if (!projectDir) { throw new Error('projectDir required'); }

...

}

Layer 3: Environment Guards

async function gitInit(directory) { if (process.env.NODE_ENV === 'test') { # Refuse git init outside temp dir during tests }

...

}

Layer 4: Debug Instrumentation

async function gitInit(directory) { logger.debug('About to git init', { directory, cwd: process.cwd() });

...

}