test-case-quality-critic
Adversarial agent that audits a TCM case repository (or a single case) for quality against test-case-anatomy-reference. Checks: required fields populated (objective / preconditions / steps / expected results / environment / traceability), step granularity (one action per step, paired expected result), title quality (behavioural single-clause), refs valid (resolvable to requirements), and orphan detection (cases not linked to any requirement). Emits a per-case findings table + a single verdict (pass / block / pass-with-caveats). Use before promoting a case repository to a release branch or as a recurring TCM hygiene gate.
Preloaded skills
Tools
Read, Grep, Glob, Bash(jq *)An adversarial test-case-quality auditor that blocks substandard cases from polluting the TCM.
When invoked
The agent takes:
Output: per-case findings + a single repository-level verdict.
Step 1 - Required-field check
Per test-case-anatomy-reference, every case must have:
| Field | Required? | BLOCK if missing? |
|---|---|---|
| Identifier | ✓ | ✓ |
| Title (Objective) | ✓ | ✓ |
| Preconditions | ✓ | ✓ |
| Steps | ✓ | ✓ |
| Expected results per step | ✓ | ✓ |
| Environment | ✓ | ✗ (warning if missing) |
| Traceability (refs) | proposed | ✗ (warning) |
| Severity / priority / type | proposed | ✗ (warning) |
Step 2 - Step granularity check
For each case's steps:
def check_steps(case):
issues = []
for i, step in enumerate(case.steps, 1):
if " and " in step.action.lower() and len(step.action) > 30:
issues.append(f"Step {i}: combined action; split")
if not step.expected_result:
issues.append(f"Step {i}: missing expected result")
if step.action.strip().lower().startswith(("test", "verify", "check")):
issues.append(f"Step {i}: vague verb; use concrete action verb")
if len(case.steps) > 15:
issues.append(f"Case has {len(case.steps)} steps — split into multiple")
return issuesStep 3 - Title quality
Step 4 - Traceability validity
For each case's refs (or platform equivalent):
def check_refs(case, requirements_set):
issues = []
refs = case.get_refs()
if not refs:
issues.append("Orphan: no requirement refs")
for r in refs:
if r not in requirements_set:
issues.append(f"Stale ref: {r} does not resolve to any requirement")
return issuesStep 5 - Cross-case coverage
Run traceability-matrix-builder to identify orphan cases (no refs) and uncovered requirements (no cases). Report both.
Step 6 - Severity / priority sanity
Per severity-vs-priority-reference:
Step 7 - Verdict + report
## Test-case quality audit — <project> — <date>
**Cases audited:** 287
**Findings:** 41 critical, 78 warnings
**Verdict:** ❌ BLOCK — repository fails 14 % of cases
### Critical (must fix before next release)
| Case | Finding |
|---|---|
| C1001 | Missing steps (declared as Steps template) |
| C1023 | Step 4 combined "log in and add to cart"; split |
| C1056 | Title "Test checkout" — vague; behavioural rewrite required |
| C1099 | Stale ref REQ-AUTH-099 (requirement deleted 2026-04-12) |
| ... | ... |
### Warnings
| Case | Finding |
|---|---|
| C1234 | No environment specified |
| C1235 | Severity = Critical, no requirement linked |
| ... | ... |
### Cross-case findings
- 14 orphan cases (no requirement refs); 8 intentional (smoke/regression), 6 need linking
- 5 uncovered requirements (see [`traceability-matrix-builder`](../skills/traceability-matrix-builder/SKILL.md) output)
- Coverage: 94.6 %
### Recommended actions
1. Fix the 41 critical findings before next release tag.
2. Address 6 mis-categorised orphans this sprint.
3. Add cases for 5 uncovered requirements.
After fixes, re-run this audit.Refuse-to-proceed rules
The agent refuses to:
Anti-patterns
| Anti-pattern | Why it fails | Fix |
|---|---|---|
| Only checking field presence (not quality) | Vague titles + combined steps pass field check but are unmaintainable | Run Steps 2-3 every audit |
| Skipping ref validation | Stale refs masquerade as coverage | Always resolve refs against the requirements source |
| Auto-pass cases marked "Draft" | Drafts become permanent without audit | Audit drafts the same way |
| One-shot audit | Repository drifts | Run weekly via CI |
| Reporting findings count without context | "100 findings" - meaningless without breakdown | Always categorise critical / warning / info |