shadow-test
Skill1 starsChanged yesterdayMITView on GitHub
Polyglot Automated Unit, Integration & Contract Testing. Use when writing or fixing Vitest/Jest, Pytest, Go test, Pest/PHPUnit, JUnit 5, xUnit, Rust, or Flutter tests. Do NOT use for RAG/LLM evals (/shadow-eval) or Pre-UAT k6 load tests (/shadow-perf).
- Deletes or force-pushes
In this repository51 other files it gives its agents.
- antislop-codeSkill
- antislop-copywritingSkill
- antislop-humanSkill
- antislop-layoutmobileSkill
- antislopSkill
- antislop-uiSkill
- context7Skill
- handoffSkill
- shadow-accessibilitySkill
- shadow-apiSkill
- shadow-architectSkill
- shadow-authSkill
- shadow-bootstrapSkill
- shadow-browserSkill
- shadow-cacheSkill
- shadow-compatSkill
- shadow-concurrencySkill
- shadow-dataSkill
- shadow-dbSkill
- shadow-debugSkill
- shadow-designSkill
- shadow-discoverySkill
- shadow-docSkill
- shadow-domainSkill
- shadow-eaSkill
- shadow-evalSkill
- shadow-finopsSkill
- shadow-gitSkill
- shadow-grcSkill
- shadow-handoverSkill
- shadow-integrateSkill
- shadow-maintainSkill
- shadow-mobileSkill
- shadow-modernizeSkill
- shadow-monarchSkill
- shadow-observeSkill
- shadow-opsSkill
- shadow-perfSkill
- shadow-planSkill
- shadow-pmoSkill
- shadow-presalesSkill
- shadow-privacySkill
- shadow-qualitySkill
- shadow-realtimeSkill
- shadow-refactorSkill
- shadow-releaseSkill
- shadow-resilienceSkill
- shadow-searchSkill
- shadow-secSkill
- shadow-supplychainSkill
- shadow-uatSkill
The file
We split this skill into the rules it gives an agent
12 rules. About 0 are common, 3 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Use this skill whenever the Monarch asks to write, expand, fix, or audit unit tests, integration tests, or API contract tests in any …
- Very specific: line 14
Read references/POLYGLOT-TESTING-MATRIX.md for idiomatic test structures across TypeScript/Node/React, Python, Go, PHP/Laravel, …
- Distinctive: line 23
Integration / Component Tests (Highest ROI for Backend APIs): Test the full route -> validation -> service -> database/transaction boundary …
- Very specific: line 29
Run affected module tests first (vitest related, pytest --lf, go test ./pkg/...) for fast feedback before running the full test suite.
- Very specific: line 33
Mutation & Fault/Race Injection: Verify critical business tests catch seeded bugs (mutation mindset).
- Very specific: line 34
Flaky-Test Triage: Never ignore intermittent CI failures or blindly wrap with retries.
- Very specific: line 37
Never leave exited test or migration-verification containers (*-test-<timestamp>, *-migration-verification*), anonymous volumes, or …
- Very specific: line 39
Start at most one ephemeral DB container per test suite run and isolate individual tests via transactions (BEGIN ...
- Very specific: line 59
Always run with an explicit project name (-p <project>-test) and tear down containers, anonymous volumes, AND locally built test images in …
- Very specific: line 64
If a test builds a temporary image (docker build -t <app>-test:temp), always remove it in finally (docker image rm -f <app>-test:temp).
- Very specific: line 66
Before reporting tests as VERIFIED-LOCAL, run python "shadow-quality/scripts/shadow_gate.py" --repo .
- Distinctive: line 80
State & Container Isolation: Verify zero leftover test records in development databases AND zero leftover Docker test containers, anonymous …
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 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
Shadow Test (/shadow-test) — Polyglot Automated Testing, Risk-Based Pyramid & Contract Compatibility
Use this skill whenever the Monarch asks to write, expand, fix, or audit unit tests, integration tests, or API contract tests in any programming language or framework.
1. Local Knowledge Base Routing
- Read
references/POLYGLOT-TESTING-MATRIX.mdfor idiomatic test structures across TypeScript/Node/React, Python, Go, PHP/Laravel, Java/Kotlin, C#/.NET, Rust, and Dart/Flutter. - For JavaScript/TypeScript/Node.js backend & frontend testing, consult
references/vendor/GoldbergYoni_JS_Testing_Best_Practices.md.
2. Enhanced Testing Doctrine
A. Risk-Based Test Pyramid
Prioritize testing effort where business and financial risk is highest:
- Integration / Component Tests (Highest ROI for Backend APIs): Test the full route -> validation -> service -> database/transaction boundary using real test DB transactions or Testcontainers rather than brittle mocks of internal repositories.
- Pure Domain Unit Tests: Fast, exhaustive table-driven/parameterized tests for pricing formulas, tax/discount calculations, state machine transitions, and permission evaluators.
- Consumer/Provider Contract Tests (Paired with
/shadow-api&/shadow-compat): Verify HTTP status codes, response envelopes, required fields, and nullability matchopenapi.yamlso frontend/mobile consumers never break.
B. Regression Selection for Bug Fixes
- Whenever fixing a bug or production incident (
/shadow-maintain), write a targeted regression test that reproduces the exact failure first, then verify the fix turns it green. - Run affected module tests first (
vitest related,pytest --lf,go test ./pkg/...) for fast feedback before running the full test suite.
C. Deterministic Fixtures, Advanced Techniques & Zero Flakiness
- Property-Based & State-Machine Testing: For monetary math, parsers, serializers, and order/approval workflows, pair example tests with property-based checks (
fast-check,Hypothesis,proptest) and randomized state-transition sequences verifying core invariants hold across arbitrary inputs. - Mutation & Fault/Race Injection: Verify critical business tests catch seeded bugs (mutation mindset); inject concurrent duplicate requests, DB deadlocks, or simulated ack timeouts when testing async/transactional code (
/shadow-concurrency). - Flaky-Test Triage: Never ignore intermittent CI failures or blindly wrap with retries; isolate shared mutable globals, wall-clock timers (
vi.useFakeTimers(),freezegun), seeded RNGs, and per-test DB transaction rollback (BEGIN ... ROLLBACK) before reportingPASS.
D. Mandatory Docker & Test Database Teardown (Zero Orphan Containers/Volumes/Images)
Never leave exited test or migration-verification containers (*-test-<timestamp>, *-migration-verification*), anonymous volumes, or temporary test-built images behind in Docker:
- Reuse One Container Per Suite (Never One Container Per Test):
- Start at most one ephemeral DB container per test suite run and isolate individual tests via transactions (
BEGIN ... ROLLBACK/SAVEPOINT) or disposable schemas (CREATE DATABASE test_<id>; ... DROP DATABASE test_<id>;). Never spawn a newpostgres/mariadb/mysqlcontainer per test file.
- Start at most one ephemeral DB container per test suite run and isolate individual tests via transactions (
- Always Pass
--rm&--label shadow.ephemeral=true+ Guaranteedtry / finallyTeardown:- Single Container (
docker run):- PowerShell:
$ContainerName = "app-test-db-$PID" try { docker run -d --rm --label shadow.ephemeral=true --name $ContainerName -e MYSQL_ROOT_PASSWORD=test mariadb:10 # run migrations & tests... } finally { docker rm -f -v $ContainerName 2>$null | Out-Null } - Bash / POSIX:
CONTAINER_NAME="app-test-db-$$" trap 'docker rm -f -v "$CONTAINER_NAME" >/dev/null 2>&1 || true' EXIT docker run -d --rm --label shadow.ephemeral=true --name "$CONTAINER_NAME" -e MYSQL_ROOT_PASSWORD=test mariadb:10
- PowerShell:
- Docker Compose Test Stack:
- Always run with an explicit project name (
-p <project>-test) and tear down containers, anonymous volumes, AND locally built test images infinally/trap EXIT:docker compose -p "$Project-test" -f docker-compose.test.yml down -v --rmi local --remove-orphans
- Always run with an explicit project name (
- Temporary Test Images (
docker build):- If a test builds a temporary image (
docker build -t <app>-test:temp), always remove it infinally(docker image rm -f <app>-test:temp).
- If a test builds a temporary image (
- Single Container (
- Post-Test Leak Verification:
- Before reporting tests as
VERIFIED-LOCAL, runpython "shadow-quality/scripts/shadow_gate.py" --repo . --check-docker-leaksto verify zero leftover test containers or images remain.
- Before reporting tests as
3. Mandatory 8-Point Test Coverage Matrix
For every module, service, or endpoint under test, cover:
- Happy Path (
200/201): Assert observable output and persisted database/queue state. - Validation & Schema Failure (
400/422): Missing required fields, invalid types, negative numbers. - Unauthenticated (
401): Missing, malformed, or expired token. - Forbidden / Cross-Tenant IDOR (
403/404): User from Tenant A attempting to access or mutate Tenant B's resource (/shadow-auth). - Not Found (
404): Valid UUID/ID not present in DB. - Idempotency / Conflict (
409): Duplicate unique key or repeatedIdempotency-Keyrequest (/shadow-cache). - Boundary Values:
0,-1, empty list[],max + 1, timezone/midnight edge cases, decimal/currency rounding. - State & Container Isolation: Verify zero leftover test records in development databases AND zero leftover Docker test containers, anonymous volumes, or temporary test-built images after suite teardown.
4. Execution Approval & Intent Boundary (L0–L4)
- Bounded unit/integration tests on verified local/sandbox environments are
L1_SAFE_VERIFICATION. A unit-test request NEVER automatically authorizesL2broad E2E suites (/shadow-browser) orL3load/stress testing (/shadow-perf); require explicit approval (execution_approval_gate.py).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
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.

