tdd-methodology-expert
БесплатноЗапускает вложенные скриптыНе проверенUse proactively when you need to implement features or fix bugs using strict Test-Driven Development (TDD) methodology. This agent should be activated for any…
Об этом скилле
TDD Methodology Expert
Enforce and reinforce Test-Driven Development (TDD) methodology throughout the software development process. This skill provides comprehensive guidance, automated validation, and continuous reinforcement of the Red-Green-Refactor cycle.
When to Use This Skill
This skill automatically activates when:
- TDD is mentioned in
CLAUDE.mdorCLAUDE.local.md - TDD is referenced in project memory
- The user explicitly requests TDD methodology
- The user asks to write tests or implement features
Use this skill for:
- Implementing new features using TDD
- Refactoring existing code with test protection
- Fixing bugs with test-first approach
- Ensuring code quality through TDD discipline
- Validating that TDD principles are being followed
Do NOT use this skill for:
- Pure design discussions without implementation
- Documentation-only tasks
- Research or exploration tasks
Core TDD Methodology
Test-Driven Development follows a strict three-phase cycle that must be repeated for every increment of functionality:
🔴 Red Phase: Write a Failing Test
Always write the test before any production code.
- Write a test that expresses the desired behavior
- Run the test and verify it fails (for the right reason)
- Confirm the failure message indicates what's missing
Red Phase Principles:
- Test must be simple and focused on one behavior
- Test name should clearly describe expected behavior
- Test should be readable without looking at implementation
- Failure should be meaningful and guide implementation
Example Flow:
1. Write: test_should_calculate_total_with_tax()
2. Run: Test fails - "ShoppingCart has no attribute 'calculate_total'"
3. ✅ Ready for Green phase
🟢 Green Phase: Make the Test Pass
Write minimal code to make the failing test pass.
- Implement the simplest code that makes the test pass
- Run the test and verify it passes
- Run all tests to ensure nothing broke
Green Phase Principles:
- Write only enough code to pass the current test
- Don't add features not required by tests
- It's okay to use shortcuts (you'll refactor later)
- Focus on making it work, not making it perfect
Example Flow:
1. Implement: def calculate_total(self, tax_rate): ...
2. Run: Test passes ✅
3. Run all: All tests pass ✅
4. ✅ Ready for Refactor phase
🔵 Refactor Phase: Improve the Code
Clean up code while maintaining passing tests.
- Identify duplication, poor names, or structural issues
- Refactor incrementally, running tests after each change
- Verify all tests still pass
- Repeat until code is clean
Refactor Phase Principles:
- Never refactor with failing tests
- Make small, safe changes
- Run tests after each refactoring step
- Improve both production code and test code
- Apply design patterns and best practices
Example Flow:
1. Identify: Duplicated tax calculation logic
2. Extract: Move to _calculate_tax() method
3. Run tests: All pass ✅
4. Improve: Better variable names
5. Run tests: All pass ✅
6. ✅ Commit and move to next feature
TDD Workflow Integration
Before Starting Any Code Task
Step 1: Understand the Requirement
- Break down the task into small, testable behaviors
- Identify the simplest test case to start with
- State which TDD phase you're entering (Red)
Step 2: Plan the Test
- Describe what test you're about to write
- Explain what behavior it will verify
- Confirm test will fail before implementation
During Implementation
Always follow this sequence:
- 🔴 Red: Write failing test → Run → Verify failure
- 🟢 Green: Write minimal code → Run → Verify pass
- 🔵 Refactor: Improve code → Run → Verify still passes
- Commit: Save working, tested, clean code
- Repeat: Next test for next behavior
Never skip phases or reverse the order.
Communicating TDD Progress
In every response involving code changes, explicitly state:
- Current phase: Which phase you're in (Red/Green/Refactor)
- Test status: Whether tests are passing or failing
- Next steps: What comes next in the cycle
Example Communication:
🔴 RED PHASE: Writing a test for calculating order total with discounts.
Test: test_should_apply_percentage_discount_to_order_total()
Expected to fail because Order.apply_discount() doesn't exist yet.
[Test code here]
Running test... ❌ Fails as expected: "Order has no attribute 'apply_discount'"
🟢 GREEN PHASE: Implementing minimal code to pass the test...
[Implementation code here]
Running test... ✅ Passes!
Running all tests... ✅ All pass!
🔵 REFACTOR PHASE: Improving the discount calculation structure...
[Refactored code here]
Running all tests... ✅ All pass!
Ready to commit this increment.
Bundled Tools and Resources
Scripts
check_tdd_compliance.py
Analyzes code to detect TDD compliance issues and code smells that indicate test-after development.
Usage: ``
Установить tdd-methodology-expert в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл tdd-methodology-expert?
Use proactively when you need to implement features or fix bugs using strict Test-Driven Development (TDD) methodology. This agent should be activated for any coding task that requires writing new functionality, refactoring existing code, or ensuring comprehensive test coverage, but should not be used for any design-related tasks. The agent excels at breaking down complex requirements into testable increments and maintaining high code quality through disciplined TDD cycles. Use this agent proactively or if the user mentions 'TDD', 'tdd' or 'Test Driven Development'.
Как установить скилл tdd-methodology-expert?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл tdd-methodology-expert запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic