writing-tests

writing-tests is a skill for Claude Code from saffron-health/libretto. It costs 25 tokens per session (457 once invoked), scanned A, original, MIT.

A guide for writing tests that follow real user actions through an application. Tests are checks that confirm software behaves as expected.

In plain words
What is it for?
Use it to create, edit, or review tests for command-line programs and libraries, with each test describing one concrete user flow.
Why use it?
It keeps tests understandable by making them use the same public interface as a real user, without hiding important steps behind helpers.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: installed under .agents/ (shared by several agents).

Part of the libretto plugin — 24 skills shipped together

Good fit Use it to create, edit, or review tests for command-line programs and libraries, with each test describing one concrete user flow.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/saffron-health/libretto/writing-tests
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add saffron-health/libretto --skill writing-tests
Clone the repo
git clone --depth 1 https://github.com/saffron-health/libretto

Made for: Claude Code.

Or install libretto, the plugin that ships this one along with the rest of its 24 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for writing-tests

README.md
[![agentmods](https://agentmods.dev/badge/skills/saffron-health/libretto/writing-tests/github.svg)](https://agentmods.dev/skills/saffron-health/libretto/writing-tests)
Your own site
<a href="https://agentmods.dev/skills/saffron-health/libretto/writing-tests"><img src="https://agentmods.dev/badge/skills/saffron-health/libretto/writing-tests/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for writing-tests

Your own site · 80×15
<a href="https://agentmods.dev/skills/saffron-health/libretto/writing-tests"><img src="https://agentmods.dev/badge/skills/saffron-health/libretto/writing-tests.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 25 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 457 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00025 $0.00457
Opus 5 $0.00013 $0.00229
Sonnet 5 $0.00005 $0.00091
Haiku 4.5 $0.00003 $0.00046

Measured 10d ago against content hash ffd07d4369e7, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

writing-tests scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/writing-tests/SKILL.md · 52 lines

What it actually says

Writing Tests

Core Principle: Tests Are User Flows

Each test should represent a single, concrete flow that a real user would follow when interacting with the system. Write tests at the same abstraction level as the user experiences the system.

Rules

1. Match the user's interface exactly

The test should call the system the same way a user would. If the system is a CLI, the test should invoke the CLI with argument strings. If it's a library, the test should call the public API. Don't wrap the interface in test-specific helpers that hide what's actually happening.

Good — the test reads like what a user would do:

const result = await librettoCli("setup --skip-browsers");
expect(result.exitCode).toBe(0);

const result2 = await librettoCli("--help");
expect(result2.stdout).toContain("Usage:");

Bad — extra abstraction obscures the actual interaction:

const result = await setupWithDefaults(); // hides the real CLI invocation
assertSuccess(result); // hides what "success" means

2. Keep tests verbose and concrete

Don't introduce helpers for brevity. The value of a test is that you can read it top-to-bottom and understand exactly what's happening. Repetition across tests is fine — each test should be self-contained and readable on its own.

3. One flow per test

Each test should exercise one coherent user scenario from setup through assertion. Don't combine unrelated flows into a single test, and don't split one logical flow across multiple tests.

4. Tests form a behavioral hull

The full set of tests for a system should cover the sufficiently complete set of flows a user might follow. Think about:

  • The happy path for each major feature
  • Edge cases a user would realistically hit
  • Error cases and what the user sees when things go wrong

When adding a new feature, add tests that cover the new user flows it introduces. When fixing a bug, add a test that reproduces the flow where the bug occurred.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 52 lines · 25 tokens per session scan A ffd07d4369e7

Subscribe to this mod's changes

writing-tests is a skill published in the GitHub repository saffron-health/libretto (889 stars, last pushed 20d ago), licensed MIT. It adds 25 tokens to every session and 457 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

playwright-cli

Automate browser interactions, test web pages and work with Playwright tests.

microsoft/playwright · 19 tokens

android-ui-journey-testing

XML-specified Android UI journey testing, interactive step execution, assertion verification, and JSON outcome reporting.

sickn33/agentic-awesome-skills · 27 tokens

develop-web-game

Use when Codex is building or iterating on a web game (HTML/JS) and needs a reliable development + testing loop: implement small changes, run a Playwright-based test script with short input bursts and intentional pauses, inspect screenshots/text, and review console errors with rendergametotext.

netease-youdao/LobsterAI · 64 tokens

solopi-ai

A command-line framework for testing Android apps and devices with SoloPi, including on-device or cloud AI decision models. It manages devices, test cases, recorded interactions, replays, performance history, and evidence.

alipay/SoloPi · 127 tokens

dogfood

Systematically explore and test a mobile app on iOS/Android with agent-device to find bugs, UX issues, and other problems. Use when asked to dogfood, QA, exploratory test, find issues, bug hunt, or test this app on mobile.

callstack/agent-device · 55 tokens

asc-shots-pipeline

Orchestrate iOS screenshot automation with xcodebuild/simctl for build-run, AXe for UI actions, JSON settings and plan files, Koubou-based framing (asc screenshots frame), and screenshot upload (asc screenshots upload). Use when users ask for automated screenshot capture, AXe-driven simulator flows, frame composition…

rorkai/app-store-connect-cli-skills · 79 tokens