white-box-red-testing
Skill409 starsChanged 34 days agoApache-2.0View on GitHub
Find bugs by writing tests that should pass but don't. Invoke manually on user-chosen scope (commits, files, or coverage threshold). Outputs red tests with structured rationale. Use when user asks to "stress-test", "find bugs in", "attack", or "break" code.
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 5 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
NEVER modify source code. Analyze and classify only.
- Distinctive: line 14
NEVER weaken existing tests.
- Distinctive: line 23
After a commit or PR — "did these changes introduce bugs?"
- Distinctive: line 25
If you don't know where to look or want to explore broadly, use the black-box-red-testing skill instead.
- Distinctive: line 89
If >50 targets, ask user to narrow scope
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
White-Box Red Testing
Hard Boundaries
- NEVER modify source code. Analyze and classify only.
- NEVER weaken existing tests.
- Unexported/private members: test only if explicitly scoped.
- Output to user-specified directory or language-appropriate default.
When to Use
- You have specific targets: changed files, a commit range, or low-coverage functions
- You need classified findings (confirmed-bug / likely-bug / specification-gap)
- Contracts exist (docstrings, types, tests) and you want to verify code matches them
- After a commit or PR — "did these changes introduce bugs?"
If you don't know where to look or want to explore broadly, use the black-box-red-testing skill instead.
Scope Modes
User chooses scope. Never run unsolicited.
| Mode | Trigger | Targets |
| Commits | --commits HEAD~3..HEAD | Changed/added functions in diff |
| Files | --files <path> or --module <dir> | All public callables in specified paths |
| Coverage | --coverage-below 70 [--branch] | Functions below threshold via scripts/discover_targets.py |
Note on coverage targeting: Low coverage indicates under-tested code, not necessarily buggy code. Use as a targeting heuristic to prioritize where to look, not as a bug predictor.
Workflow
1. IDENTIFY TARGETS
- commits: git diff → parse changed functions
- files: AST parse → list public callables
- coverage: run scripts/discover_targets.py
2. GATHER CONTRACT EVIDENCE per target
- docstrings, type annotations, existing passing tests
- function/param names, assertions, call sites, commit messages
- No evidence? → findings become "specification-gap"
3. FORM HYPOTHESES per target as structured one-liners:
[code_path] × [defect_class] → [observable_symptom]
Defect classes to consider:
- boundary inputs (empty, zero, None, unicode, tz-naive)
- state/mutation (shared state, call sequences, input mutation)
- implicit contracts (name promises vs actual behavior)
- error paths (timeouts, missing data, malformed input)
4. GENERATE ADVERSARIAL TESTS — one test per hypothesis
5. SELF-VALIDATE (mandatory)
- Run all generated tests
- Red → candidate finding
- Green → record hypothesis in confidence section of report
- Broken → fix or discard
6. CLASSIFY per references/finding-classification.md
- confirmed-bug | likely-bug | specification-gap
7. APPLY DISTINCTNESS FILTER
Each finding must differ from others in at least one of:
- The code path exercised
- The category of defect found
- The component boundary tested
Shallow variations of the same finding → consolidate into one.
8. OUTPUT
- Test files to output directory (test code only, no classification in tests)
- Summary report to stdout (classification, evidence, impact per finding)
- Format: see references/output-format.mdConstraints
- Coverage scope mode requires Python +
pytest-cov. Commits and Files modes are language-agnostic. - Coverage scope uses
scripts/discover_targets.py— run with--helpfor options - If >50 targets, ask user to narrow scope
Stop Conditions
- Max 5 generation attempts per target — if 3 attempts yield nothing, shift defect category (boundary → state → contract → error path) rather than retrying the same angle
50% of targets yield no findings → report as confidence signal for tested areas, continue with remaining targets
15 findings before all targets analyzed → pause for triage
In this repository29 other files it gives its agents.
- adr-backfillSkill
- adversarial-pairingSkill
- architecture-planningSkill
- bash-policySkill
- black-box-red-testingSkill
- check-§BRAND_NAME_LOWER§-input-readinessSkill
- checkpoint-summarySkill
- clean-codeSkill
- code-quality-assessmentSkill
- code-reviewSkill
- code-spec-backfillSkill
- context-engineeringSkill
- debuggingSkill
- detailed-spec-writingSkill
- epic-writingSkill
- feynmanSkill
- generic-subagentSkill
- goal-writingSkill
- have-you-consideredSkill
- lean-thinkingSkill
- lesson-captureSkill
- §BRAND_BINARY_NAME§-logsSkill
- §BRAND_BINARY_NAME§-operatorSkill
- software-architecture-reviewSkill
- spec-backfillSkill
- spec-reviewSkill
- systemic-thinkingSkill
- testingSkill
- user-story-writingSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

