What problem does it solve?
This Skill prevents bugs caused by invalid data from recurring by mandating validation at every layer data passes through. It ensures that a single fix isn't easily bypassed, making the bug structurally impossible to reintroduce.
Core Features & Use Cases
- Four Layers of Validation: Guides you to add checks at the entry point, business logic, environment guards, and debug instrumentation layers.
- Structural Bug Prevention: Ensures that even if one validation layer is bypassed, others will catch the invalid data, making the system more robust.
- Data Flow Mapping: Requires tracing the data flow and mapping all checkpoints to identify where validation is needed.
- Use Case: When you fix a bug caused by invalid data (e.g., an empty directory causing a
git init failure), use this Skill to add validation at multiple layers. For example, you'd add checks at the API entry point, within the business logic, and as an environment guard for tests, making the bug impossible to reproduce.
Quick Start
Announce skill usage
I'm using the defense-in-depth skill to prevent this bug from recurring.
Example: Entry Point Validation
function createProject(name: string, workingDirectory: string) {
if (!workingDirectory || workingDirectory.trim() === '') {
throw new Error('workingDirectory cannot be empty');
}
... further checks ...
}