From ce
Writes behavior-focused tests using Testing Trophy model: integration first with real dependencies, minimal mocking. For writing tests, choosing types, or avoiding anti-patterns.
How this skill is triggered — by the user, by Claude, or both
Slash command
/ce:writing-testsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
**Core principle:** Test user-observable behavior with real dependencies. Tests should survive refactoring.
Core principle: Test user-observable behavior with real dependencies. Tests should survive refactoring.
"The more your tests resemble the way your software is used, the more confidence they can give you." — Kent C. Dodds
Why this matters: Tests exist to give you confidence. The Testing Trophy prioritizes integration tests because they test real behavior across real modules — giving maximum confidence per test written. Unit tests in isolation often just test mocks, not your actual system.
| Priority | Type | When |
|---|---|---|
| 1st | Integration | Default - multiple units with real dependencies |
| 2nd | E2E | Complete user workflows |
| 3rd | Unit | Pure functions only (no dependencies) |
Default: Don't mock. Use real dependencies.
Only mock:
Never mock:
Before mocking, ask: "What side effects does this have? Does my test need those?" If unsure, run with real implementation first, then add minimal mocking only where needed.
Complete user workflow? → E2E test
Pure function (no side effects)? → Unit test
Everything else → Integration test
| Context | Assert On | Avoid |
|---|---|---|
| UI | Visible text, roles | CSS classes, internal state |
| API | Response body, status | Internal DB state |
| Library | Return values | Private methods |
| Pattern | Fix |
|---|---|
| Testing mock calls | Test actual outcome |
| Test-only methods in production | Move to test utilities |
sleep(500) | Use condition-based waiting |
| Asserting on internal state | Assert on observable output |
| Incomplete mocks | Mirror real API completely |
For flaky tests with timing issues, use Skill(ce:condition-based-waiting).
Remember: Behavior over implementation. Real over mocked. Outputs over internals.
npx claudepluginhub rileyhilliard/claude-essentials --plugin ceGuides writing and reviewing tests with philosophy, Arrange-Act-Assert structure, condition-based waiting via polling, strategic mocking, and isolation principles.
Provides framework-agnostic testing principles covering test philosophy, structure, and mocking boundaries. Use when writing, reviewing, or debugging tests.
Use when writing tests, designing test strategy, or reviewing test coverage. Covers test pyramid, naming, mocking, and flaky test policy.