一键导入
skill-test-architect
Design adversarial test suites for Guards that prove both positive enforcement and bypass resistance.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Design adversarial test suites for Guards that prove both positive enforcement and bypass resistance.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Trace import graph + test coverage of files about to be modified and produce an impact report before any code changes are made.
Evaluate the quality of a DSPy integration in DiD — endpoint correctness, graceful degradation, and WARN-NOT-BLOCK contract.
Design, implement, and debug GitHub Actions workflows for DiD's server-side enforcement layer.
The canonical skill for designing, implementing, testing, and registering a new Guard in defense-in-depth.
Review a PR against DiD's governance contracts — Guard purity, severity correctness, test coverage, and documentation completeness.
Refactor guard code with minimum blast radius — change only what is needed, verify nothing else shifts.
| domain | testing |
| name | skill-test-architect |
| description | Design adversarial test suites for Guards that prove both positive enforcement and bypass resistance. |
| version | 1.0.0 |
| type | specialist |
| role | The Adversarial Test Architect |
Role: The Adversarial Test Architect
Philosophy: A test that only proves success is half a test. The other half proves the guard cannot be tricked.
Produce a test suite for a DiD Guard that:
fs callsos.tmpdir() + real file writes. Mocking fs hides byte-level edge cases (BOM, encoding, line endings).edge_cases.md must be populated before the test file is written.stagedFiles: [] → guard must return passed: true with zero findings.Load tests/fixtures/<guard-name>/edge_cases.md — this is the source of truth.
// tests/<guard-name>.test.js
import { describe, it, beforeEach, afterEach } from "node:test";
import assert from "node:assert/strict";
import os from "node:os";
import fs from "node:fs";
import path from "node:path";
// Pattern: write temp file → run guard → assert findings
1. Happy path — clean files → guard passes, zero findings
2. BLOCK cases — hollow/invalid files → guard emits BLOCK finding
3. WARN cases — borderline files → guard emits WARN, does not BLOCK
4. Bypass attempts — adversarial inputs designed to evade the guard
5. Config overrides — non-default config changes behavior correctly
6. Edge: empty — stagedFiles=[] → passes with zero findings
7. Edge: missing — staged file doesn't exist on disk → guard skips gracefully
const blockFindings = result.findings.filter(f => f.severity === "block");
assert.equal(blockFindings.length, 1, "Expected exactly one BLOCK finding");
assert.ok(result.findings[0].fix, "BLOCK finding must include a fix message");
assert.ok(result.findings[0].message.includes("hollow"), "Message must name the violation");
// Simulate DSPy down: useDspy=true but no server → should still enforce Tier 0
// See: tests/hollow-artifact-dspy-fallback.test.js as reference
| File | Required content |
|---|---|
tests/<guard-name>.test.js | All 7 categories above |
tests/fixtures/<guard-name>/edge_cases.md | Annotated with expected outcomes |
| Coverage contribution | New guard tests must not drop coverage below the current gate |
fs.existsSync — Hides path-resolution bugs. Use real tempdir files.path.join(tmpDir, 'file.md'), never hardcoded paths.durationMs — Not a hard assertion, but log it. Performance regressions are real.