writing-tests

A set of repository rules for writing, changing, and reviewing tests. It focuses on checking what software actually does rather than merely searching its source code.

In plain words
What is it for?
Use it when adding or reviewing tests for functions, scripts, parsers, command-line tools, filesystems, and configuration files, including tests that need real dependencies or recorded stubs.
Why use it?
It helps tests fail when a real defect returns, instead of passing because code contains a particular word or line. It also addresses non-vacuous tests, parser edge cases, hostile file states, and coverage quality.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/alexandermattturner/agent-glovebox/writing-tests
Any agent
npx skills add AlexanderMattTurner/agent-glovebox --skill writing-tests
Clone the repo
git clone --depth 1 https://github.com/AlexanderMattTurner/agent-glovebox

Made for: Claude Code, Codex.

Per session 267 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 8,502 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 2 findings. Scan, not verified.
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 $0.00267 $0.08502
Opus 5 $0.00133 $0.04251
Sonnet 5 $0.00053 $0.01700
Haiku 4.5 $0.00027 $0.00850

Measured today against content hash d81c9e6ad37e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

writing-tests scanned grade B with 2 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 today.

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.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

**Never grep the implementation as a proxy for what it does.** `assert "chmod 0444" in script` passes whether or not that line ever runs, breaks on a harmless rename, and stays green against a broken implementation that

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

- **A tool that only needs a remote gets a REAL run against a local server — never a `PATH` stub of itself.** Fake the far side, not the thing under your hand: a stub of `gh`/`curl`/`aws` certifies only your reading of i
.claude/skills/writing-tests/SKILL.md · 228 lines

How it starts

The opening of the file, as written. The whole thing — 228 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Writing Tests

A test earns its place by going red the moment a real defect returns — not by executing lines for a coverage number. Every rule below serves that.

Test behavior, not source text

Never grep the implementation as a proxy for what it does. assert "chmod 0444" in script passes whether or not that line ever runs, breaks on a harmless rename, and stays green against a broken implementation that still contains the token. Instead drive the real code path and assert the observable outcome: run the function or script with the real dependency where one can run (a real git in a scratch repo, a real file tree, the real parser, a real CLI against a local server), or where it genuinely cannot, under a stub that records how it was called (a fake install, docker, id on PATH) — and check what actually happened: the file written and its mode/owner, the argv+env a binary was exec'd with, the exit code, the bytes on stdout/stderr, the state left on disk.

The only legitimate exceptions parse data, not imperative logic: validating a config artifact the product ships and loads at runtime (a settings.json, an execpolicy.rules) with its real parser, or pinning a cross-file structural contract two files must agree on when no single process can observe both. A grep of imperative source to confirm it "does X" is never an exception.

Fake the SERVICE, never the tool — and never invent its data

A change whose correctness depends on how an external dependency BEHAVES ships an end-to-end test that drives its whole path against that real dependency — write it FIRST, and let stubs fill only what it cannot reach. The trigger is a dependency whose behavior you would otherwise assert from belief: a CLI, a service, a kernel or filesystem semantic, a parser you do not own. Three kinds of change owe none. A change to pure logic — its unit test already drives the whole path, and there is no far side to be wrong about. A refactor that keeps behavior — the tests it must keep green ARE the end-to-end test, and a new one only re-pins what they pin. A fault branch reachable only by a failure you cannot induce for real (a chmod that root ignores, a vanished path, a tool absent from PATH) — inducing it is what a stub is legitimately for, and there the stub PRODUCES the fault; it never stands in for the tool's ordinary work. A stub answers with whatever the test author believed the real dependency returns, so when the bug under test IS that belief — the commonest kind in code that talks to an external API — the fixture encodes the wrong belief on both sides and the suite goes green through the defect.

Read the full file on GitHub · 228 lines

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. today Changed · +19 lines · +124 tokens per session d81c9e6ad37e
  2. yesterday First seen · 209 lines · 143 tokens per session scan B 881727dd16b1

Subscribe to this mod's changes

writing-tests is a skill published in the GitHub repository AlexanderMattTurner/agent-glovebox (57 stars, last pushed today), licensed Apache-2.0. It adds 267 tokens to every session and 8,502 once invoked, about $0.0013 per session on Opus 5. A static security scan graded it B with 2 findings (asks for root, makes network calls). 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

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

next-cache-components-adoption

Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…

vercel/next.js · 95 tokens

babysit-pr

Babysit a GitHub pull request after creation by continuously polling review comments, CI checks/workflow runs, and mergeability state until the PR is merged/closed or user help is required. Diagnose failures, retry likely flaky failures up to 3 times, auto-fix/push branch-related issues when appropriate, and keep…

openai/codex · 114 tokens

imagegen

Generate or edit raster images when the task benefits from AI-created bitmap visuals such as photos, illustrations, textures, sprites, mockups, or transparent-background cutouts. Use when Codex should create a brand-new image, transform an existing image, or derive visual variants from references, and the output…

openai/codex · 113 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens

next-cache-components-optimizer

Drive a Next.js route to instant navigation by setting up an agentic loop, under Cache Components / PPR, on initial load (hard navigation) and client-side navigation (soft navigation). Encode the goal as a failing @next/playwright instant() e2e and work it to green, one verified route at a time; the shipped test then…

vercel/next.js · 170 tokens