tdd-workflow
Test-Driven Development guidance. Use when writing code, implementing features, or fixing bugs in projects that follow TDD methodology. Provides the…
от lackeyjb★ 15 звёзд на GitHub
Установить tdd-workflow в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
TDD Workflow Skill
Guidance for Test-Driven Development methodology.
The Core Cycle
RED → GREEN → REFACTOR (repeat)
| Phase | Purpose | Actions | Verify |
|---|---|---|---|
| RED | Define expected behavior | Write test for ONE behavior, run test | Test FAILS |
| GREEN | Make it work | Write MINIMUM code to pass | Test PASSES |
| REFACTOR | Make it clean | Improve ONE thing at a time, run tests after each change | Tests stay GREEN |
Phase 1: RED - Write Failing Test
Purpose: Define behavior before implementation.
Actions:
- Create/open test file
- Write test for ONE behavior
- Run test
- Verify FAILURE (if it passes, test is wrong)
Common mistakes: Tests pass immediately, testing implementation not behavior, writing too many tests at once
Phase 2: GREEN - Make It Pass
Purpose: Write MINIMUM code to pass test.
Actions:
- Implement just enough to pass
- No extra features, no optimization
- Run tests, verify PASS
Common mistakes: Over-engineering, adding untested features, "while I'm here" additions
Phase 3: REFACTOR - Improve Quality
Purpose: Clean up while keeping tests green.
Actions:
- Identify improvements: duplication, naming, complex logic, long functions
- Make ONE change
- Run tests
- If green, continue. If red, undo.
Checklist: Extract methods, rename variables, remove duplication (DRY), simplify conditionals, add type safety
Test Patterns
Arrange-Act-Assert (AAA):
- Arrange: Set up test data
- Act: Execute the behavior
- Assert: Verify result
Given-When-Then (BDD): Structure nested describes for readability
Coverage Commands
| Language | Command |
|---|---|
| JS/TS (Jest) | npx jest --coverage |
| JS/TS (Vitest) | npx vitest run --coverage |
| Python | pytest --cov=src --cov-report=html |
| Go | go test -cover ./... |
Anti-Patterns to Avoid
- Test After: Writing code first defeats TDD purpose
- Testing Implementation: Test WHAT it does, not HOW (test behavior, not internal calls)
- Brittle Tests: Use resilient assertions (e.g.,
toContainEqualnot array index checks) - No Refactoring: Skipping refactor creates technical debt
Quick Reference
- RED: "What should it do?" → Write failing test
- GREEN: "Does it work?" → Write minimal code
- REFACTOR: "Is it clean?" → Improve structure
For detailed code examples, see examples.md in this skill directory.
Integration
Works with:
- context-awareness: Project-specific coverage targets
- code-styleguides: Language-specific test patterns
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- examples.md
FAQ
Что делает скилл tdd-workflow?
Test-Driven Development guidance. Use when writing code, implementing features, or fixing bugs in projects that follow TDD methodology. Provides the Red-Green-Refactor cycle structure.
Как установить скилл tdd-workflow?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл tdd-workflow запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
AnthropicGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
academy-guide
AnthropicStop 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…
internal-comms
AnthropicA 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…
skill-development
AnthropicThis 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…