Best for
- Bug fix where invalid data caused failure several frames deep.
- New entry point that funnels external input into existing internals.
- Refactor that adds a second caller to a previously single-caller routine.
event4u-app/agent-config/src/skills/defense-in-depth/SKILL.md
Use when validation needs entry, business-logic, environment, and instrumentation guards so a bad value cannot reach the failure point — turns a local bug fix into a structural one.
Decision brief
Validate at every layer the value passes through. Fixing the bug at one layer is locally sufficient and globally fragile — the next refactor, code path, mock, or platform edge case will rediscover it. Four-layer validation makes the bug structurally impossible.
Compatibility matrix
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/event4u-app/agent-config --skill "src/skills/defense-in-depth"Inspect the Agent Skill "defense-in-depth" from https://github.com/event4u-app/agent-config/blob/6a5670b7881a676c0da90d2afb950298087c4ccb/src/skills/defense-in-depth/SKILL.md at commit 6a5670b7881a676c0da90d2afb950298087c4ccb. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
1. Identify where the bad value originates (test fixture, request body, env var, config). 2. List every function that receives the value before the failure point. 3. Mark which functions are reachable from production paths and which only from tests.
1. Identify where the bad value originates (test fixture, request body, env var, config). 2. List every function that receives the value before the failure point. 3. Mark which functions are reachable from production paths and which only from tests.
Reject obviously invalid input at the API / route / command boundary. In Laravel this is FormRequest rules; in Express a zod-validated middleware; in pure services it is the public method on the service.
Verify the value still makes sense for the operation that consumes it. Different code paths can reach the same internal — re-check rather than trust the caller.
Refuse dangerous operations in the wrong context — most often: running a destructive command outside a test temp dir while the test suite is active.
Permission review
No configured static risk pattern was detected
This is not proof of safety. Runtime behavior, indirect dependencies, and hidden external systems are outside the static scan.
Evidence record
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 91/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 9 | Source | Repository attention, not individual Skill quality |
| Compatibility | 0 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
Validate at every layer the value passes through. Fixing the bug at one layer is locally sufficient and globally fragile — the next refactor, code path, mock, or platform edge case will rediscover it. Four-layer validation makes the bug structurally impossible.
Do NOT use when:
laravel-validation.Reject obviously invalid input at the API / route / command boundary. In Laravel this is FormRequest rules; in Express a zod-validated middleware; in pure services it is the public method on the service.
public function createProject(string $name, string $workingDirectory): Project
{
if (trim($workingDirectory) === '') {
throw new InvalidArgumentException('workingDirectory cannot be empty');
}
if (! is_dir($workingDirectory)) {
throw new InvalidArgumentException("workingDirectory does not exist: {$workingDirectory}");
}
if (! is_writable($workingDirectory)) {
throw new InvalidArgumentException("workingDirectory is not writable: {$workingDirectory}");
}
// ... proceed
}
Verify the value still makes sense for the operation that consumes it. Different code paths can reach the same internal — re-check rather than trust the caller.
public function initializeWorkspace(string $projectDir, string $sessionId): Workspace
{
if ($projectDir === '') {
throw new RuntimeException('projectDir required for workspace initialization');
}
// ... proceed
}
Refuse dangerous operations in the wrong context — most often: running a destructive command outside a test temp dir while the test suite is active.
public function gitInit(string $directory): void
{
if (app()->environment('testing')) {
$normalized = realpath($directory) ?: $directory;
$tmp = realpath(sys_get_temp_dir());
if ($tmp === false || ! str_starts_with($normalized, $tmp)) {
throw new RuntimeException("refusing git init outside tmp during tests: {$directory}");
}
}
// ... proceed
}
Capture context for forensics so the next failure surfaces why, not just that. Log only when the call is about to hit an irreversible side effect.
public function gitInit(string $directory): void
{
Log::debug('about to git init', [
'directory' => $directory,
'cwd' => getcwd(),
'trace' => (new Exception)->getTraceAsString(),
]);
// ... proceed
}
Try to bypass Layer 1 (call the internal directly) and confirm Layer 2 catches it. Mock the production guard and confirm Layer 3 still refuses. The pattern only earns its name when each layer is independently provable.
BEFORE adding the 5th guard:
STOP — re-check the data flow.
IF the value crosses ≤ 1 module boundary:
Use a single boundary check + a value-object invariant. Two layers max.
IF every layer would re-implement the same predicate:
Hoist the predicate into a value object / type and inject. One check is enough.
Layers are for distinct concerns: input shape vs operation invariant
vs environment risk vs forensic visibility. Same concern repeated is duplication, not depth.
Log::debug.agents/settings/contexts/skills-provenance.yml (entry: defense-in-depth).non-destructive-by-default, verify-before-complete, skill-quality.Frequently asked questions
Validate at every layer the value passes through. Fixing the bug at one layer is locally sufficient and globally fragile — the next refactor, code path, mock, or platform edge case will rediscover it. Four-layer validation makes the bug structurally impossible.
The source record exposes this install command: npx skills add https://github.com/event4u-app/agent-config --skill "src/skills/defense-in-depth". Inspect the command and pinned source before running it.
Alternatives
coreyhaines31/marketingskills
When the user wants to plan, design, or implement an A/B test or experiment, or build a growth experimentation program. Also use when the user mentions "A/B test," "split test," "experiment," "test this change," "variant copy," "multivariate test," "hypothesis," "should I test this," "which version is better," "test two versions," "statistical significance," "how long should I run this test," "growth experiments," "experiment velocity," "experiment backlog," "ICE score," "experimentation program
alirezarezvani/claude-skills
App Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklist
equinor/neqsim
Engineering deliverable quality — the nine analytical-depth moves (contributor ranking, adjudicating the source document, quantitative rule-outs, robustness crossover, conservatism direction, discriminating test), results.json schema, figure→discussion→linked_results traceability, evidence matrices, assumptions/gaps registers, citation conventions, KaTeX math formatting, units consistency, executive-summary structure, AACE class declaration. USE WHEN: producing a task report, a PEPR/M1/root-caus
JasonColapietro/suede-creator-skills
Suede-owned experimentation discipline for hypotheses, sample sizing, test duration, significance, and repeatable experiment programs. Use when comparing variants, deciding whether a result is reliable, or building an experiment backlog and cadence. NOT FOR: analytics instrumentation (use suede-analytics), post-click conversion diagnosis (use suede-site-alchemy), or writing the variant copy itself (use suede-copy).