agentleFS
vpeetla-aivpeetla-ai/react-agent-pattern/.cursor/skills/tdd-agent-loops/SKILL.md

tdd-agent-loops

Skill2 starsChanged 4 months agoMITView on GitHub

Test-driven development for agent systems: red-green-refactor on graphs, mocked LLM fixtures, pytest-asyncio, trace assertions. Use when adding agent nodes, fixing loop bugs, or building pattern repos.

Files
SKILL.md

TDD for Agent Loops

Inspired by mattpocock/skills tdd — adapted for LangGraph.

Red → Green → Refactor

  1. Red — Write failing test for routing or node output (mock LLM)
  2. Green — Minimal node/routing fix
  3. Refactor — Extract helpers only when second test needs it

What to test

LayerTest
Routingroute_after_quality returns retry/pass/escalate
NodesGiven state in, partial state out (no real LLM)
IntegrationFull graph with FakeLLM fixture
Repo-fixClone fixture repo, assert branch + patch count

Fixtures

@pytest.fixture
def fake_llm():
    return FakeLLM(responses=[{"content": "..."}])

Async

@pytest.mark.asyncio
async def test_graph_happy_path(tmp_path):
    ...

Avoid

  • Tests that only assert "graph compiles"
  • Snapshotting full LLM prose (flaky)
  • Hitting live Groq in CI

Reference

  • loop-engine-agent-platform/tests/test_repo_fix.py
  • *-agent-pattern/tests/ — minimal pattern coverage

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.