Implements features using strict TDD red-green-refactor cycle. Use when asked to implement using TDD, test-first development, red-green flow, write tests first, or when translating a spec or requirements precisely into working code without over-engineering.
From generalnpx claudepluginhub bobmaertz/prompt-library --plugin generalThis skill is limited to using the following tools:
Enables AI agents to execute x402 payments with per-task budgets, spending controls, and non-custodial wallets via MCP tools. Use when agents pay for APIs, services, or other agents.
Designs and optimizes AI agent action spaces, tool definitions, observation formats, error recovery, and context for higher task completion rates.
Compares coding agents like Claude Code and Aider on custom YAML-defined codebase tasks using git worktrees, measuring pass rate, cost, time, and consistency.
Implements features using disciplined red-green-refactor. One small cycle at a time. Nothing more than the spec asks for.
Before writing anything:
If $ARGUMENTS provides the spec or context, start there. Otherwise read the relevant files.
Do not proceed until you have a clear, ordered list of required behaviors.
Write the smallest test that captures the next required behavior:
Run the test and confirm it fails for the right reason:
# Run only the new test
# The failure should be a missing implementation, not a syntax error or wrong assertion
If the test passes immediately, it is either wrong or the behavior already exists. Investigate before continuing.
If the test fails for the wrong reason (e.g., import error, test setup bug), fix the test first — do not move to green until the failure is meaningful.
Write the simplest code that makes the failing test pass:
Run the full test suite:
# All tests must pass before moving to refactor
If other tests break, fix them before moving on.
With all tests green, improve the code:
Stop when the code is clean and expressive. Do not over-polish.
Return to Step 1 with the next behavior from the list.
Continue until all behaviors in the spec are implemented and tested.
Simple means: the smallest code that correctly satisfies the spec.
Before each cycle, re-read the relevant portion of the spec. Ask:
If a spec is ambiguous, surface the ambiguity explicitly before proceeding. Do not resolve it silently.
After each red-green-refactor cycle, report:
## Cycle N — [Behavior implemented]
**Red**: [Test name] — failed with: [failure reason]
**Green**: [What was added to pass it]
**Refactor**: [What was cleaned up, or "none needed"]
Remaining behaviors: [list]
This keeps the work visible and confirms the cycle completed correctly.
Spec: A Stack that supports push, pop, and isEmpty. pop on an empty stack raises an error.
Ordered behaviors:
Cycle 1 — New stack is empty
Red:
def test_new_stack_is_empty():
s = Stack()
assert s.is_empty()
Fails: NameError: name 'Stack' is not defined
Green:
class Stack:
def is_empty(self):
return True
Refactor: none needed.
Cycle 2 — Stack is not empty after a push
Red:
def test_not_empty_after_push():
s = Stack()
s.push(1)
assert not s.is_empty()
Fails: AttributeError: 'Stack' object has no attribute 'push'
Green:
class Stack:
def __init__(self):
self._items = []
def push(self, item):
self._items.append(item)
def is_empty(self):
return len(self._items) == 0
Both tests pass. Refactor: none needed.
...and so on.