sc-tdd
БесплатноЗапускает вложенные скриптыНе проверенStrict Test-Driven Development enforcer with Red-Green-Refactor workflow automation. Auto-detects frameworks, validates semantic test failures, and blocks…
Об этом скилле
Test-Driven Development (TDD) Skill
Strict Red-Green-Refactor workflow enforcement with automated validation.
This skill acts as a TDD workflow state machine that enforces discipline through validators. It prevents common TDD anti-patterns and ensures proper test-first development.
Quick Start
# Start TDD for a new feature
/sc:tdd "add user password validation"
# TDD with specific framework
/sc:tdd payment-module --framework pytest
# Fast mode (skip full suite after green, run at end)
/sc:tdd api-endpoint --fast
# Allow snapshot tests
/sc:tdd ui-component --allow-snapshots
Behavioral Flow
This skill enforces a 7-step Red-Green-Refactor cycle:
- Initialize - Detect scope, framework, create state
- RED: Write Failing Test - Create test for missing functionality
- RED: Validate Failure - Run validator, confirm SEMANTIC failure (assertion, not compile error)
- GREEN: Implement Minimally - Write smallest code to pass test
- GREEN: Validate Passing - Run validators, confirm test passes + no regressions
- REFACTOR: Improve Design - Clean up with tests as safety net
- REFACTOR: Validate Stability - Re-run suite, confirm still green
State Machine
IDLE → RED_PENDING → RED_CONFIRMED → GREEN_PENDING →
GREEN_CONFIRMED → REFACTOR_PENDING → REFACTOR_COMPLETE → [cycle repeats]
Critical Rules:
- Validator output is source of truth - If validator says blocked, you MUST stop
- Exit codes matter: 0 = allowed, 2 = blocked, 3 = error (ask user for help)
- No bypassing - Every phase transition requires validator approval
Phase 1: Initialize (IDLE → RED_PENDING)
When: User requests TDD workflow
Your Actions:
- Detect scope root:
python .claude/skills/sc-tdd/scripts/framework_detector.py \
--detect-scope $(pwd) \
--json
- Initialize state:
python .claude/skills/sc-tdd/scripts/tdd_state_machine.py \
--scope-root <detected_scope> \
--init \
--json
- Transition to RED_PENDING:
python .claude/skills/sc-tdd/scripts/tdd_state_machine.py \
--scope-root <scope> \
--phase RED_PENDING \
--evidence "User requested: <feature_description>" \
--json
Output: Confirm initialization, explain RED phase rules to user
Phase 2: Write Failing Test (RED_PENDING)
Rules:
- User writes test first
- You MAY help write the test
- You MAY add empty stubs/interfaces to make test compile (e.g.,
pass,raise NotImplementedError, empty functions) - You MUST NOT write production implementation yet
Your Actions:
- Help user write test file
- Explain test must fail with assertion (not compile error)
- When test is written, proceed to validation
Phase 3: Validate Red (RED_PENDING → RED_CONFIRMED)
CRITICAL: You MUST run this validator before proceeding.
Command:
python .claude/skills/sc-tdd/scripts/validate_red.py \
--scope-root <scope> \
--json
Interpretation:
- Exit code 0 +
"allowed": true→ Proceed to RED_CONFIRMED - Exit code 2 +
"allowed": false→ STOP, show userreasons, ask them to fix
Common Blocking Reasons:
"Test failed but NOT with semantic assertion"- Compile error, need to fix test"Test PASSED (expected failure)"- Test not actually testing the feature"No changed test files found"- Forgot to write test
If Blocked: Show user the reasons array, artifacts.test_output, and ask them to address the issue. DO NOT propose production code until validator allows.
If Allowed: Store artifacts.intent_test information, transition state, proceed to GREEN phase.
Phase 4: Implement Minimally (RED_CONFIRMED → GREEN_PENDING)
Rules:
- Write MINIMAL implementation to pass the test
- Focus on making test pass, not perfection
- NO premature optimization
- NO extra features beyond test requirements
Your Actions:
- Confirm current state is RED_CONFIRMED
- Implement minimal production code
- Explain your implementation approach
- Transition to GREEN_PENDING:
python .claude/skills/sc-tdd/scripts/tdd_state_machine.py \
--scope-root <scope> \
--phase GREEN_PENDING \
--evidence "Implemented: <description>" \
--json
- Proceed to validation
Phase 5: Validate Green (GREEN_PENDING → GREEN_CONFIRMED)
CRITICAL: You MUST run this validator before claiming success.
Command (standard):
python .claude/skills/sc-tdd/scripts/validate_green.py \
--scope-root <scope> \
--json
Command (fast mode, skips full suite):
python .claude/skills/sc-tdd/scripts/validate_green.py \
--scope-root <scope> \
--skip-full-suite \
--json
Interpretation:
- Exit code 0 +
"allowed": true→ GREEN_CONFIRMED, proceed to refactor - Exit code 2 +
"allowed": false→ STOP, implementation insufficient
Common Blocking Reasons:
"Intent test still FAILING"- Implementation didn't make test pass- `"Full test s
Установить sc-tdd в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл sc-tdd?
Strict Test-Driven Development enforcer with Red-Green-Refactor workflow automation. Auto-detects frameworks, validates semantic test failures, and blocks production code until tests fail properly. Use for feature development, bug fixes with test coverage, or refactoring with safety nets.
Как установить скилл sc-tdd?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл sc-tdd запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic