Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

tdd-guide

БесплатноЗапускает вложенные скриптыНе проверен

Guide red-green-refactor TDD with test generation, coverage-gap analysis, and multi- framework support. Use when writing tests first, analyzing coverage…

borgheiот borghei★ 1 250 звёзд на GitHub

Об этом скилле

TDD Guide

The agent guides red-green-refactor TDD workflows, generates framework-specific test stubs from requirements, parses coverage reports to identify prioritized gaps, and calculates test quality metrics including smell detection and assertion density. Supports Jest, Pytest, JUnit, Vitest, and Mocha.

Core Capabilities

  • Red-green-refactor guidance — phase validation (RED/GREEN/REFACTOR), cycle tracking, refactoring suggestions
  • Test generation — produce test cases and framework-specific stubs from user stories, acceptance criteria, and API specs
  • Coverage gap analysis — parse LCOV/JSON/XML reports, identify files below threshold, prioritize P0/P1/P2
  • Test quality metrics — cyclomatic/cognitive complexity, assertion density, isolation, naming, and test smell detection
  • Multi-framework support — convert tests and generate fixtures/mocks across Jest, Vitest, Pytest, JUnit, TestNG, Mocha, Jasmine

When to Use

  • Writing a failing test first for a new feature (test-driven development)
  • Analyzing coverage reports to find and prioritize gaps
  • Generating test stubs from requirements or API specs
  • Converting tests between frameworks or scaffolding fixtures/mocks
  • Assessing test quality and detecting smells before merge

Clarify First

Before generating tests or analyzing coverage, settle the inputs below. When one is missing or vague and would change the result, ask about it; when it wouldn't, use a sensible default and say which one you used.

  • Framework & language: Jest / Vitest / Pytest / JUnit / Mocha (changes the generated stubs and any conversion).
  • Task: generate from requirements / analyze coverage / guide a red-green-refactor cycle / convert tests (selects the tool).
  • Source input: the user story / acceptance criteria, or the coverage report (LCOV/JSON/XML) to parse (the script's input).

Ask about the two or three inputs that matter most for this request, not the whole list. If the user wants a result straight away, produce it and state your assumptions at the top.

Quick Start

scripts/tdd.py is the command-line entry point. Its most useful job is the coverage gate: it parses LCOV, Istanbul JSON or Cobertura XML, lists every file below the threshold with its uncovered lines, and exits 1 while any gap remains.

python scripts/tdd.py coverage assets/sample_coverage_gaps.lcov --threshold 80     # exit 1, lists gaps
python scripts/tdd.py coverage assets/sample_coverage_report.lcov --threshold 80   # exit 0
python scripts/tdd.py generate assets/sample_input_python.json --module discount  # pytest stubs
python scripts/tdd.py quality tests/test_discount.py --format json               # assertion density, smells

Tools Overview

Subcommand What it does Key flags
coverage <report> Per-file line/branch gaps, uncovered lines, prioritised P0-P2 recommendations --threshold (default 80), --format text/json
generate <input.json> Test stubs from user stories, acceptance criteria, error and edge cases (Jest, Vitest, Pytest, JUnit, Mocha) --framework, --module, -o, --format
quality <test file> Test count, assertions per test, isolation, naming, smells, quality score --format

Generated stubs raise or throw until you write the real assertion, so they start RED by design; a stub that passes before the code exists proves nothing.

Exit codes: 0 ok (coverage: every file meets the threshold); 1 coverage gaps found; 2 bad input (missing or empty file, unknown report format, invalid JSON, unknown framework).

The other modules (tdd_workflow.py phase validation, fixture_generator.py boundary values and mocks, framework_adapter.py cross-framework conversion, output_formatter.py) are libraries; import them with PYTHONPATH=scripts as shown in references/tool-reference.md.

Workflow

  1. RED: write or generate a failing test for the next behaviour; run it and confirm it fails for the expected reason.
  2. GREEN: write the least code that passes; run the suite.
  3. REFACTOR: clean up with the suite green; run it again.
  4. Validate coverage with the project's own test runner producing a report, then tdd.py coverage on it. Done when it exits 0 at the agreed threshold and every new branch has a test that failed before the code existed.

References

Load the reference that matches the task — keep this file lean and pull detail on demand:

  • references/workflows.md — step-by-step procedures for TDD-ing a feature, analyzing coverage gaps, and generating tests from requirements, each with validation checkpoints. Read when starting any of the three core workflows.
  • references/tool-reference.md — complete API for all eight scripts (constructors, methods, parameters, worked examples) plus the tools summary table. Read when you need exact module names or method signatures.
  • **[refere
Полный SKILL.md на GitHub

Установить tdd-guide в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

HOW_TO_USE.mdREADME.mdassets/expected_output.jsonassets/sample_coverage_gaps.lcovassets/sample_coverage_report.lcovassets/sample_input_python.jsonassets/sample_input_typescript.jsonreferences/ci-integration.mdreferences/framework-guide.mdreferences/tdd-best-practices.mdreferences/tool-reference.mdreferences/troubleshooting-and-quality.mdreferences/workflows.mdscripts/coverage_analyzer.pyscripts/fixture_generator.pyscripts/format_detector.pyscripts/framework_adapter.pyscripts/metrics_calculator.pyscripts/output_formatter.pyscripts/tdd.pyscripts/tdd_workflow.pyscripts/test_generator.py

FAQ

Что делает скилл tdd-guide?

Guide red-green-refactor TDD with test generation, coverage-gap analysis, and multi- framework support. Use when writing tests first, analyzing coverage, generating test stubs, or converting tests between Jest, Pytest, JUnit, and Vitest.

Как установить скилл tdd-guide?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл tdd-guide запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить tdd-guide с