(TDD) Use when implementing any feature or bugfix. Apply the Logic Gate to identify what needs tests, then use the Iron Rule for strict test-first development on logic.
Before writing any code, pass it through two gates:
flowchart TD
A[New code to write] --> B[Decompose into pieces]
B --> C{{"Logic Gate: Does this piece contain logic?"}}
C -->|"Conditionals, transformations, validation, state changes, error handling"| D["Iron Rule: TDD"]
C -->|"Dataclasses, config, thin wrappers, type aliases, formatting"| E[Write directly]
D --> F["RED: Write failing test"]
F --> G["GREEN: Minimal implementation"]
G --> H["REFACTOR: Clean up"]
H --> I{More pieces?}
E --> I
I -->|Yes| C
I -->|No| J[Done]
Decompose the work into its constituent pieces. For each piece, ask: does this contain logic?
Passes the Logic Gate (requires TDD):
Does NOT pass the Logic Gate (write directly):
__init__.py, module-level setup)When in doubt: If you can't point to a conditional, transformation, or state change, it probably doesn't pass the Logic Gate.
Before writing code, briefly identify what passes and what doesn't:
For code that passes the Logic Gate: never write logic without a preceding failing test.
If logic is written before its test:
Write a single minimal test demonstrating intended behavior:
Run tests and confirm:
Write the simplest possible code satisfying the test:
Confirm:
Improve code quality while maintaining green status:
Minimal: Single responsibility per test Clear: Descriptive name revealing behavior Realistic: Demonstrate intended API usage Focused: One assertion per test (generally)
"I'll test afterward"
"Manual testing covered edge cases"
"Tests-after achieve identical goals"
Before considering work complete:
Bug found? Write failing test reproducing it. Follow TDD cycle. Test proves fix and prevents regression.
Never fix bugs without a test.
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer