test-first
Guide for Test-First (Test-Driven) Development. Focuses on writing tests before implementation, ensuring comprehensive coverage and clear requirements. Covers…
от s-hiraoku★ 19 звёзд на GitHub
Установить test-first в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Test-First Development Skill
Test-First Development (TDD) ensures that code is written to satisfy specific, predefined requirements, leading to higher quality and better design.
TDD Workflow
- Red: Write a failing test for a small piece of functionality.
- Green: Write the minimum amount of code required to make the test pass.
- Refactor: Clean up the code while ensuring the tests remain green.
Test Design Principles
1. Comprehensive Coverage
- Normal Cases: Test the expected "happy path" behavior.
- Boundary Values: Test inputs at the edges of valid ranges (e.g., 0, max_int, empty strings).
- Edge Cases: Test unusual or extreme conditions (e.g., network timeout, disk full, null values).
- Error Handling: Verify that the system fails gracefully and returns appropriate error messages.
2. Structure (Arrange-Act-Assert)
Follow the AAA pattern for clear and maintainable tests:
- Arrange: Set up the necessary preconditions and inputs.
- Act: Execute the function or method being tested.
- Assert: Verify that the outcome matches the expectation.
Best Practices
- One Assertion per Test: Aim to test a single concept per test case.
- Descriptive Naming: Name tests clearly (e.g.,
test_should_reject_invalid_api_key). - Independence: Ensure tests do not depend on each other or on a specific execution order.
- Fast Execution: Keep unit tests fast to encourage frequent execution.
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл test-first?
Guide for Test-First (Test-Driven) Development. Focuses on writing tests before implementation, ensuring comprehensive coverage and clear requirements. Covers test design, edge cases, and the Arrange-Act-Assert structure.
Как установить скилл test-first?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл test-first запускает скрипты?
Нет, скилл состоит только из инструкций (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…