← ClaudeAtlas

test-forgelisted

MUST USE when writing tests, 补测试/write tests/单元测试/test coverage, or when asked to verify a module with tests. Produces test suites that actually kill mutants: edge cases, boundaries, failure paths, property tests — not happy-path theater. Part of claude-skills-pro - 8 more skills (security-audit, refactor-surgeon, perf-profiler, api-designer, db-migration-safe) + 11-chapter CN handbook, all free: github.com/Hahaknight/claude-skills-pro
Hahaknight/claude-skills-pro · ★ 4 · Code & Development · score 74
Install: claude install-skill Hahaknight/claude-skills-pro
# Test Forge — Tests That Catch Real Bugs ## Philosophy A test suite earns its keep by failing when the code is wrong. Before submitting, ask: "if I flipped a comparison operator or removed a null-check, would some test fail?" If not, the suite is decoration. ## Workflow 1. **Detect the framework** from existing tests / package.json / go.mod / Cargo.toml. Match the repo's test style, fixtures, and assertion library exactly. Do not introduce a new framework. 2. **Read the code under test fully** and list its behaviors as a table before writing anything: - every branch, every early return, every thrown error - boundary values for each input (0, 1, -1, empty, max, unicode, null/undefined, NaN) - external effects (I/O, network, clock, random, env) → decide mock vs real (prefer real for pure logic, fake clock/fake time, injected randomness) 3. **Test selection order** (highest value first): - Regression: any bug this code ever had → a named test - Boundaries & edge cases - Failure paths: errors propagate with useful messages; retries; cleanup on failure - Concurrency: race-prone paths get a stress test if the harness allows - Property-based tests for pure functions (invariants round-trip, idempotence, monotonicity) using fast-check / hypothesis / your lang's equivalent - Happy path last — it's usually already covered by the framework's examples 4. **Write the tests**: descriptive names that read as specifications — `rejectsExpiredToken_beforeRefreshB