SkillsLib.ai

Tdd

Write tests first, then code using strict red-green-refactor TDD workflow

4.4(44 reviews)
1,000+ downloads
Updated Oct 2026
Verified SafeSecurity VerifiedThis skill was analyzed by our AI security scanner for harmful content including data exfiltration, system manipulation, credential theft, and prompt injection. No threats were detected.

What You Can Do

You'll follow the strict TDD workflow: write a failing test that defines expected behavior, verify it fails, write minimal production code to pass the test, then refactor for quality. This approach ensures complete test coverage, catches bugs early, and produces well-designed code backed by comprehensive test suites. Claude guides you through each phase with examples and enforces TDD principles to prevent shortcuts.

Features

Red-Green-Refactor cycle guidance

structured prompts for writing failing tests, implementing minimal code, and refactoring safely

Test-first enforcement

ensures production code only exists to satisfy failing tests, with no exceptions

Philosophy guide

explains TDD principles and the 'Iron Law' to build discipline and understanding

Real code examples

shows good vs. bad test patterns with TypeScript/JavaScript examples

Bug fix regression testing

applies TDD to fixes, ensuring bugs don't reoccur

Test quality standards

teaches how to write clear, behavior-focused tests without over-mocking

Workflow validation

confirms each phase is complete before moving to the next

Example Output

Example 1: Retry Logic Feature

code
// RED: Write failing test
test('retries failed operations 3 times', async () => {
  let attempts = 0;
  const operation = () => {
    attempts++;
    if (attempts < 3) throw new Error('fail');
    return 'success';
  };
  const result = await retryOperation(operation);
  expect(result).toBe('success');
  expect(attempts).toBe(3);
});

// GREEN: Implement minimal code
export async function retryOperation(fn, maxRetries = 3) {
  for (let i = 0; i < maxRetries; i++) {
    try {
      return await fn();
    } catch (e) {
      if (i === maxRetries - 1) throw e;
    }
  }
}

// REFACTOR: Improve design and clarity

Example 2: Form Validation

code
// Test validates email format before implementation exists
test('validates email format', () => {
  expect(isValidEmail('user@example.com')).toBe(true);
  expect(isValidEmail('invalid.email')).toBe(false);
});

What's Included

  • SKILL.md: complete TDD workflow with philosophy, Red-Green-Refactor cycle, and enforcement rules
  • Test writing template: structure for clear, behavior-focused test cases
  • Implementation checklist: steps for RED phase, GREEN phase, and REFACTOR phase
  • Good vs. bad patterns guide: examples of proper TDD vs. anti-patterns
  • Bug fix workflow: regression test template for fixing issues TDD-style

Who It's For

  • Backend engineers building APIs and services with full test coverage
  • Frontend developers implementing interactive components with predictable behavior
  • QA/test engineers designing feature test strategies before coding
  • Full-stack developers maintaining projects where regressions are costly
  • Technical leads enforcing code quality and testability standards

Best For

  • Building new features with critical reliability requirements
  • Fixing bugs while preventing regressions
  • Refactoring legacy code with test safety nets
  • Teaching testing discipline and best practices
  • Ensuring production code quality in mission-critical systems

You might also like

Slash Commands
$35
Tooling4.5(50)
Slash Commands

You can create reusable slash commands that execute instantly in Claude Code conversations. Commands support bash execution, file references, arguments, and tool permissions. Use built-in commands like /cost, /review, /memory, and /clear, or define custom project and personal commands stored in .claude/commands/ or ~/.claude/commands/.

Quantum-Entangled Claim Analysis for Construction Disputes
$25
Quantum3.3(28)
Quantum-Entangled Claim Analysis for Construction Disputes

This skill maps construction claims as interdependent probability states rather than isolated analyses, allowing you to evaluate how changes in one contractual interpretation cascade through damages calculations, delay causation, and liability allocation. You can simultaneously model competing scenarios—concurrent causation, ambiguous change order triggers, insurance coverage dependencies—and identify which settlement positions minimize exposure across all correlated outcomes, not just single interpretations.

Prove
$25
Backend4.4(46)
Prove

You can formally verify mathematical proofs by translating theorems into Lean 4 code, leveraging Mathlib's extensive library of formalized mathematics. The skill guides you through researching existing lemmas, designing proof strategies, testing approaches, implementing formal proofs, and verifying correctness—turning informal mathematical claims into machine-checked theorems without requiring deep Lean syntax expertise.

Construction Estimate Analysis & Refinement
$35
Estimating4.0(34)
Construction Estimate Analysis & Refinement

You can systematically analyze construction estimates by breaking down components, validating labor and material pricing against market data, identifying embedded errors or outdated assumptions, and applying data-driven contingency allocation. Claude helps you produce risk-adjusted cost projections that are defensible to stakeholders and competitive in bid scenarios, reducing estimate variance and catching pricing gaps before client submission.

Bid Assembly & Analysis for Preconstruction Estimates
$40
Bid Assembly & Analysis for Preconstruction Estimates

You can rapidly process multiple subcontractor bid responses—from trade contractors, material suppliers, and specialty vendors—into a cohesive, auditable estimate structure. Claude extracts key bid components, identifies pricing inconsistencies against benchmarks or prior projects, flags scope gaps and exclusions, and organizes everything by CSI division for seamless estimate assembly. This eliminates manual spreadsheet comparison and reduces the risk of overlooked scope omissions or pricing anomalies when managing 15+ concurrent bids.

Implement Task
$35
Full-Stack4.6(48)
Implement Task

You can deploy this agent to execute specific implementation tasks within a larger development plan. It operates independently with fresh context, follows test-driven development principles for every code change, and creates comprehensive handoff documentation that captures progress, decisions, and learnings for the next task executor. This ensures consistent code quality, prevents rework, and maintains continuity across distributed implementation efforts.

Unit Test Generator
$25
Unit Test Generator

This skill analyzes your functions and classes to generate exhaustive unit tests that maximize coverage and catch regressions. It systematically identifies logical branches, input variations, and failure modes—then produces framework-specific test code with proper setup/teardown and mocks. Your tests are immediately runnable with clear assertions and meaningful error messages.

Pict Test Designer
$30
Pict Test Designer

You can systematically design test cases for any feature or system by analyzing requirements or code to extract test parameters, values, and business constraints. The skill generates a PICT model, executes pairwise testing logic to minimize test case count while maximizing coverage, and delivers a formatted test matrix with expected results—reducing manual test design effort while ensuring comprehensive scenario coverage.

$35.00