brainstorming
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).
test-driven-generationGenerate implementation code that passes existing unit tests. Use when the user provides test files (Python pytest/unittest, Java JUnit/TestNG) and asks Claude to implement the code to make those tests pass. Supports full TDD workflow - analyzing tests, generating implementation, running tests, debugging failures, and iterating until all tests pass.
Independent GitHub snapshot · Automated classification · Original documentation governs
Generate implementation code that satisfies existing unit tests through an iterative test-driven development workflow.
Read and understand the provided test file(s):
Create implementation code that should satisfy the tests:
For Python:
For Java:
Execute the test suite to verify the implementation:
Python:
pytest <test_file>.py -v
# or
python -m unittest <test_file>.py -v
Java:
mvn test
# or
gradle test
# or for single test file
javac <TestFile>.java && java org.junit.runner.JUnitCore <TestFile>
If tests fail, analyze the failure output:
Fix the implementation based on failure analysis:
User provides test_calculator.py:
import pytest
from calculator import Calculator
def test_add():
calc = Calculator()
assert calc.add(2, 3) == 5
assert calc.add(-1, 1) == 0
def test_divide():
calc = Calculator()
assert calc.divide(10, 2) == 5
with pytest.raises(ValueError):
calc.divide(10, 0)
Step 1: Analyze - need Calculator class with add() and divide() methods, divide should raise ValueError on zero
Step 2: Generate calculator.py:
class Calculator:
def add(self, a, b):
return a + b
def divide(self, a, b):
if b == 0:
raise ValueError("Cannot divide by zero")
return a / b
Step 3: Run pytest test_calculator.py -v
Step 4: If failure occurs, read error and identify issue
Step 5: Fix and re-run until passing
setUp/tearDown or fixtures that provide context@pytest.mark.parametrize for multiple test cases@Before/@After setup methods@ParameterizedTest annotations