Automated Test-Fix Loop

Orchestrate test-fail-issue-fix loops with GitHub issues and Claude Code.

6|Updated Oct 27, 2025
One-click install
npx skills add https://github.com/lawless-m/claude-skills --skill automated-test-fix-loop
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Automated Test-Fix Loop
Source: https://github.com/lawless-m/claude-skills/tree/main/.claude/skills/auto-testing
Command: npx skills add https://github.com/lawless-m/claude-skills --skill automated-test-fix-loop

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a repeatable pattern to automatically run tests, detect failures, create GitHub issues with detailed context, invoke Claude Code for fixes, and re-run tests until all pass.

Core Features & Use Cases

  • Automated Test‑→ Fail → Issue → Fix → Test loop orchestrated via starter scripts
  • GitHub integration to create issues with rich context when tests fail
  • Claude Code powered fixes to drive automated debugging and patching
  • CI/CD friendly workflow that can run overnight or in PR pipelines

Quick Start

  1. Create run-tests.sh, fix-issue.sh, and auto-fix-loop.sh templates in your repo.
  2. Configure TIMEOUT_SECONDS and the test command for your language (e.g., cargo test for Rust).
  3. Run ./run-tests.sh to start the loop; on failure, a GitHub issue will be created and an automated fix will be attempted.

Frequently Asked Questions about Automated Test-Fix Loop

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate running tests and fixing failures in CI/CD?

Automated test-fix loops orchestrate continuous testing by running tests, detecting failures, creating GitHub issues with context, and invoking Claude Code to attempt fixes before re-running tests. This pattern works across languages by configuring your test command and timeout settings in starter scripts.

Can I use Claude Code to automatically debug and patch failing tests?

Yes. The workflow invokes Claude Code as a fixer component that receives detailed issue context from GitHub and generates patches. Tests re-run after each fix attempt, creating a feedback loop until all tests pass or the loop exhausts configured attempts.

How do I set up automatic GitHub issue creation when tests fail?

Configure the GitHub integration component to create issues with rich failure context when tests fail. The workflow captures test output, stack traces, and environment details, then attaches this context to the issue so Claude Code has sufficient information to diagnose and fix the root cause.

What languages and test frameworks does this work with?

The workflow supports any language by letting you configure the test command—cargo test for Rust, npm test for Node, pytest for Python, and so on. The modular design is test-framework agnostic; timeout and permission modes adapt to your CI/CD environment.

Can I run the test-fix loop overnight or in pull request pipelines?

Yes. The CI/CD-friendly workflow is designed for both overnight regression testing and PR pipelines. Configurable timeouts and permission modes let you control loop duration, fix scope, and GitHub interaction within your deployment constraints.

What happens if Claude Code cannot fix a failing test?

The loop respects configured timeouts and attempt limits. If fixes don't resolve the failure, the GitHub issue persists with all diagnostic context for manual review. The workflow gracefully halts rather than looping indefinitely, leaving the issue for developer triage.