← ClaudeAtlas

write_testslisted

Use this skill when the user wants to write tests — unit tests, integration tests, end-to-end tests, or property-based tests. Triggers on: "write tests for", "add test coverage", "test this function", "I need a test that", "how do I test this", "add a unit test", "write an integration test". Also use proactively when the user just wrote new code and hasn't mentioned tests — suggest and write tests for the most important behaviors. Works with pytest, unittest, Jest, Vitest, Rust's built-in test framework, and others.
feralbureau/luminy · ★ 0 · Testing & QA · score 68
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