SkillsLib.ai

Tdd

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

4.4(44 reviews)
1,000+ downloads
Updated Nov 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/.

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.

Shapely Compute
$30
Shapely Compute

You can construct geometric objects (points, lines, polygons, multigeometries), execute boolean operations (intersection, union, difference), apply spatial predicates (contains, intersects, within), calculate measurements (area, length, distance, centroid), and transform geometries through translation, rotation, and scaling. This skill handles geometry validation, invalid geometry repair, and complex spatial analysis tasks.

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.

$45
Test Automation Strategy & Maintainable Test Suite Design

You can architect test automation frameworks tailored to your tech stack and design maintainable test suites from requirements. This skill helps you identify test patterns, eliminate flakiness, integrate with CI/CD pipelines, and build test infrastructure that scales with your codebase.

Test Driven Development
$45
Test Driven Development

You can enforce test-first development across multiple entry points: parse acceptance criteria from spec files and generate test stubs, extract requirements from task files and design test scenarios, or write tests from ad-hoc descriptions. Claude guides you through the complete TDD cycle—RED (failing tests), GREEN (minimal implementation), and REFACTOR (clean code)—while leveraging your existing repository patterns and providing proptest guidance for property-based testing.

Bid Assembly & Proposal Generation for Estimators
$30
Bid Assembly & Proposal Generation for Estimators

You can transform fragmented cost data, subcontractor quotes, and contingency calculations into cohesive, defensible bid packages that stakeholders understand and trust. This skill guides you through hierarchical cost aggregation, dynamic contingency modeling based on project risk, multi-tier markup application, and narrative integration that links scope assumptions to pricing—enabling you to develop competitive proposals with justified pricing strategies.

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.

$35.00