Skip to content
Back to skills

Tdd Loop

ASecurity

Implement a known feature, behavior change, or diagnosed bug with a red-green-refactor loop. Use when the user asks to add, build, implement, or fix behavior and automated tests exist or should exist. For an unknown failure cause use debug-protocol first; for model, prompt, RAG, or agent quality use evaluate-ai-changes alongside deterministic tests.

  • 2 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 19, 2026
ai-agentsgitapidatabase

Works with

  • api

Security analysis

A100/100

Scanned September 19, 2026

npx -y skills add adityaarakeri/senior-agent-skills --skill tdd-loop --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Tdd Loop?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Tdd Loop
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/adityaarakeri-tdd-loop/badge)](https://www.skillsdirectory.com/skills/adityaarakeri-tdd-loop)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: tdd-loop
description: Implement a known feature, behavior change, or diagnosed bug with a red-green-refactor loop. Use when the user asks to add, build, implement, or fix behavior and automated tests exist or should exist. For an unknown failure cause use debug-protocol first; for model, prompt, RAG, or agent quality use evaluate-ai-changes alongside deterministic tests.
---

# TDD Loop

Use a failing behavior test as the executable specification.

## Preserve Scope and State

- Inspect existing tests, commands, conventions, and worktree state before editing.
- Preserve unrelated changes. Do not create branches, stage, commit, sync remotes, or push unless the user explicitly requests that git workflow.
- If no test framework exists, prefer an existing dependency-free mechanism. Ask before adding a new framework or dependency.

## Red-Green-Refactor

1. **Red:** Write the smallest test that demonstrates one missing behavior. For a diagnosed bug, preserve the reproduction as a regression test.
2. **Observe:** Run the test and confirm it fails for the intended assertion, not setup, import, fixture, or environment noise. If it passes, determine whether the behavior already exists or the test is ineffective.
3. **Green:** Implement the minimum production change that satisfies the behavior.
4. **Expand:** Run the focused test, adjacent tests, and the relevant suite. Add contract or integration coverage when behavior crosses a process, network, database, filesystem, or public API boundary.
5. **Refactor:** Improve structure while all tests remain green. Use logical working-tree checkpoints; commit only when separately authorized.
6. Repeat for the next independently verifiable behavior.

## Protect Test Integrity

- Do not weaken, delete, skip, or broadly mock an assertion to manufacture green.
- Mock expensive collaborators, not the unit or behavior under test.
- Prefer observable outcomes over implementation-call assertions.
- Add characterization tests before changing poorly understood legacy behavior.
- Control time, randomness, concurrency, and external services where possible. For inherently stochastic AI behavior, use repeated evaluations through `evaluate-ai-changes` rather than pretending one unit test proves quality.
- Treat a painful test as design feedback, not permission to skip coverage.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.