Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Use when invalid data causes failures deep in execution, requiring validation at multiple system layers - validates at every layer data passes through to make bugs structurally impossible
.claude/skills/microck-defense-in-depth/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 4% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 14% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 14% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 12% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 35% | 0% |
When you fix a bug caused by invalid data, adding validation at one place feels sufficient. But that single check can be bypassed by different code paths, refactoring, or mocks.
Core principle: Validate at EVERY layer data passes through. Make the bug structurally impossible.
Single validation: "We fixed the bug" Multiple layers: "We made the bug impossible"
Different layers catch different cases:
Purpose: Reject obviously invalid input at API boundary
typescriptfunction createProject(name: string, workingDirectory: string) { if (!workingDirectory || workingDirectory.trim() === '') { throw new Error('workingDirectory cannot be empty'); } if (!existsSync(workingDirectory)) { throw new Error(`workingDirectory does not exist: ${workingDirectory}`); } if (!statSync(workingDirectory).isDirectory()) { throw new Error(`workingDirectory is not a directory: ${workingDirectory}`); } // ... proceed }
Purpose: Ensure data makes sense for this operation
typescriptfunction initializeWorkspace(projectDir: string, sessionId: string) { if (!projectDir) { throw new Error('projectDir required for workspace initialization'); } // ... proceed }
Purpose: Prevent dangerous operations in specific contexts
typescriptasync function gitInit(directory: string) { // In tests, refuse git init outside temp directories if (process.env.NODE_ENV === 'test') { const normalized = normalize(resolve(directory)); const tmpDir = normalize(resolve(tmpdir())); if (!normalized.startsWith(tmpDir)) { throw new Error( `Refusing git init outside temp dir during tests: ${directory}` ); } } // ... proceed }
Purpose: Capture context for forensics
typescriptasync function gitInit(directory: string) { const stack = new Error().stack; logger.debug('About to git init', { directory, cwd: process.cwd(), stack, }); // ... proceed }
When you find a bug:
Bug: Empty projectDir caused git init in source code
Data flow:
Project.create(name, '')WorkspaceManager.createWorkspace('')git init runs in process.cwd()Four layers added:
Project.create() validates not empty/exists/writableWorkspaceManager validates projectDir not emptyWorktreeManager refuses git init outside tmpdir in testsResult: All 1847 tests passed, bug impossible to reproduce
All four layers were necessary. During testing, each layer caught bugs the others missed:
Don't stop at one validation point. Add checks at every layer.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 19,262 | 16,320 | -15% | 1 | 1 | 0% | 3,511 | 3,640 | +4% | 0 | 0 | — |
case-02 | fail→pass | 18,426 | 14,074 | -24% | 1 | 1 | 0% | 2,926 | 3,341 | +14% | 0 | 0 | — |
case-03 | fail→pass | 19,225 | 16,338 | -15% | 1 | 1 | 0% | 3,511 | 4,002 | +14% | 0 | 0 | — |
case-04 | pass→pass | 15,580 | 14,352 | -8% | 1 | 1 | 0% | 2,842 | 3,285 | +16% | 0 | 0 | — |
case-05 | pass→pass | 18,296 | 19,304 | +6% | 1 | 1 | 0% | 3,384 | 4,496 | +33% | 0 | 0 | — |
case-06 | pass→pass | 17,839 | 21,128 | +18% | 1 | 1 | 0% | 3,626 | 4,754 | +31% | 0 | 0 | — |
case-07 | fail→pass | 16,215 | 13,414 | -17% | 1 | 1 | 0% | 2,895 | 3,240 | +12% | 0 | 0 | — |
case-08 | fail→pass | 15,710 | 14,995 | -5% | 1 | 1 | 0% | 2,584 | 3,489 | +35% | 0 | 0 | — |
case-09 | fail→fail | 17,913 | 14,357 | -20% | 1 | 1 | 0% | 2,760 | 3,409 | +24% | 0 | 0 | — |
case-10 | fail→pass | 14,700 | 16,216 | +10% | 1 | 1 | 0% | 2,510 | 3,542 | +41% | 0 | 0 | — |
case-11 | fail→fail | 17,017 | 13,971 | -18% | 1 | 1 | 0% | 2,741 | 3,379 | +23% | 0 | 0 | — |
case-12 | fail→fail | 15,744 | 13,101 | -17% | 1 | 1 | 0% | 2,460 | 3,044 | +24% | 0 | 0 | — |
case-13 | fail→pass | 11,372 | 4,505 | -60% | 1 | 1 | 0% | 1,835 | 1,644 | -10% | 0 | 0 | — |
case-14 | fail→fail | 15,271 | 14,872 | -3% | 1 | 1 | 0% | 2,530 | 3,524 | +39% | 0 | 0 | — |
case-15 | fail→pass | 42,190 | 16,150 | -62% | 1 | 1 | 0% | 1,549 | 3,570 | +130% | 0 | 0 | — |
case-16 | fail→pass | 15,150 | 9,624 | -36% | 1 | 1 | 0% | 2,288 | 2,268 | -1% | 0 | 0 | — |
case-17 | pass→pass | 15,357 | 14,456 | -6% | 1 | 1 | 0% | 2,255 | 2,936 | +30% | 0 | 0 | — |
case-18 | fail→pass | 12,857 | 13,224 | +3% | 1 | 1 | 0% | 1,906 | 2,762 | +45% | 0 | 0 | — |
case-19 | fail→pass | 17,629 | 15,661 | -11% | 1 | 1 | 0% | 2,741 | 3,564 | +30% | 0 | 0 | — |
case-20 | fail→fail | 18,744 | 17,325 | -8% | 1 | 1 | 0% | 3,400 | 4,095 | +20% | 0 | 0 | — |
case-21 | fail→pass | 18,399 | 18,222 | -1% | 1 | 1 | 0% | 3,161 | 4,001 | +27% | 0 | 0 | — |
case-22 | fail→pass | 15,615 | 14,413 | -8% | 1 | 1 | 0% | 2,427 | 3,334 | +37% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 21 counted toward the lift figure. The other 1 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +59 percentage points is the difference between those two pass rates over the 21 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.