/wicked-garden:wicked-garden-qe-test-code-quality-auditorfrom wicked-garden
Audits test code for static quality issues: assertion-free tests, tautologies, try/catch swallowing, shared-state bleed, hardcoded sleeps, nondeterministic seeds, duplicated beforeEach, slow assertions, and dead tests. Complements flaky-test-hunter by catching structural smells.
Ships in wicked-garden. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You audit test code for the smells that make a suite lie about its effectiveness. Coverage and kill-rate miss these — a test with zero assertions still executes every line it touches. Your verdict distinguishes "missing assertions" (P0 — silent lies) from "brittle style" (P2 — review when convenient).
Script-backed steps use the wicked-garden launcher: wicked-garden run <plugin-root-relative path, e.g. scripts/…> [args]. It is on PATH after npm i -g wicked-garden; otherwise use npx wicked-garden run …; inside a wicked-crew run it is "$WICKED_GARDEN_ROOT/scripts/wicked-garden".
If none of these is available, or Python 3 is missing, skip the script-backed step, say so, and follow the manual alternative where one is given next to it — never invent the script's output.
Relative paths in this skill are relative to the directory that contains this SKILL.md.
target_dirs: test directories to scan; default tests/ __tests__ spec/.language: one of javascript, typescript, python, java, go,
ruby. Drives the regex set used by each detector.severity_floor: minimum severity to include in findings; one of
P0, P1, P2; default P2 (include everything).top_n: findings in the remediation list; default 30.run_id — UUID of the current runs row; defines EVIDENCE_DIR.MODE — audit (default: the scenario-driven smell audit of §1–8) or
produced-test (§9). It is produced-test only when the dispatch args say
so (MODE: produced-test — the qe review playbook's "Reviewing produced
tests" block declares it) or hand you a PLAN with an execution table; when
the args are silent or name anything else, fall back to audit. The PASS
branch in §5 exists only in produced-test mode..wicked-qe/config.json — optional; detected_tooling to
pick the right assertion-regex set per framework..wicked-qe/evidence/<run_id>/context.md — optional rules,
e.g. "tests/perf/ may use sleep legitimately — exclude from hardcoded-
sleep detector".Each detector writes to EVIDENCE_DIR/detectors/<name>.json with the
fields: file, line, snippet, severity, rule. Run in parallel —
they are independent.
# A test function body with zero assertion markers. The regex set varies
# by language; for JS/TS we look inside `it(` / `test(` blocks for the
# assertion vocabulary.
node {WT_LIB}/test-quality/scan-assertion-free.mjs \
--lang "${LANG}" \
--dirs "${TARGET_DIRS}" \
> "${EVIDENCE_DIR}/detectors/assertion-free.json"
Assertion markers by language:
expect(, assert(, should., chai., sinon.assertassert , self.assert, pytest.raisest.Error, t.Fatal, require., assert.assertEquals, assertThat, Mockito.verifyexpect(, assert_, refute_# Assertions that can never fail: expect(true).toBe(true),
# expect(false).toBe(false), expect(x).toBe(x), expect(x).toEqual(x),
# assertEquals(1,1), assertEquals(0,0), assert 1==1, assertTrue(true),
# assertFalse(false). These pass even if the SUT never ran.
#
# The pattern set is intentionally broad — any self-equal literal or
# any self-equal variable reference flags. Callers can tune via
# `--tautological-allow <regex>` if they have a legitimate sentinel
# pattern (e.g., assertion-library smoke tests).
grep -nE \
'expect\((true|false|-?[0-9]+|"[^"]*"|'"'"'[^'"'"']*'"'"')\)\.(toBe|toEqual|toStrictEqual|toMatchObject)\(\1\)|expect\(([a-zA-Z_$][a-zA-Z0-9_$]*)\)\.(toBe|toEqual|toStrictEqual|toMatchObject)\(\4\)|assert(Equals|True|False)?\((-?[0-9]+|true|false|"[^"]*"),\s*\8\)|assert\s+(True|False|1\s*==\s*1|0\s*==\s*0|".+"\s*==\s*"\10")' \
-r "${TARGET_DIRS}" \
> "${EVIDENCE_DIR}/detectors/tautological.txt" || true
# A catch block with no assertion inside. Common failure mode:
# try { await op(); } catch (e) { /* nothing */ }
# The test passes regardless of whether op() succeeded.
node {WT_LIB}/test-quality/scan-swallowing.mjs \
--lang "${LANG}" \
--dirs "${TARGET_DIRS}" \
> "${EVIDENCE_DIR}/detectors/swallowing.json"
# Module-level `let` or mutable module state written by a test without a
# matching cleanup. Causes order-dependent flakes.
node {WT_LIB}/test-quality/scan-shared-state.mjs \
--lang "${LANG}" \
--dirs "${TARGET_DIRS}" \
> "${EVIDENCE_DIR}/detectors/shared-state.json"
# setTimeout in a test body, or Python time.sleep, Ruby sleep, Go
# time.Sleep. Almost always masks a timing bug in the SUT.
grep -nE \
'setTimeout\(|time\.sleep\(|^\s*sleep\(|time\.Sleep\(' \
-r "${TARGET_DIRS}" \
> "${EVIDENCE_DIR}/detectors/hardcoded-sleep.txt" || true
# Random used without a fixed seed. Detect any call to Math.random,
# random.randint, rand.Intn etc. in test files.
grep -nE \
'Math\.random|random\.(randint|choice|random)|rand\.(Intn|Int|Float64)|Random\.' \
-r "${TARGET_DIRS}" \
> "${EVIDENCE_DIR}/detectors/nondeterministic.txt" || true
# Identical beforeEach blocks across files. We fingerprint the block
# body and group by hash.
node {WT_LIB}/test-quality/scan-duplicated-setup.mjs \
--dirs "${TARGET_DIRS}" \
> "${EVIDENCE_DIR}/detectors/duplicated-setup.json"
# Parse the last test-run timing report (junit.xml or jest-json) plus
# a grep count of assertions in each test. Ratio > threshold = slow.
node {WT_LIB}/test-quality/scan-slow-ratio.mjs \
--junit "${EVIDENCE_DIR}/last-junit.xml" \
--ratio-threshold 2.0 \
> "${EVIDENCE_DIR}/detectors/slow-ratio.json"
# A test that hasn't failed in N historical runs AND covers code that
# hasn't changed in N days. Requires DomainStore history.
node {WT_LIB}/test-quality/scan-dead-tests.mjs \
--history-runs 30 \
--history-days 90 \
> "${EVIDENCE_DIR}/detectors/dead-tests.json"
Under .wicked-qe/evidence/<run_id>/:
| File | manifest kind | Required |
|---|---|---|
detectors/*.json / detectors/*.txt | log | Yes, per detector |
test-quality-audit.md | log | Yes |
test-quality-top-n.csv | log | Yes |
test-quality-audit.md groups findings by severity (P0 → P1 → P2), each
with a per-file listing of line number + snippet + rule. test-quality- top-n.csv columns: file,line,rule,severity,snippet,fix_hint.
// Severity drives verdict. Any P0 finding is a FAIL — those tests are
// lying. P1-only is CONDITIONAL. P2-only is CONDITIONAL with no task churn.
const p0 = findings.filter(f => f.severity === "P0");
const p1 = findings.filter(f => f.severity === "P1");
const p2 = findings.filter(f => f.severity === "P2");
// MODE (§1 Inputs): "produced-test" only when the dispatch args declare `MODE: produced-test`
// or hand over a PLAN with an execution table; silent or anything else → "audit".
const MODE = (ARGS_MODE === "produced-test" || PLAN_HAS_EXECUTION_TABLE) ? "produced-test" : "audit";
// Audit mode (§1–8): any P0 → FAIL, otherwise CONDITIONAL — a smell audit never certifies.
// Produced-test mode (§9): PASS is reachable — every §9 duty holds and the produced files
// carry P0 = P1 = P2 = 0; P1/P2-only → CONDITIONAL (fixes listed); any P0 → FAIL.
const verdict = p0.length > 0 ? "FAIL"
: MODE === "produced-test" ? ((p1.length + p2.length) > 0 ? "CONDITIONAL" : "PASS")
: "CONDITIONAL";
store.create("verdicts", {
run_id: RUN_ID,
verdict,
reviewer: "wicked-garden-qe-test-code-quality-auditor",
reason: `P0=${p0.length} (assertion-free / tautological) P1=${p1.length} (swallowing / shared-state / sleeps / nondet) P2=${p2.length} (dup-setup / slow-ratio / dead). See test-quality-audit.md.`,
evidence_path: `evidence/${RUN_ID}/`,
// Inside a governed wicked-crew run, name it, so crew attributes this verdict by stamp.
...(process.env.WICKED_RUN_ID ? { crew_run_id: process.env.WICKED_RUN_ID } : {}),
});
// One task per P0 finding (individual); P1/P2 clustered by rule+file.
for (const f of [...p0, ...clusterByRuleFile([...p1, ...p2])]) {
store.create("tasks", {
project_id: PROJECT_ID,
title: `Test code smell: ${f.rule} @ ${f.file}:${f.line}`,
status: "open",
assignee_skill: `test-code-quality-auditor:${f.severity.toLowerCase()}`,
body: JSON.stringify({
rule: f.rule, severity: f.severity,
file: f.file, line: f.line,
snippet: f.snippet,
fix_hint: f.fixHint,
}),
});
}
| code | meaning | class |
|---|---|---|
ERR_TARGET_DIR_MISSING | target_dirs path doesn't exist | user |
ERR_LANG_UNSUPPORTED | language: outside the detector set | user |
ERR_NO_TESTS_FOUND | zero test files detected — scenario is noop | user |
ERR_JUNIT_MISSING | slow-ratio detector needs a recent junit.xml — none found | system |
ERR_HISTORY_UNAVAILABLE | dead-test detector needs DomainStore history — empty | system |
On ERR_JUNIT_MISSING or ERR_HISTORY_UNAVAILABLE: skip ONLY that
detector; continue running the rest. Record the skip in the audit
narrative so the reviewer knows the coverage is partial.
expect.assertions(N) / assert_called
pattern as assertion-free. The detectors have language-specific
allowlists; respect them.severity_floor. If the scenario only wants P0 reporting,
do not inflate findings with P2 noise.## Test-code audit: {scenario.name}
target_dirs: {target_dirs} language: {language} severity_floor: {floor}
findings by detector:
assertion-free : {n}
tautological : {n}
swallowing : {n}
shared-state : {n}
hardcoded-sleep : {n}
nondeterministic : {n}
duplicated-setup : {n}
slow-ratio : {n}
dead-tests : {n}
severity roll-up:
P0 {p0} P1 {p1} P2 {p2}
top-5 (full list in test-quality-top-n.csv):
P0 tests/auth/login.test.ts:42 assertion-free "it('accepts valid creds', () => { service.login(...); })"
P0 tests/cart/coupon.test.ts:19 tautological "expect(total).toBe(total)"
P1 tests/api/retry.test.ts:88 hardcoded-sleep "setTimeout(() => ..., 5000)"
...
AUDIT: {p0}/{p1}/{p2} REVIEWER: wicked-garden-qe-test-code-quality-auditor RUN_ID: {RUN_ID}
The audit certifies nothing, so it writes no VERDICT line — the AUDIT: line
is its report line; the ledger record (§5) carries the CONDITIONAL / FAIL.
When the qe review action dispatches you in produced-test mode (MODE: produced-test in the args — §1) with a PLAN that carries an execution table
(the author output — the review phase of a governed test-authoring run), the
detectors above run on the produced files AND these duties apply. The verdict is re-derived from the files, never copied from the
PLAN; the author's "all green" is a claim.
covered rows are opened at their file:line — the test exists, its
assertion is the behaviour the row names, and the count of it / test /
def test_ blocks matches the PLAN (new vs pre-existing separately). A
covered claim with no citation, or one that does not hold, is an
unsupported coverage claim (P0) — reclassify the row unverified; a padded
total is a P1 finding.unverified
produced file, or a needs-fixture e2e never run against its fixture →
[unexecuted-test] (P0), whatever else holds; a red produced test
(failing, or red on your re-run) is P0 too.git status --porcelain -- <file> must be empty — if it
is not (the author phase touched that file and the run has not committed
it), copy the file aside and restore from the copy, never with
git checkout, which would also discard the author's edit; afterwards
git diff --quiet -- <file> (or a checksum) proves the tree is
byte-identical. §7's "do not mutate test code" stands — this touches the
SUT and is reverted. When you cannot run, name the mutation and the
assertion line that would catch it. No nameable failing mutation →
tautological (P0).grep the data-testid, read the render rule); an oracle that can never
match is [scenario-defect] (P0).not covered rows name each intent area
without a test and why; a silent gap is a P1 finding.git push, gh pr create, gh pr merge; the
verdict returns to the run, whose deliver phase (or the human) opens the PR.PASS is reachable here, unlike the audit in §5)PASS — all of: every covered claim verified at its path:line
(duty 1); every produced file executed with its recorded command and green,
and your re-run — when the harness is available — reproduces it (duty 2); no
unverified and no failing row among the produced files; ≥ 2 behaviours
mutated-or-reasoned with a nameable failing mutation each (duty 3); e2e
oracles verified (duty 5); not covered rows account for the intent
(duty 6); and the §2 detectors report P0 = P1 = P2 = 0 on the produced files.FAIL with CONDITIONS — no P0, but any P1/P2 (implementation-shaped
test, padded total, silent scope gap, style smells): list the fixes as
conditions above the verdict line. There is no conditional pass — the ledger
record (§5) may still say CONDITIONAL; the output line says FAIL.FAIL — any P0: [unexecuted-test], a red produced test, an
unsupported covered claim, a tautological test, or an impossible oracle
[scenario-defect].Report block for this mode — the §8 AUDIT: line stays for the audit; a
message never carries two VERDICT lines and never quotes another one. The
verdict is one plain-text line, the LAST line of your output:
MODE: produced-test
REVIEWER: wicked-garden-qe-test-code-quality-auditor
RUN_ID: {RUN_ID}
VERDICT: PASS|FAIL
{WT_LIB}){WT_LIB} is the plugin's own qe helper directory — the helper modules ship
in-catalog (scripts/qe/lib/, ported from the retired wicked-testing package
in Phase 6c). Resolve it (cross-platform):
WT_LIB="$(wicked-garden path scripts/qe/lib)"
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
test-quality, test-smells, assertion-audit, test-suite-decay
npx claudepluginhub mikeparcewski/wicked-garden --plugin wicked-garden91 skills in this plugin
/wicked-garden-agenticAgentic-systems domain skill: review, design, audit, and framework selection
for AI agent systems. Routes to one of four actions (review | design | audit |
frameworks) backed by the rubrics in refs/.
Use when: "agentic review", "review this agent system", "full agentic codebase
review", "trust and safety audit", "audit my agents for GDPR/HIPAA/SOC2/NIST
compliance", "design an agentic system", "design a multi-agent architecture",
"which agentic framework should I use", "compare LangChain vs CrewAI vs
AutoGen", or any former /wicked-garden:agentic:{review|design|audit|frameworks}
invocation.
Disambiguation: this domain reviews and designs **AI agent systems**. For
ordinary source code use the engineering review; for a binding go/no-go
verdict use the archetype review (see docs/domains.md → "review appears in
three domains").
/wicked-garden-agentic-architectFive-layer architecture validation, agent topology analysis, orchestration
pattern assessment, and framework detection for agentic systems.
Use when: architecture review of an AI agent system, agent topology analysis,
validating the five-layer model (cognition/context/interaction/runtime/
governance), assessing orchestration patterns, or as a parallel worker in a
heavyweight wicked-garden-agentic review.
/wicked-garden-agentic-performance-analystToken optimization, latency budgets, cost analysis, caching strategy, and
parallelization assessment for agentic systems.
Use when: performance optimization of an AI agent system, cost analysis or
token-budget review, latency profiling, cache-strategy assessment,
parallelization opportunities, or as a parallel worker in a heavyweight
wicked-garden-agentic review.
/wicked-garden-agentic-safety-reviewerGuardrails, prompt injection defense, PII protection, human-in-the-loop
gates, and hallucination mitigation for agentic systems.
Use when: safety review of an AI agent system, guardrail assessment, prompt
injection audit, PII/compliance exposure check, HITL gate verification, or
as a parallel worker in a heavyweight wicked-garden-agentic review.
Cross-ref: EXECUTING injection/jailbreak/refusal-rate/drift probes against
a live LLM feature with evidence artifacts + a ledger verdict is
`wicked-garden-qe-ai-feature-test-engineer` (executor); THIS skill is the
design-time safety review.
/wicked-garden-appsChange, review or accept an Apps app: a declarative UI over live data
and the system's knowledge that a person builds in wicked-studio's Apps
section. An app is a spec
(apps.json: pages, components, layout, theme, bindings, queries and
actions) plus query texts under queries/. A turn's builder edits those
two and nothing else, from the data catalog the task names, and never
calls a write tool or an action (a live read goes only through crew's
broker). A distinct reviewer judges the turn's tree. A publish's QE seat
judges the publish check's evidence.
Use when: a phase of the `apps-turn` workflow (build, review) or the
`apps-publish` workflow (qe), "add a KPI to my app", "chart this query",
"add a filter", "add an Assign to me button", "review this app turn".
NOT for running a query, testing a connection, granting an action or
deploying an app (crew and studio do those, behind a person's click),
and NOT for building studio editor plugins (that is
wicked-garden-editor-scaffold).
/wicked-garden-archetypev11 work-shape archetype runner. When a prompt has been routed to one
of the archetypes (triage, explore, specify, decide, ship, review,
incident, build, migrate, modernize), this skill is the entry point. It
picks the right per-archetype playbook from refs/ and executes the phase
shape declared in `.claude-plugin/archetypes.json`.
Use when: a `<wg archetype="X">` or `<wg archetypes>` system-reminder
tag appears, an explicit "let's run the X archetype" request, or a
direct per-archetype ask — "triage this prompt", "review this PR /
artifact", "build this feature", "decide between these options",
"explore this problem", "handle this incident", "run this migration",
"modernize / port this legacy app", "ship this release", "write
acceptance criteria" (invoke with archetype=<name> plus the user's
args — see the Direct invocation table).
Other plugins' skills for the same job