Coding Agents & IDEsDocumentedScanned

tdd-guide

Test-driven development workflow with test generation, coverage analysis, and multi-framework support

Share:

Installation

npx clawhub@latest install tdd-guide

View the full skill documentation and source below.

Documentation

TDD Guide

Test-driven development skill for generating tests, analyzing coverage, and guiding red-green-refactor workflows across Jest, Pytest, JUnit, and Vitest.

Table of Contents


Capabilities

CapabilityDescription
Test GenerationConvert requirements or code into test cases with proper structure
Coverage AnalysisParse LCOV/JSON/XML reports, identify gaps, prioritize fixes
TDD WorkflowGuide red-green-refactor cycles with validation
Framework AdaptersGenerate tests for Jest, Pytest, JUnit, Vitest, Mocha
Quality ScoringAssess test isolation, assertions, naming, detect test smells
Fixture GenerationCreate realistic test data, mocks, and factories

Workflows

Generate Tests from Code

  • Provide source code (TypeScript, JavaScript, Python, Java)

  • Specify target framework (Jest, Pytest, JUnit, Vitest)

  • Run test_generator.py with requirements

  • Review generated test stubs

  • Validation: Tests compile and cover happy path, error cases, edge cases
  • Analyze Coverage Gaps

  • Generate coverage report from test runner (npm test -- --coverage)

  • Run coverage_analyzer.py on LCOV/JSON/XML report

  • Review prioritized gaps (P0/P1/P2)

  • Generate missing tests for uncovered paths

  • Validation: Coverage meets target threshold (typically 80%+)
  • TDD New Feature

  • Write failing test first (RED)

  • Run tdd_workflow.py --phase red to validate

  • Implement minimal code to pass (GREEN)

  • Run tdd_workflow.py --phase green to validate

  • Refactor while keeping tests green (REFACTOR)

  • Validation: All tests pass after each cycle

  • Tools

    ToolPurposeUsage
    test_generator.pyGenerate test cases from code/requirementspython scripts/test_generator.py --input source.py --framework pytest
    coverage_analyzer.pyParse and analyze coverage reportspython scripts/coverage_analyzer.py --report lcov.info --threshold 80
    tdd_workflow.pyGuide red-green-refactor cyclespython scripts/tdd_workflow.py --phase red --test test_auth.py
    framework_adapter.pyConvert tests between frameworkspython scripts/framework_adapter.py --from jest --to pytest
    fixture_generator.pyGenerate test data and mockspython scripts/fixture_generator.py --entity User --count 5
    metrics_calculator.pyCalculate test quality metricspython scripts/metrics_calculator.py --tests tests/
    format_detector.pyDetect language and frameworkpython scripts/format_detector.py --file source.ts
    output_formatter.pyFormat output for CLI/desktop/CIpython scripts/output_formatter.py --format markdown

    Input Requirements

    For Test Generation:

    • Source code (file path or pasted content)

    • Target framework (Jest, Pytest, JUnit, Vitest)

    • Coverage scope (unit, integration, edge cases)


    For Coverage Analysis:
    • Coverage report file (LCOV, JSON, or XML format)

    • Optional: Source code for context

    • Optional: Target threshold percentage


    For TDD Workflow:
    • Feature requirements or user story

    • Current phase (RED, GREEN, REFACTOR)

    • Test code and implementation status



    Limitations

    ScopeDetails
    Unit test focusIntegration and E2E tests require different patterns
    Static analysisCannot execute tests or measure runtime behavior
    Language supportBest for TypeScript, JavaScript, Python, Java
    Report formatsLCOV, JSON, XML only; other formats need conversion
    Generated testsProvide scaffolding; require human review for complex logic
    When to use other tools:
    • E2E testing: Playwright, Cypress, Selenium
    • Performance testing: k6, JMeter, Locust
    • Security testing: OWASP ZAP, Burp Suite