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/0adf49a8ae84b0ff6e2de8759eea43257e020eff/src/skills/defense-in-depth/SKILL.md at commit 0adf49a8ae84b0ff6e2de8759eea43257e020eff. 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 | 7 | 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.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
event4u-app/agent-config
Use when the user says "review the design", "check the UI", or wants a comprehensive UI/UX review. Uses a 7-phase methodology covering interaction, responsiveness, accessibility, and more.
K-Dense-AI/scientific-agent-skills
Distributed computing for larger-than-RAM pandas/NumPy workflows. Use when you need to scale existing pandas/NumPy code beyond memory or across clusters. Best for parallel file processing, distributed ML, integration with existing pandas code. For out-of-core analytics on single machine use vaex; for in-memory speed use polars.
K-Dense-AI/scientific-agent-skills
Use NeuroKit2 to build or audit reproducible research workflows for physiological time-series preprocessing, event/interval analysis, multimodal alignment, variability, and complexity. Trigger when code imports neurokit2 or needs its current APIs, schemas, and method-aware validation—not for diagnosis or device validation.