greglas75/zuvo/fix-tests

Claude Code and agent skill by greglas75/zuvo

Trust tier 2
  • community
LLM review pending
Source check pending

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-tests

SKILL.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:

ArgumentBehavior
_(empty)_ or --triageScan 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-runShow triage counts and affected files, do not modify anything
--bundle-gatesWhen 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.

IDNameWhat it fixes
P-41Loading-only assertionsTests that only check state.loading instead of verifying payload and state fields
P-40Wrong initial stateTests using incorrect initialState shape, missing fields or wrong defaults
P-43getByTestId overuseBrittle testId selectors where semantic queries (getByRole, getByLabelText) are available
P-44Missing rejected stateAsync thunks with no rejection test -- adds mockRejectedValue paths
P-45Shallow empty stateEmpty-state tests that only assert absence (not.toBeInTheDocument) without verifying placeholder content
P-46No validation recoveryForm tests that show validation errors but never test clearing them
P-62Over-mockingFiles with more than 15 mock declarations -- consolidate or replace with real implementations
P-63Silent E2E conditionalsE2E tests with if (isVisible()) guards that silently skip assertions
P-64Hardcoded credentialsPasswords and secrets as string literals in test files
P-65Under-tested API routesRoute handler tests with fewer than 6 test cases
P-68Mocking own codeMocks 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-70Tautological oracleExpected values computed from the same formula as the production code
G-43Opaque dispatchTests asserting typeof dispatch === 'function' instead of verifying dispatch arguments
AP2Conditional assertionsif (x) { expect(...) } patterns that silently skip when the condition is false
AP5as-any mock castsas any or as never casts on mock objects instead of typed factories
AP10Tautological mockTest 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.)
AP14toBeDefined sole assertiontoBeDefined() or toBeTruthy() as the only assertion in a test
AP21Raw mock.calls indexDirect .mock.calls[0][1] access instead of toHaveBeenNthCalledWith
NestJS-P3Self-mockspyOn(service, method) mocking the service under test instead of its dependencies
Q3-CalledWithBare toHaveBeenCalledFiles with toHaveBeenCalled() but zero CalledWith assertions
Q7-APINo error testsAPI wrapper test files with zero mockRejectedValue / error path tests
Q17-passthroughNo arg verificationNestJS 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:

StepTaskCodeSift toolFallback
1Pattern scanningsearch_text(repo, query=<regex>, regex=true, file_pattern="*.test.*")Grep
2Find production counterpartfind_references(repo, symbol_name=<import>)Directory convention matching
3Read production contextget_file_outline(repo, file_path) + get_symbols(repo, symbol_ids=[...])Read full file
3State shape for Reduxget_symbol(repo, "initialState")Read the slice file
3Component elementsget_symbol(repo, <component_jsx_return>)Read the component
3Batch function readsget_symbols(repo, symbol_ids=[...])Multiple Read calls

Mandatory File Loading

Before starting, read the applicable files:

Core (always required):

CORE FILES LOADED:
1. ../../rules/testing.md -- [READ | MISSING -> STOP]
2. ../../shared/includes/quality-gates.md -- [READ | MISSING -> STOP]
3. ../../shared/includes/run-logger.md -- [READ | MISSING -> STOP]
4. ../../shared/includes/knowledge-prime.md -- READ/MISSING
5. ../../shared/includes/knowledge-curate.md -- READ/MISSING
6. ../../shared/includes/retrospective.md -- RETRO PROTOCOL
7. ../../shared/includes/no-pause-protocol.md -- READ/MISSING (HARD: no mid-batch pauses)
8. ../../shared/includes/test-bugfix-protocol.md -- READ/MISSING (in-run fix of surfaced production bugs)
9. ../../shared/includes/backlog-protocol.md -- READ/MISSING (out-of-scope items only)

Conditional (loaded when the pattern requires domain knowledge):

FileLoad 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:

# Fix-Tests Progress
| Pattern | Files Found | Fixed | Skipped | Needs Review | Last Run |
|---------|------------|-------|---------|-------------|----------|

Triage populates Files Found. The report step updates Fixed/Skipped/Needs Review and Last Run.


Multi-Pattern Loop

Loop ownership by environment:

EnvironmentWho owns the loopAgent behavior
Claude CodeAgent (after Step 6)Complete pattern, check remaining, start next if needed
CodexExternal loopComplete one pattern, stop. Loop restarts if patterns remain
CursorExternal hookComplete one pattern, stop. Hook restarts if patterns remain

Knowledge Prime

Run the knowledge prime protocol from knowledge-prime.md:

WORK_TYPE = "implementation"
WORK_KEYWORDS = <keywords from user request>
WORK_FILES = <files being touched>

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 RESULTS
-----
AP10 (delegation-only): [N] files -> [Fix | Skip]
AP14 (toBeDefined sole): [N] files -> [Fix | Skip]
P-41 (loading-only): [N] hits in [M] files -> [Fix | Skip]
Q7-API (no rejection): [N] api wrapper files -> [Fix | Skip]
...
-----

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.ts maps to profileSlice.ts
  • __tests__/ convention: __tests__/MyComponent.test.tsx maps to MyComponent.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:

PatternProduction context needed
P-41State interface -- all fields and their types
G-43Component -- which thunks are dispatched and with what arguments
P-40Slice initialState -- exact shape and default values
P-43Component JSX -- roles and labels on interactive elements
P-44Thunk definitions -- what each createAsyncThunk returns and rejects with
P-45Component -- what renders in the empty state (text, placeholders)
P-46Form component -- validation errors and their clear conditions
AP10Service method signatures -- parameter types and return types
NestJS-P3Service -- which methods are dependencies vs owned logic
Q7-APIAPI wrapper -- which methods make external calls and what errors they can throw
Q3-CalledWithProduction method -- what arguments it passes to its dependencies
P-65Route handler -- auth, validation, and error paths
Q17-passthroughController + service -- what arguments flow from controller to service
AP5Type definitions of mocked dependencies
P-68Service implementation -- determine if the mocked code can run without infrastructure
P-70Spec or domain knowledge -- determine correct expected values independent of implementation

Step 4: Batch Fix

Group affected files into batches of 5. Process each batch:

  1. Read the test file
  2. Identify every instance of the target pattern
  3. Rewrite each instance using the production context from Step 3
  4. 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

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
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/greglas75/zuvo/fix-tests/badge)](https://verified-skill.com/skills/greglas75/zuvo/fix-tests)

Something wrong with this skill or its page? Tell us.