AL

Agent Test-Driven Red-Green-Refactor Loop

Force Claude to design an interface, confirm behaviors to test, then loop red, green, refactor one test at a time.

Engineeringp4matt-pocock
Or just install the prompt above — no subscription needed

About this skill


name: agent-tdd-red-green-refactor description: Force Claude to design an interface, confirm behaviors to test, then loop red, green, refactor one test at a time. Use when working on agent test-driven red-green-refactor loop.

Agent Test-Driven Red-Green-Refactor Loop

A meaty skill that folds in guidance on interfaces vs implementations, deep modules, and mocking. Claude confirms interface changes with you, designs for testability, writes a failing test, makes it pass, then evaluates refactor candidates. Best used to power autonomous Ralph loops so code quality stays high without human hand-holding. Use on any real production code where quality matters more than raw speed.

What you get

  • Test list
  • Running red-green-refactor log
  • Refactor candidates surfaced at loop end
  • Interface change summary
  • Mock inventory
  • Coverage delta

Customize your output

  • Test framework: Jest, Vitest, Pytest, XCTest, JUnit, other
  • Language: TypeScript, Python, Swift, Java, Go
  • Mocking rules: prefer stubs, prefer fakes, no mocks
  • Interface style: deep modules, wide flat
  • Tests per loop: 1, 3, 5
  • Coverage floor: 60, 80, 90 percent

Example output

'Failing test for parseDoc(). Minimal implementation. Second failing test for empty input. Refactor to extract tokenizer.'

Best for

Devs using Claude Code on real production repos where quality matters.


Note: Requires a codebase with clean module boundaries to shine. High confidence.

Source: Ian Nuttall · https://www.youtube.com/watch?v=EJyuu6zlQCg Category: Engineering · Priority: P4

SKILL.md preview

---
name: agent-tdd-red-green-refactor
description: Force Claude to design an interface, confirm behaviors to test, then loop red, green, refactor one test at a time. Use when working on agent test-driven red-green-refactor loop.
---

# Agent Test-Driven Red-Green-Refactor Loop

A meaty skill that folds in guidance on interfaces vs implementations, deep modules, and mocking. Claude confirms interface changes with you, designs for testability, writes a failing test, makes it pass, then evaluates refactor candidates. Best used to power autonomous Ralph loops so code quality stays high without human hand-holding. Use on any real production code where quality matters more than raw speed.

## What you get

- Test list
- Running red-green-refactor log
- Refactor candidates su...