TDD Loop

Applies test-driven development: write a failing test first, implement the minimum code to pass it, then refactor.

AI Agents / Developmentai-agentsdevelopment
by AgentVoltv1.0.0Published 1y ago1 install
Free to sign up · every skill included with AgentVolt Pro

Before & after

Same prompt, same agent — the only difference is the skill.

PromptDesign a test suite for a user authentication module.
Beforegeneric AI agent
Test-driven development is an important methodology for writing reliable code. When building a user auth module, you'll want to think about what the key behaviors are that need to be tested. Some good starting points might be testing login flows, verifying that passwords are handled securely, and making sure user sessions work correctly. You could also consider edge cases like invalid inputs or network failures. There are various testing frameworks available depending on your language choice. Would you like me to help you explore which testing approach might work best for your use case?
Afterwith TDD Loop
TDD WORKFLOW FOR AUTH MODULE:

1. TEST LAYER DESIGN
   Start with test names that express behavior, not implementation:
   • describe('UserAuthService', () => {)
   • it('rejects login with invalid email format')
   • it('hashes password before storage using bcrypt')
   • it('expires session token after 24 hours')
   • it('throws specific error for locked account')

2. RED PHASE - Write failing tests first
   Define the exact contract your auth module must fulfill before touching implementation code. Test names should read like requirements.

3. GREEN PHASE - Minimal implementation
   Add only the code needed to pass tests. Skip validation logic, error paths, and edge cases not yet tested.

4. REFACTOR PHASE - Improve without changing behavior
   Reduce duplication between tests. Extract test fixtures. Move mock setup to beforeEach blocks.

5. COVERAGE CHECKLIST
   Root cause bugs by testing inverted assumptions: test that password comparison fails with wrong hash, test that token expiry actually rejects expired tokens, not just accepts valid ones.

Priority sequence: auth happy path → security constraints → error messages → rate limiting.

About this skill


name: tdd description: Use when Structured Claude skill that gives Claude a repeatable workflow for tdd.

Tdd

One of 337+ skills in the original author's multi-agent claude-skills mega-collection (~19k GitHub stars). Packages the Tdd workflow with its own instructions and validation so outputs stay consistent.

What you get

  • Public GitHub repo (alirezarezvani/claude-skills)
  • the tdd skill folder with SKILL.md. Part of a 337-skill / 30-agent / 70-command install.

Customize your output

  • Fork the repo and adapt the skill's instructions and references to your workflow.

Example output

Activates automatically when your request matches Tdd; chains with the other skills, agents, and commands in the collection.

Best for

Creators, builders, and teams using Claude Code.

SKILL.md preview

SKILL.md
---
name: tdd
description: Use this skill when a task calls for test-driven development, writing failing tests first and implementing only enough code to pass them.
version: 1.0.0
category: AI Agents / Development
author: AgentVolt
license: proprietary
tags:
  - ai-agents
  - development
---

# Tdd

Applies test-driven development: write a failing test first, implement the minimum code to pass it, then refactor.

## When to use

… (sign up to view the full skill)
Sign up to view, copy, and install the full skill

More ai & agents skills

View all AI & Agents skills →