test-and-fix

test-and-fix is a skill for Claude Code from yu-iskw/coding-agent-fabric. It costs 41 tokens per session (489 once invoked), scanned A, a copy of test-and-fix, Apache-2.0.

An automated loop that runs Vitest tests, investigates failures, makes the smallest needed code or test change, and runs the tests again. Vitest is a JavaScript and TypeScript test runner.

In plain words
What is it for?
Use it after adding features, when unit tests fail, or when regression tests need repair. It stops when tests pass or repeated attempts still cannot resolve the problem.
Why use it?
It handles the repeated test-failure and recheck cycle, helping distinguish a code bug from an outdated test.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

Good fit Use it after adding features, when unit tests fail, or when regression tests need repair. It stops when tests pass or repeated attempts still cannot resolve the problem.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/yu-iskw/coding-agent-fabric/test-and-fix
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add yu-iskw/coding-agent-fabric --skill test-and-fix
Clone the repo
git clone --depth 1 https://github.com/yu-iskw/coding-agent-fabric

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for test-and-fix

README.md
[![agentmods](https://agentmods.dev/badge/skills/yu-iskw/coding-agent-fabric/test-and-fix.svg)](https://agentmods.dev/skills/yu-iskw/coding-agent-fabric/test-and-fix)
Your own site
<a href="https://agentmods.dev/skills/yu-iskw/coding-agent-fabric/test-and-fix"><img src="https://agentmods.dev/badge/skills/yu-iskw/coding-agent-fabric/test-and-fix.svg" alt="Measured on agentmods" height="20"></a>
Per session 41 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 489 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00041 $0.00489
Opus 5 $0.00020 $0.00244
Sonnet 5 $0.00008 $0.00098
Haiku 4.5 $0.00004 $0.00049

Measured 6d ago against content hash fad7ac48f637, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

test-and-fix scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

100% identical to test-and-fix — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.claude/skills/test-and-fix/SKILL.md · 49 lines

What it actually says

Test and Fix Loop

Purpose

An autonomous loop for the agent to identify, analyze, and fix failing unit tests using Vitest.

Loop Logic

  1. Identify: Run pnpm test to identify failing tests.
  2. Analyze: Examine the test output to determine:
  3. Fix: Apply the minimum necessary change to either the source code (if it's a bug) or the test code (if the test is outdated).
  4. Verify: Re-run pnpm test.
    • If passed: Move to the next failing test or finish if all are resolved.
    • If failed: Analyze the new failure (or the same one if the fix was insufficient) and repeat the loop.

Termination Criteria

  • All tests pass (as reported by pnpm test).
  • Reached max iteration limit (default: 5).
  • The error persists after multiple distinct fix attempts, indicating a need for human intervention or a broader architectural change.

Examples

Scenario: Fixing a logic error

  1. pnpm test fails in packages/common/src/math.test.ts because add(2, 2) returned 5.
  2. Agent analyzes packages/common/src/math.ts and finds a typo a + b + 1.
  3. Agent fixes the typo to a + b.
  4. pnpm test passes.

Scenario: Updating a test after a deliberate change

  1. pnpm test fails because a UI component's text changed from "Submit" to "Confirm".
  2. Agent confirms the change was intentional.
  3. pnpm test passes.

Resources

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 49 lines · 41 tokens per session scan A fad7ac48f637

Subscribe to this mod's changes

test-and-fix is a skill published in the GitHub repository yu-iskw/coding-agent-fabric (1 stars, last pushed 6d ago), licensed Apache-2.0. It adds 41 tokens to every session and 489 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to test-and-fix, differing in 0 lines, and is treated as a copy.