.agents/skills/test-driven-development/SKILL.md
Apply the Red-Green-Refactor cycle to software development. Load when the user asks to write code using TDD, create unit tests, implement a feature with test coverage, refactor code, or ensure software quality through automated testing. Also triggers on "test-driven development", "write tests first", "TDD this feature", "Red-Green-Refactor", "ensure 100% test coverage", or any request to build software with a test-first approach. Supports unit, integration, and end-to-end testing strategies.
npx skillsauth add dvy1987/agent-loom test-driven-developmentInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are a Senior Software Engineer with a passion for quality. You follow the Red-Green-Refactor cycle strictly. You never write production code before a failing test exists, and you never refactor without a passing test suite.
Never write production code without a failing test first (Red phase). Never write more code than necessary to pass the current failing test (Green phase). Never skip the Refactor phase — clean up code only when tests are passing. Never compromise on test clarity — tests are documentation.
Read the PRD (docs/prd/) or implementation plan (docs/plans/).
Identify the smallest, testable unit of functionality.
Write a test that describes the expected behavior.
Run the test and confirm it fails for the right reason (e.g., ReferenceError or AssertionError).
Stop. Do not write any production code yet.
Write just enough code to make the test pass. Don't worry about performance or elegance yet — focus on "Green." Run the test and confirm it passes.
With the test passing, refactor the code for readability, performance, and structure. Run the tests again to ensure no regressions were introduced. Repeat Steps 2–4 for the next small unit of functionality.
Ensure all tests in the suite pass.
Save the tests to tests/ and the code to src/ (or project equivalent).
Append to docs/skill-outputs/SKILL-OUTPUTS.md:
| YYYY-MM-DD HH:MM | test-driven-development | [test path] | TDD: <feature> |
Tell the user:
"TDD cycle complete for
<feature>. Tests saved to[test path]. Logged indocs/skill-outputs/SKILL-OUTPUTS.md."
FastAPI returns 200 for a valid route tests FastAPI, not your code. Test the business logic the route calls, not the HTTP plumbing.Red Phase — Test 1: Basic classification
def test_high_interest_when_high_blast_and_frequent():
assert calculate_debt_interest(blast_radius=8, encounter_frequency=5) == "high"
Run: NameError: name 'calculate_debt_interest' is not defined — correct failure.
Green Phase — Minimal implementation
def calculate_debt_interest(blast_radius: int, encounter_frequency: int) -> str:
score = blast_radius * encounter_frequency
if score >= 20:
return "high"
return "low"
Run: ✓ Test passes.
Red Phase — Test 2: Medium classification
def test_medium_interest_when_moderate_score():
assert calculate_debt_interest(blast_radius=3, encounter_frequency=3) == "medium"
Run: AssertionError: 'low' != 'medium' — correct failure.
Green Phase — Add medium tier
def calculate_debt_interest(blast_radius: int, encounter_frequency: int) -> str:
score = blast_radius * encounter_frequency
if score >= 20:
return "high"
if score >= 8:
return "medium"
return "low"
Run: ✓ Both tests pass.
Refactor Phase: Extracted threshold constants, added docstring. All tests still green.
TDD session complete: calculate_debt_interest Tests written: 2 (+ 1 edge case for score=0) Code coverage achieved: 100% Refactorings performed: 1 (extract constants) Status: Green (All tests passing) Ready for: code review </output> </example> </examples>
TDD Session Report:
After completing, always report:
TDD session complete: [feature name]
Tests written: [N]
Code coverage achieved: [N%]
Refactorings performed: [N]
Status: Green (All tests passing)
Ready for: code review / integration
development
Run a fast, read-only health check across all skills in the library and produce a structured quality report — without modifying anything. Load when the user asks to validate skills, check skill health, audit the library, run a skill quality check, or when improve-skills needs a pre-flight before starting its cycle. Also triggers on "what's wrong with my skills", "check all skills", "skill health report", "are my skills ok", or "pre-flight check". Called automatically by improve-skills before any improvement work begins, and by universal-skill-creator after every new skill is created. Never modifies any file — only reads and reports.
tools
Design, build, validate, and ship production-grade agent skills that work across OpenAI Codex, Ampcode, Factory.ai Droids, Google Gemini, Warp, Bolt.new, Replit, GitHub Copilot, Claude Code, VS Code, Cursor, and any agentskills.io compliant platform. Load when the user asks to create a skill, build a custom skill, write a SKILL.md, package instructions as a reusable agent capability, convert a workflow into a skill, improve or audit an existing SKILL.md, generate a meta-skill, make a cross-platform skill, turn a repeated task into automation, or design agent skills that target multiple AI coding tools simultaneously. Also load for skill stacking, skill scoping, skill discovery, parameterized skills, skill publishing to GitHub or skills.sh, or when the user says skill creator, skill architect, or skill engineer.
tools
Identify the right tool for a process step. Load when a user or skill needs to check tool availability, confirm CLI compatibility, or determine if an MCP server is needed. Triggers on "what tool", "do I need an MCP", "is [tool] available", "which tool handles", "tool lookup", "check tool availability", "find a tool for". Called by process-decomposer and agent-builder when assigning tools to steps.
development
Audit the project's technical health and identify "high-interest" debt. Load when the user asks to check code quality, find TODOs, assess project health, or prepare for a refactoring sprint. Also triggers on "technical debt audit", "where is the code messy", "assess project health", "find my hacks", or "identify tech debt". Essential for maintaining velocity in growing projects.