fix-failing-tests

fix-failing-tests is a skill for Claude Code, Codex from KnoxOps/agent-runbook. It costs 17 tokens per session (632 once invoked), scanned A, original, Apache-2.0.

A guided process for fixing code when automated tests fail. It repeatedly runs the Python test suite, examines failures, changes the source code, and checks the results again.

In plain words
What is it for?
Use it to diagnose and repair bugs reported by pytest, the testing tool for Python. It is intended for projects where you want a repeatable test-and-fix loop.
Why use it?
It removes the need to handle test failures manually one by one. The goal is to keep working through the failures until all tests pass or the process reaches its iteration limit.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/knoxops/agent-runbook/output
Any agent
npx skills add KnoxOps/agent-runbook --skill output
Clone the repo
git clone --depth 1 https://github.com/KnoxOps/agent-runbook

Made for: Claude Code, Codex.

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/knoxops/agent-runbook/output.svg)](https://agentmods.dev/skills/knoxops/agent-runbook/output)
Your own site
<a href="https://agentmods.dev/skills/knoxops/agent-runbook/output"><img src="https://agentmods.dev/badge/skills/knoxops/agent-runbook/output.svg" alt="Measured on agentmods" height="20"></a>
Per session 17 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 632 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found 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 $0.00017 $0.00632
Opus 5 $0.00009 $0.00316
Sonnet 5 $0.00003 $0.00126
Haiku 4.5 $0.00002 $0.00063

Measured 4d ago against content hash f82b18609f23, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

fix-failing-tests 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 4d 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.

examples/fix-loop/output/SKILL.md · 105 lines

How it starts

The opening of the file, as written. The whole thing — 105 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Execution Flow

Task Context

Before starting execution, initialize task_context.json:

{
  "task_id": "<task_id from input>",
  "current_step": 0,
  "current_step_id": null,
  "status": "running",
  "steps": {
    "fix_loop": "pending",
    "present": "pending"
  },
  "updated_at": "<ISO timestamp>"
}

Update this file after each step completes. On error, set step status to "failed" and overall status to "failed".

Step 1: fix_loop

Type: loop Description: Run tests, analyze failures, fix source code, repeat until green

Iteration Loop

Goal: pytest exits with 0 failures (all tests pass) Max Iterations: 10

This step executes as a loop. The body steps repeat until the goal is met or max iterations reached.

Loop Body (repeats each iteration)

Body Step 1: run_tests

Type: script

Execution: Execute the following command:

cd examples/fix-loop && python3 -m pytest tests/ --tb=short 2>&1 | tail -60
Body Step 2: fix

Type: agent

Execution: Launch an independent agent with the following prompt file:

Look at the pytest failures from run_tests. Pick ONE source file that has failing tests and fix the bugs in that file.

Rules:

  • Only modify files in src/, NEVER modify test files
  • Fix exactly ONE file, then stop immediately
  • Do NOT read or modify any other source files

Goal Evaluation

After all body steps complete, evaluate:

Goal: pytest exits with 0 failures (all tests pass)

  1. If goal IS met → mark this step completed, proceed to next step.
  2. If goal NOT met and iterations remain → reset body steps, start next iteration.
  3. If max iterations reached → mark step completed with status "max_iterations_reached", report what remains.

Append a summary to iteration_history after each iteration.

Progress Tracking

After completing this step, update task_context.json:

  • Set current_step_id to "fix_loop"
  • Set steps.fix_loop to "completed"

Step 2: present

Read the full file on GitHub · 105 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 4d ago First seen · 105 lines · 17 tokens per session scan A f82b18609f23

Subscribe to this mod's changes

fix-failing-tests is a skill published in the GitHub repository KnoxOps/agent-runbook (17 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 17 tokens to every session and 632 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

design-taste-frontend

Anti-slop frontend skill for landing pages, portfolios, and redesigns. The agent reads the brief, infers the right design direction, and ships interfaces that do not look templated. Real design systems when applicable, audit-first on redesigns, strict pre-flight check.

Leonxlnx/taste-skill · 61 tokens

image-to-code

Elite website image-to-code skill for Codex. For visually important web tasks, it must first generate the design image(s) itself, deeply analyze them, then implement the website to match them as closely as possible. In Codex, it must prefer large, readable, section-specific images instead of tiny compressed boards…

Leonxlnx/taste-skill · 116 tokens

brandkit

Premium brand-kit image generation skill for creating high-end brand-guidelines boards, logo systems, identity decks, and visual-world presentations. Trained for minimalist, cinematic, editorial, dark-tech, luxury, cultural, security, gaming, developer-tool, and consumer-app brand systems. Optimized for intentional…

Leonxlnx/taste-skill · 89 tokens

minimalist-ui

Clean editorial-style interfaces. Warm monochrome palette, typographic contrast, flat bento grids, muted pastels. No gradients, no heavy shadows.

Leonxlnx/taste-skill · 34 tokens

edgeone skill scanner

Scan any agent skill for security risks before you install or use it. Powered by Tencent Zhuque Lab A.I.G (AI-Infra-Guard). 100% local static analysis — no file contents or credentials leave your device. Compatible with CodeBuddy, Cursor, Windsurf, Claude Code, OpenClaw and more. Triggers on: 这个 skill 安全吗, skill 安全扫描…

Tencent/AI-Infra-Guard · 148 tokens

rubber-duck

Adversarial "rubber duck" review that turns explaining-out-loud into a hallucination check. The main session is the PRESENTER (it did the work — a design doc, investigation, or analysis — and holds the real reasoning) and reconstructs the topic to a LISTENER — a spawned subagent pinned to a DIFFERENT-vendor model that…

kirodotdev/KiroCrew · 161 tokens