Help us improve
Share bugs, ideas, or general feedback.
From tdd-guardian
Enforce coverage thresholds AND test quality — coverage without behavioral assertions is meaningless.
npx claudepluginhub xiaolai/claude-plugin-marketplace --plugin tdd-guardianHow this skill is triggered — by the user, by Claude, or both
Slash command
/tdd-guardian:coverage-gateThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
1. Run project test command.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Provides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Provides UI/UX resources: 50+ styles, color palettes, font pairings, guidelines, charts for web/mobile across React, Next.js, Vue, Svelte, Tailwind, React Native, Flutter. Aids planning, building, reviewing interfaces.
Share bugs, ideas, or general feedback.
coverageMode:"absolute" (default): Current behavior — all metrics must meet configured thresholds.
"no-decrease": Blocks only if coverage decreased from a recorded baseline.
| Scenario | absolute | no-decrease |
|---|---|---|
| Coverage 72%, threshold 100% | BLOCK | PASS (if baseline ≤ 72%) |
| Coverage dropped 72% → 70% | BLOCK | BLOCK (decreased) |
| Coverage improved 72% → 75% | BLOCK | PASS (improved) |
Default threshold policy (absolute mode): 100 for all metrics.
Coverage alone is insufficient. A test that touches every line but only asserts expect(mock).toHaveBeenCalled() provides zero regression safety.
Follow the assertion hierarchy and mock rules defined in the policy-core skill.
For each test file in the coverage report:
Count assertion types per test using the assertion hierarchy from policy-core:
Flag violations:
it() block where ALL assertions are Level 6-7it() block where Level 6-7 assertions outnumber Level 1-5 assertions by 3:1 or moreReport format:
Test Quality Summary:
✓ 45/48 tests have behavioral assertions
✗ 3 tests are wiring-only:
- docker/container.test.ts: "applies security defaults" (line 52) — mock args only
- cli/lifecycle.test.ts: "stops container" (line 48) — mock-was-called only
- docker/network.test.ts: "creates network" (line 28) — mock args only
Gate result: FAIL if any wiring-only tests exist in changed files. WARN (non-blocking) for existing wiring-only tests in unchanged files.
Scan all source files (not test files) for V8 coverage ignore comments. Flag misuse:
/* v8 ignore next */ or /* v8 ignore next N */ — silently fails on ??, ternaries, catch bodies, and short-circuit operators (&&, ||). Replace with /* v8 ignore start */ / /* v8 ignore stop */./* v8 ignore start */ / /* v8 ignore stop */ range pairs.Coverage Ignore Audit:
✗ 2 files use unreliable /* v8 ignore next N */:
- src/config.ts:42 — covers ?? expression, will silently fail
- src/handler.ts:88 — covers ternary, will silently fail
Fix: replace with /* v8 ignore start */ / /* v8 ignore stop */ range comments
| Current assertion | Add this | Example |
|---|---|---|
expect(mockCreate).toHaveBeenCalledWith(opts) | Verify return value | expect(result.id).toMatch(/^mx-/) |
expect(mockStop).toHaveBeenCalled() | Verify formatted output | expect(formatter.success).toHaveBeenCalledWith("Mecha stopped.") |
expect(mockCreate).toHaveBeenCalledWith(securityOpts) | Add integration test | const info = await inspect(container); expect(info.HostConfig.ReadonlyRootfs).toBe(true) |