write_testslisted
Install: claude install-skill feralbureau/luminy
# write_tests
Good tests are a communication tool — they document what the code is supposed to do, catch regressions, and give you confidence to change things. This skill helps you write tests that are actually useful, not just tests that pass.
## The Test Hierarchy — Choose the Right Level
```
/\
/E2E\ Slow, expensive, test the whole system
/------\
/Integr. \ Test multiple real components together
/----------\
/ Unit \ Fast, isolated, test one thing
/--------------\
```
**Unit tests**: One function, class, or module in isolation. Dependencies are faked/mocked. Fast (milliseconds). Most of your tests should be here.
**Integration tests**: Multiple real components working together (e.g., service + real database, but fake external API). Slower but catch wiring bugs.
**E2E / acceptance tests**: The full system from the outside (HTTP request to DB and back). Slow, brittle, but give the highest confidence. Write few, run selectively.
## What Makes a Good Test
### 1. Tests behavior, not implementation
Bad (tests internals):
```python
def test_user_service_calls_repo():
mock_repo = Mock()
service = UserService(mock_repo)
service.get_user(1)
mock_repo.find_by_id.assert_called_once_with(1) # testing HOW, not WHAT
```
Good (tests observable behavior):
```python
def test_get_user_returns_user_for_valid_id():
repo = InMemoryUserRepository([User(id=1, name="Alice")])
service = UserService(repo