plugins/ce/skills/writing-tests/SKILL.md
Writes behavior-focused tests using Testing Trophy model with real dependencies. Use when writing tests, choosing test types, or avoiding anti-patterns like testing mocks.
npx skillsauth add rileyhilliard/claude-essentials writing-testsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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.
development
Selects and applies professional journalistic story structures (WSJ Formula, Inverted Pyramid, Hourglass, Tick-Tock, etc.) based on the content being written. Use when writing articles, blog posts, features, essays, long-form content, news stories, trend pieces, investigative reports, profiles, or any narrative prose longer than a few paragraphs. Also use when the user asks for help structuring a piece, choosing a story framework, organizing a draft, outlining an article, or wants to know which article format fits their content. Trigger on requests like "help me structure this," "what format should I use," "write a feature about," "draft a blog post on," or any mention of story structure, article architecture, or narrative frameworks. Complements the writer skill (which handles tone and anti-AI rhetoric) by providing the structural blueprint.
testing
Writing style and tone guide for human-sounding content. Use when writing documentation, READMEs, commit messages, PR descriptions, blog posts, LinkedIn posts, social media content, or any user-facing content.
data-ai
Create implementation plans with tasks grouped by subsystem. Related tasks share agent context; groups parallelize across subsystems.
development
Debugging framework that finds root causes before proposing fixes. Use when investigating bugs, errors, unexpected behavior, failed tests, or when previous fixes haven't worked.