Agent skill

Writing Tests

by rileyhilliard in rileyhilliard/claude-essentials

Writes behavior-focused tests using Testing Trophy model with real dependencies.

MITAuto-check passedTesting & QA

Install Writing Tests

skills CLI
$ npx skills add rileyhilliard/claude-essentials --skill writing-tests -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install rileyhilliard/claude-essentials writing-tests --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/rileyhilliard/claude-essentials.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/ce/skills/writing-tests .claude/skills/writing-tests && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
writing-tests
GitHub stars
130
Token cost
~999 tokens
SKILL.md length
336 words
Files
6 (incl. references)
Skills in repo
17
Repo updated
First seen
Licence
MIT

At a glance

Writes behavior-focused tests using Testing Trophy model with real dependencies.

  • Choosing test types
  • SKILL.md covers Testing Trophy Model, Mocking Guidelines, Test Type Decision and Assertion Strategy, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Avoiding anti-patterns like testing mocks

What it does

Writing Tests is an agent skill from rileyhilliard/claude-essentials. 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.

Its SKILL.md is about 1000 tokens, which your agent loads only when the skill is triggered. The skill folder holds 6 other files, including reference files (for example `references/go.md`, `references/python.md` and `references/typescript-react.md`).

It sits in Testing & QA. The licence is MIT.

When your agent uses it

  • Choosing test types
  • Avoiding anti-patterns like testing mocks

Example prompts

  • “Use the writing-tests skill to write behavior-focused tests using Testing Trophy model with real dependencies”
  • “/writing-tests”

What it can do on your machine

Read from SKILL.md and the folder at commit 3a67a01. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Writing Tests loads about 999 tokens when it runs, and up to ~9.5k if it reads all its reference files. Until then it costs about 46 tokens; SKILL.md has 336 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~46
When it runs · the whole SKILL.md, loaded when a task matches
~999
With references · SKILL.md plus every file in references/, read only if the agent opens them
~9.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from rileyhilliard/claude-essentials at commit 3a67a01, republished under its MIT licence (© rileyhilliard). 336 words, ~999 tokens.

Download SKILL.mdSave it as .claude/skills/writing-tests/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.
name
writing-tests
description
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.

If the current repo has its own rules/skills covering this topic (check .claude/rules/ and repo CLAUDE.md), those take precedence — apply this skill only where they're silent.

Writing Tests

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.

Testing Trophy Model

PriorityTypeWhen
1stIntegrationDefault - multiple units with real dependencies
2ndE2EComplete user workflows
3rdUnitPure functions only (no dependencies)

Mocking Guidelines

Default: Don't mock. Use real dependencies.

Only mock:

  • External HTTP/API calls
  • Time/randomness
  • Third-party services (payments, email)

Never mock:

  • Internal modules
  • Database queries (use test DB)
  • Business logic
  • Your own code calling your own code

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.

Test Type Decision

Complete user workflow? → E2E test
Pure function (no side effects)? → Unit test
Everything else → Integration test

Assertion Strategy

ContextAssert OnAvoid
UIVisible text, rolesCSS classes, internal state
APIResponse body, statusInternal DB state
LibraryReturn valuesPrivate methods

Anti-Patterns

PatternFix
Testing mock callsTest actual outcome
Test-only methods in productionMove to test utilities
sleep(500)Poll for actual condition
Asserting on internal stateAssert on observable output
Incomplete mocksMirror real API completely

Quality Checklist

  • Happy path covered
  • Error conditions handled
  • Real dependencies used (minimal mocking)
  • Tests survive refactoring
  • Test names describe behavior

Language-Specific Patterns

Async Waiting

Wait for the actual condition, not a guess about how long it takes.

typescript
// Bad: arbitrary delay
await new Promise(r => setTimeout(r, 2000));
expect(element).toBeVisible();

// Good: poll for condition
await waitFor(() => expect(element).toBeVisible());

Prefer framework built-ins:

  • Testing Library: findBy queries, waitFor
  • Playwright: auto-waiting, expect(locator).toBeVisible()
  • pytest: asyncio.wait_for, tenacity

Language-specific waiting patterns:


Remember: Behavior over implementation. Real over mocked. Outputs over internals.

© rileyhilliard, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 5 other files (references) in plugins/ce/skills/writing-tests of rileyhilliard/claude-essentials.

  • SKILL.md
  • references/go.md
  • references/python.md
  • references/typescript-react.md
  • references/waiting-python.md
  • references/waiting-typescript.md

Open the folder on GitHubat commit 3a67a01

Compare with similar skills

Writing Tests next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Writing Tests compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Writing Tests this skillrileyhilliard/claude-essentials130—~999Automated safety check: PassMIT
Web Application Testinganthropics/skills180k51 repos~966Automated safety check: PassApache-2.0
Diagnosing Bugsfossasia/eventyay-interpretation1.6k32 repos~2.1kAutomated safety check: PassApache-2.0
TDDpietheinstrengholt/rssmonster56430 repos~906Automated safety check: PassMIT
TDD WorkflowhellangleZ/burn-in-cceverywhere-ralph11211 repos~2.4kAutomated safety check: PassNone
TDDsanity-io/sanity6.4k20 repos~1kAutomated safety check: PassMIT

Similar skills

  • Web Application Testing

    anthropics/skills

    Official

    Tests local web applications with Python Playwright scripts, checking frontend behavior, capturing screenshots and reading browser console logs.

    180k GitHub starsUsed in 51 repos~966 tokens
    Testing & QAAuto-check passed
  • Diagnosing Bugs

    fossasia/eventyay-interpretation

    Diagnosis loop for hard bugs and performance regressions. An agent skill from fossasia/eventyay-interpretation.

    1.6k GitHub starsUsed in 32 repos~2.1k tokens
    Testing & QAAuto-check passed
  • TDD

    pietheinstrengholt/rssmonster

    Test-driven development. An agent skill from pietheinstrengholt/rssmonster.

    564 GitHub starsUsed in 30 repos~906 tokens
    Testing & QAAuto-check passed
  • TDD Workflow

    hellangleZ/burn-in-cceverywhere-ralph

    A skill your agent uses when writing new features, fixing bugs, or refactoring code.

    112 GitHub starsUsed in 11 repos~2.4k tokens
    Testing & QAAuto-check passed
  • TDD

    sanity-io/sanity

    Official

    Test-driven development with red-green-refactor loop. An agent skill from sanity-io/sanity.

    6.4k GitHub starsUsed in 20 repos~1k tokens
    Testing & QAAuto-check passed
  • Context Driven Development

    Ibrahim-3d/orchestrator-supaconductor

    A skill your agent uses when working with Conductor's context-driven development methodology, managing project context artifacts, or understanding the relationship between product.md, tech-stack.md…

    381 GitHub starsUsed in 9 repos~2.9k tokens
    Testing & QAAuto-check passed

More from rileyhilliard/claude-essentials

All 17 skills in this repo
  • Handling Errors

    rileyhilliard/claude-essentials

    Prevents silent failures and context loss in error handling.

    130 GitHub stars~632 tokensUpdated 1 mo ago
    Auto-check passed
  • Planning Products

    rileyhilliard/claude-essentials

    Defines product features from a PM perspective (JTBD, competitive research, scope negotiation) before technical planning.

    130 GitHub stars~1.4k tokensUpdated 1 mo ago
    Auto-check passed
  • Optimizing Performance

    rileyhilliard/claude-essentials

    Measure-first performance optimization that balances gains against complexity.

    130 GitHub stars~470 tokensUpdated 1 mo ago
    Auto-check passed
  • Architecting Systems

    rileyhilliard/claude-essentials

    Guides clean, scalable system architecture during the build phase.

    130 GitHub stars~713 tokensUpdated 1 mo ago
    Auto-check passed
  • Design

    rileyhilliard/claude-essentials

    Enforces precise, minimal design for dashboards and admin interfaces.

    130 GitHub stars~1.9k tokensUpdated 1 mo ago
    Auto-check passed
  • Fixing Flaky Tests

    rileyhilliard/claude-essentials

    Diagnose and fix tests that pass in isolation but fail when run concurrently.

    130 GitHub stars~1.1k tokensUpdated 1 mo ago
    Auto-check passed

Categories

Questions about Writing Tests

What does Writing Tests do?

Writes behavior-focused tests using Testing Trophy model with real dependencies. Writing Tests is an agent skill from rileyhilliard/claude-essentials. Writes behavior-focused tests using Testing Trophy model with real dependencies.

When should I use Writing Tests?

Writing Tests fits situations like: choosing test types; avoiding anti-patterns like testing mocks.

How do I install Writing Tests in Claude Code?

Run `npx skills add rileyhilliard/claude-essentials --skill writing-tests -a claude-code`. Or copy the skill folder (plugins/ce/skills/writing-tests in rileyhilliard/claude-essentials) into .claude/skills/writing-tests in your project. Claude Code loads it when a task matches its description.

How do I install Writing Tests in Codex?

Run `npx skills add rileyhilliard/claude-essentials --skill writing-tests -a codex`. Or copy the skill folder (plugins/ce/skills/writing-tests in rileyhilliard/claude-essentials) into .agents/skills/writing-tests in your project. Codex loads it when a task matches its description.

Can I use Writing Tests in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add rileyhilliard/claude-essentials --skill writing-tests -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/writing-tests, .gemini/skills/writing-tests, .github/skills/writing-tests and .opencode/skills/writing-tests in your project.

What does Writing Tests need to run?

SKILL.md names no scripts, command-line tools or credentials: Writing Tests is instructions for the agent only.

Does Writing Tests access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Writing Tests safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Writing Tests use?

Writing Tests is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Writing Tests use?

About 999 tokens (SKILL.md is roughly 4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 8.5k tokens, read only when the agent opens those files.

What are the alternatives to Writing Tests?

Skills that share tags, products or a category with Writing Tests: Web Application Testing (anthropics/skills, 180k stars), Diagnosing Bugs (fossasia/eventyay-interpretation, 1.6k stars), TDD (pietheinstrengholt/rssmonster, 564 stars) and TDD Workflow (hellangleZ/burn-in-cceverywhere-ralph, 112 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Writing Tests?

rileyhilliard (a GitHub user) maintains it in rileyhilliard/claude-essentials, which has 130 GitHub stars. The repository holds 17 skills in this directory. The repository was last updated on August 18, 2026.

Source: rileyhilliard/claude-essentials on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.