Agent skill
tdd
Guide Test-Driven Development workflow for FastLED. Use when implementing new features or fixing bugs with a test-first approach. Enforces Red-Green-Refactor discipline with FastLED test conventions.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/tdd-fastled-fastled
SKILL.md
TDD Workflow — Red-Green-Refactor for FastLED
You are guiding a Test-Driven Development cycle. Follow the strict Red-Green-Refactor discipline.
Input
$ARGUMENTS
Phase 1: RED — Write a Failing Test
Steps
- Understand the requirement: Read relevant source code to understand the API and behavior
- Find existing tests: Search
tests/for related test files — prefer extending them - Write the test FIRST: Create a minimal test that describes the expected behavior
- Run the test: Execute
bash test TestNameto verify it FAILS - Verify failure reason: The test must fail because the feature is missing or the bug exists, NOT because of a compile error or typo
Test Conventions
- Read
agents/tests.mdfor full conventions - Use
FL_prefixed assertion macros (e.g.,FL_CHECK_EQ,FL_REQUIRE_TRUE) - Include
test.handFastLED.h - Use
namespace fl;and anonymous namespace wrapper - Mirror source structure for file placement:
src/fl/foo.h->tests/fl/foo.cpp - Keep tests simple — no mocks, no helper classes, minimal setup
Output
## RED Phase
**Test file**: tests/fl/example.cpp
**Test case**: "Feature - expected behavior"
**Status**: FAILS as expected
**Failure reason**: [why it fails — confirms the test is valid]
Phase 2: GREEN — Make It Pass
Steps
- Write minimal code: Implement just enough to make the test pass
- No premature optimization: Simplest solution that works
- Run the test: Execute
bash test TestNameto verify it PASSES - Run full suite: Execute
bash test --cppto verify no regressions
Output
## GREEN Phase
**Implementation**: src/fl/example.h (lines X-Y)
**Changes**: [brief description of what was added/changed]
**Test status**: PASSES
**Full suite**: All tests pass (no regressions)
Phase 3: REFACTOR — Clean Up
Steps
- Review the code: Look for duplication, unclear naming, unnecessary complexity
- Refactor incrementally: Make one change at a time
- Run tests after each change:
bash test TestNamemust stay green - Consider edge cases: Add 1-2 more test cases if critical edge cases are obvious
- Run full suite:
bash test --cppto confirm everything still passes
Output
## REFACTOR Phase
**Changes made**: [list of refactoring improvements]
**Test status**: All tests still pass
**Edge cases added**: [any additional test cases, or "none needed"]
Final Summary
After all three phases, provide:
## TDD Summary
**Feature**: [what was implemented]
**Test file**: [path]
**Source file(s)**: [paths]
**Tests added**: [count and names]
**All tests passing**: Yes/No
Key Rules
- NEVER write implementation code before the test
- NEVER skip the RED phase — you must see the test fail first
- Keep tests simple — one focused test per behavior
- Run tests at every phase transition — this is non-negotiable
- Stay in project root — never
cdto subdirectories - Use
bash test— never barepython,meson, orninja
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?