Tdd practitioner
Skill AtulPurohit/Antigravity-Awesome-Skills/skills/tdd-practitioner
Practice Test-Driven Development with the red-green-refactor cycle. Write tests before code to drive better design, coverage, and confidence.From its SKILL.md
npx -y skills add AtulPurohit/Antigravity-Awesome-Skills --skill tdd-practitionerAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 3 stars3 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
2.8 KB, 615 tokens by cl100k_base, as published. Nobody here has run it
TDD Practitioner
Purpose
Write better, more reliable code by letting tests drive the implementation through the red-green-refactor cycle.
The TDD Cycle
Red → Green → Refactor
1. RED: Write a failing test for the next small piece of behavior
2. GREEN: Write the minimum code to make it pass
3. REFACTOR: Clean up without breaking tests
Repeat...
1️⃣ Writing a Good Unit Test (AAA Pattern)
def test_order_calculates_total_with_discount():
# ARRANGE: Set up the system under test
items = [
OrderItem(product_id="A", quantity=2, price=Money("25.00")),
OrderItem(product_id="B", quantity=1, price=Money("50.00")),
]
discount = PercentageDiscount(rate=Decimal("0.10")) # 10% off
order = Order(items=items, discount=discount)
# ACT: Perform the action
total = order.calculate_total()
# ASSERT: Verify the outcome
assert total == Money("90.00") # (25*2 + 50) * 0.9 = 90
2️⃣ Test Quality Checklist
- Tests one thing (single assertion concept)
- Test name describes behavior:
test_[method]_[scenario]_[expected_result] - Independent — no test depends on another
- Fast — no I/O, no external calls
- Deterministic — same result every run
- Tests behavior, not implementation details
3️⃣ Test Doubles
# Mock (verify interactions)
mock_email = Mock()
service = UserService(email_sender=mock_email)
service.register(email="[email protected]")
mock_email.send.assert_called_once_with(
to="[email protected]",
subject="Welcome!"
)
# Stub (provide canned responses)
stub_repo = Mock()
stub_repo.find_by_email.return_value = User(id=1, email="[email protected]")
# Fake (simplified working implementation)
class InMemoryOrderRepository:
def __init__(self): self._store = {}
def save(self, order): self._store[order.id] = order
def find(self, id): return self._store.get(id)
4️⃣ Outside-In TDD (Starting with Acceptance Tests)
1. Write failing acceptance test (high level behavior)
2. Write failing unit tests for components needed
3. Implement until unit tests pass
4. Run acceptance test — keep going until it passes
5. Refactor
Outputs
- Test suite for specified feature
- Mock/stub configuration
- Test helpers and builders
- Coverage report analysis
- TDD workflow documentation
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.