greglas75/zuvo/fix-tests
Claude Code and agent skill by greglas75/zuvo
- community
Checking that the SKILL.md file is still in the repository.
Batch repair of systematic test quality issues. Detects anti-patterns across the test suite, then fixes one pattern at a time with production context. Modes: --triage (scan all patterns, report counts), --pattern [ID] [path] (fix specific pattern), --dry-run (preview changes), --bundle-gates (fix pattern plus adjacent quality gaps).
Install
npx vskill@latest install greglas75/zuvo/fix-testsSKILL.md
The same SKILL.md was published earlier as greglas75/zuvo/fix-tests.
zuvo:fix-tests — Batch Test Repair
Fixes systematic test quality problems in batches. Targets one anti-pattern at a time, reads production context for each affected file, rewrites the broken assertions, and verifies the fixes pass.
Scope: Post-generation test suites where the same anti-pattern appears across many files. One pattern per run, applied surgically to every matching file. Out of scope: Writing tests from scratch (use zuvo:write-tests), auditing test quality without fixing (use zuvo:test-audit), general code review (use zuvo:review).
Argument Parsing
Parse $ARGUMENTS for mode, pattern ID, and scope:
| Argument | Behavior | |
|---|---|---|
_(empty)_ or --triage | Scan all known anti-patterns, report counts, then fix every pattern with a non-zero count (no menu — see Step 1) | |
--pattern [ID] | Fix the specified pattern across all matching test files | |
--pattern [ID] [path] | Fix the pattern, scoped to the given directory | |
--dry-run | Show triage counts and affected files, do not modify anything | |
--bundle-gates | When fixing a pattern, also apply adjacent quality gates (Q7 error tests, Q12 symmetry) |
Default with no arguments: --triage.
Supported Patterns
Dispatch follows ../../shared/includes/execution-policy.md through env-compat. Reuse existing authorization within that policy; session restrictions take precedence. Run each required gate and report its actual independence or an unmet requirement.
| ID | Name | What it fixes | |
|---|---|---|---|
| P-41 | Loading-only assertions | Tests that only check state.loading instead of verifying payload and state fields | |
| P-40 | Wrong initial state | Tests using incorrect initialState shape, missing fields or wrong defaults | |
| P-43 | getByTestId overuse | Brittle testId selectors where semantic queries (getByRole, getByLabelText) are available | |
| P-44 | Missing rejected state | Async thunks with no rejection test -- adds mockRejectedValue paths | |
| P-45 | Shallow empty state | Empty-state tests that only assert absence (not.toBeInTheDocument) without verifying placeholder content | |
| P-46 | No validation recovery | Form tests that show validation errors but never test clearing them | |
| P-62 | Over-mocking | Files with more than 15 mock declarations -- consolidate or replace with real implementations | |
| P-63 | Silent E2E conditionals | E2E tests with if (isVisible()) guards that silently skip assertions | |
| P-64 | Hardcoded credentials | Passwords and secrets as string literals in test files | |
| P-65 | Under-tested API routes | Route handler tests with fewer than 6 test cases | |
| P-68 | Mocking own code | Mocks of internal services/utils that could use real implementations. (Same smell as the canonical AP30; keep the P-68 ID here since the fix recipes are keyed to it.) | |
| P-70 | Tautological oracle | Expected values computed from the same formula as the production code | |
| G-43 | Opaque dispatch | Tests asserting typeof dispatch === 'function' instead of verifying dispatch arguments | |
| AP2 | Conditional assertions | if (x) { expect(...) } patterns that silently skip when the condition is false | |
| AP5 | as-any mock casts | as any or as never casts on mock objects instead of typed factories | |
| AP10 | Tautological mock | Test exercises only the mock — calls it, then asserts it was called; no production code runs. (The weaker "toHaveBeenCalled() with no CalledWith" case is the Q3-CalledWith row below — it used to sit here under AP10, which collided with the canonical meaning.) | |
| AP14 | toBeDefined sole assertion | toBeDefined() or toBeTruthy() as the only assertion in a test | |
| AP21 | Raw mock.calls index | Direct .mock.calls[0][1] access instead of toHaveBeenNthCalledWith | |
| NestJS-P3 | Self-mock | spyOn(service, method) mocking the service under test instead of its dependencies | |
| Q3-CalledWith | Bare toHaveBeenCalled | Files with toHaveBeenCalled() but zero CalledWith assertions | |
| Q7-API | No error tests | API wrapper test files with zero mockRejectedValue / error path tests | |
| Q17-passthrough | No arg verification | NestJS controller tests with return-value assertions but no CalledWith on the service |
Environment Compatibility
Read ../../shared/includes/env-compat.md for agent dispatch, path resolution, and progress tracking.
CodeSift Integration
Read ../../shared/includes/codesift-setup.md for initialization.
Key tools for this skill:
| Step | Task | CodeSift tool | Fallback | |
|---|---|---|---|---|
| 1 | Pattern scanning | search_text(repo, query=<regex>, regex=true, file_pattern="*.test.*") | Grep | |
| 2 | Find production counterpart | find_references(repo, symbol_name=<import>) | Directory convention matching | |
| 3 | Read production context | get_file_outline(repo, file_path) + get_symbols(repo, symbol_ids=[...]) | Read full file | |
| 3 | State shape for Redux | get_symbol(repo, "initialState") | Read the slice file | |
| 3 | Component elements | get_symbol(repo, <component_jsx_return>) | Read the component | |
| 3 | Batch function reads | get_symbols(repo, symbol_ids=[...]) | Multiple Read calls |
Mandatory File Loading
Before starting, read the applicable files:
Core (always required):
Conditional (loaded when the pattern requires domain knowledge):
| File | Load when | |
|---|---|---|
| Domain test patterns (Redux) | Pattern is P-40, P-41, P-44, G-43 | |
| Domain test patterns (NestJS) | Pattern is NestJS-P3, Q17-passthrough |
Artifact Contract
Session progress persists to memory/fix-tests-progress.md:
Triage populates Files Found. The report step updates Fixed/Skipped/Needs Review and Last Run.
Multi-Pattern Loop
Loop ownership by environment:
| Environment | Who owns the loop | Agent behavior | |
|---|---|---|---|
| Claude Code | Agent (after Step 6) | Complete pattern, check remaining, start next if needed | |
| Codex | External loop | Complete one pattern, stop. Loop restarts if patterns remain | |
| Cursor | External hook | Complete one pattern, stop. Hook restarts if patterns remain |
Knowledge Prime
Run the knowledge prime protocol from knowledge-prime.md:
Backlog Snapshot
Once, at the run's original start, before any backlog-add call: R='<absolute repo root>'; git -C "$R" status --porcelain -uall -- memory/, R being the root of the checkout being fixed (a linked worktree's own root), assigned in the same shell call. Print the output under a backlog-snapshot: heading and save it the same way, verbatim, as a fenced block under that heading below the table in memory/fix-tests-progress.md, the resume state (an empty snapshot is an empty block; never collapse it onto one line or a table row). A resumed run (or a Codex/Cursor restart per pattern) reads that block and never takes a new snapshot (backlog-protocol.md "Filing from a skill", Committing what backlog-add wrote); if the block is missing or the snapshot command fails, the run stages nothing at the end and lists its wrote= paths, as the protocol's failed-snapshot rule says.
Step 1: Triage
Scan for all supported patterns using grep (or CodeSift search_text). Report counts per pattern before doing any fixing.
For each pattern, run the detection command and count matches. Report format:
Triage mode: Show the full report, then fix every pattern with a non-zero count, highest count first, without asking. no-pause-protocol.md is loaded as a HARD include and names this skill in scope: presenting an (all / list IDs) menu is precisely the approval-gate it forbids, and on Codex/Cursor — which run non-interactively — the question is answered by nobody and the run stalls having fixed nothing. A user who wants a subset asks for it up front with --pattern [ID]; a user who wants counts only asks with --dry-run. Pattern mode: Report only the count for the specified pattern, proceed to Step 2. Dry-run mode: Show triage report and affected file list, then STOP.
Step 2: Identify Affected Files
For the chosen pattern, collect the specific file paths (not just counts).
For each affected test file, find its production counterpart:
- Convention matching:
profileSlice.test.tsmaps toprofileSlice.ts __tests__/convention:__tests__/MyComponent.test.tsxmaps toMyComponent.tsx- If production file not found:
- Patterns needing production context (P-41, G-43, P-40, P-43, P-44, P-45, P-46, AP10, NestJS-P3, AP14, Q7-API, AP5, Q3-CalledWith, P-65, Q17-passthrough, P-68): mark as ORPHAN, skip
- Mechanical patterns (AP2, AP21, P-62, P-63, P-64): proceed without production file
Step 3: Read Production Context
For each (test file, production file) pair, extract the information needed for the fix. What to read depends on the pattern:
| Pattern | Production context needed | |
|---|---|---|
| P-41 | State interface -- all fields and their types | |
| G-43 | Component -- which thunks are dispatched and with what arguments | |
| P-40 | Slice initialState -- exact shape and default values | |
| P-43 | Component JSX -- roles and labels on interactive elements | |
| P-44 | Thunk definitions -- what each createAsyncThunk returns and rejects with | |
| P-45 | Component -- what renders in the empty state (text, placeholders) | |
| P-46 | Form component -- validation errors and their clear conditions | |
| AP10 | Service method signatures -- parameter types and return types | |
| NestJS-P3 | Service -- which methods are dependencies vs owned logic | |
| Q7-API | API wrapper -- which methods make external calls and what errors they can throw | |
| Q3-CalledWith | Production method -- what arguments it passes to its dependencies | |
| P-65 | Route handler -- auth, validation, and error paths | |
| Q17-passthrough | Controller + service -- what arguments flow from controller to service | |
| AP5 | Type definitions of mocked dependencies | |
| P-68 | Service implementation -- determine if the mocked code can run without infrastructure | |
| P-70 | Spec or domain knowledge -- determine correct expected values independent of implementation |
Step 4: Batch Fix
Group affected files into batches of 5. Process each batch:
- Read the test file
- Identify every instance of the target pattern
- Rewrite each instance using the production context from Step 3
- Preserve surrounding test structure -- do not reorganize unrelated code
Fix Principles
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/fix-tests/SKILL.md
Popularity
- Repository stars
- 8
- 7-day trend score
- 11
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/greglas75/zuvo/fix-tests)