Defense in Depth

Use when implementing validation or safety checks. Multi-layer validation approach prevents bugs through redundant safeguards. Makes bugs structurally impossible.

8 stars 3 forksOther Plugin marketplace

Install

Claude Code plugin
/plugin marketplace add Freddy-CHEN-ux/00_claude_skills

The repo is a Claude Code plugin marketplace. Run /plugin afterwards to pick the plugin that includes this skill.

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add Freddy-CHEN-ux/00_claude_skills --skill defense-in-depth
Manual install
git clone --depth 1 https://github.com/Freddy-CHEN-ux/00_claude_skills.git /tmp/00_claude_skills
mkdir -p ~/.claude/skills
cp -r /tmp/00_claude_skills/skills/defense-in-depth ~/.claude/skills/defense-in-depth

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# Defense in Depth

## Core Principle

**Make bugs structurally impossible through multiple independent layers of validation.**

## Overview

Single-layer protection is insufficient. Defense in depth adds multiple independent validation layers so that if one fails, others catch the problem. Different code paths require different validations.

## When to Use This Skill

- Implementing data validation
- Adding safety checks
- Preventing invalid state bugs
- Handling user input
- Processing external data
- Critical operations that must not fail

## The Four Layers

### Layer 1: Entry Point Validation

**Purpose:** Reject bad input at API boundaries

**Where:** Controllers, API endpoints, function entry points

**What to validate:**
- Type correctness
- Required fields present
- Format validity (email, phone, etc.)
- Basic constraints (min/max, length)

**Example:**
```php
// Laravel Controller
public function createUser(Request $request)
{
    // Layer 1: Entry point validation
    $validated = $request->validate([
        'email' => 'required|email|max:255',
        'password' => 'required|min:8',
        'age' => 'required|integer|min:18',
    ]);

    // Continue with business logic...
}
```

### Layer 2: Business Logic Validation

**Purpose:** Enforce operational requirements

**Where:** Service classes, domain logic

**What to validate:**
- Business rules
- State transitions
- Relationships
- Domain constraints

**Example:**
Read the full skill on GitHub

Details

Skill name
defense-in-depth
Path
skills/defense-in-depth/SKILL.md
Repo updated
10 January 2026

FAQ

What does the Defense in Depth skill do?

Use when implementing validation or safety checks. Multi-layer validation approach prevents bugs through redundant safeguards. Makes bugs structurally impossible.

How do I install the Defense in Depth skill?

Claude Code plugin: /plugin marketplace add Freddy-CHEN-ux/00_claude_skills. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Defense in Depth popular?

It lives in Freddy-CHEN-ux/00_claude_skills, which has 8 GitHub stars and 3 forks.

Related skills

Browse the most popular Claude skills, all other skills, or write your own with the skills generator.