Implement features using Test-Driven Development (TDD). Executes red-green-refactor cycle, uses bmad-commands for file operations and testing, verifies acceptance criteria. This skill should be used when implementing new features or functionality from task specifications with test coverage.
Implement features using Test-Driven Development (TDD). Executes red-green-refactor cycle, uses bmad-commands for file operations and testing, verifies acceptance criteria. This skill should be used when implementing new features or functionality from task specifications with test coverage.
acceptance
[{"tests_passing":"All tests must pass"},{"coverage_threshold":"Test coverage >= 80%"},{"no_syntax_errors":"Code must have no syntax errors"},{"task_spec_loaded":"Task specification must be successfully loaded"},{"all_requirements_met":"All acceptance criteria from task spec must be met"}]
inputs
{"task_id":{"type":"string","required":true,"description":"Task identifier (e.g., task-auth-002)","validation":"Must match pattern: task-{component}-{number}"}}
outputs
{"implementation_complete":{"type":"boolean","description":"Whether implementation is complete and meets all criteria"},"test_coverage_percent":{"type":"number","description":"Test coverage percentage achieved"},"files_modified":{"type":"array","description":"List of files created or modified"},"tests_passed":{"type":"boolean","description":"Whether all tests passed"}}
Implement features following strict Test-Driven Development workflow. Uses bmad-commands for deterministic file and test operations, ensures acceptance criteria are met through automated verification.
TDD Cycle:
RED: Write failing tests
GREEN: Implement code to pass tests
REFACTOR: Improve code while keeping tests green
Prerequisites
Task specification exists at workspace/tasks/{task_id}.md
bmad-commands skill available at .claude/skills/bmad-commands/
WebFetch(
url: "https://www.npmjs.com/package/{package-name}",
prompt: "Extract: installation, main API methods, usage examples, version compatibility"
)
# Or check official docs
WebFetch(
url: "{official-docs-url}",
prompt: "Extract: API reference for version {version}, method signatures, parameters, return types"
)
Python packages:
WebFetch(
url: "https://pypi.org/project/{package-name}/",
prompt: "Extract: installation, API reference, examples for version {version}"
)
WebFetch(
url: "https://{package}.readthedocs.io/en/stable/",
prompt: "Extract: API documentation, class methods, function signatures"
)
Escalate to user if critical package lacks documentation
Step 1: Analyze Requirements
Action: Break down acceptance criteria into test cases.
For each acceptance criterion:
Identify what needs to be tested
Determine test type (unit/integration/e2e)
Plan test structure
Identify edge cases
Example:
Acceptance Criterion: "User can log in with valid credentials"
Test Cases:
- [Unit] Should return user object when credentials valid
- [Unit] Should return null when email not found
- [Unit] Should return null when password incorrect
- [Integration] Should create session when login successful
- [Integration] Should not create session when login fails
Reference references/tdd-workflow.md for detailed TDD patterns and best practices.
Step 2: RED Phase - Write Failing Tests
Action: Write tests that cover all acceptance criteria.