writing-tests

writing-tests is a skill for Claude Code, Codex from iliaal/ai-skills. It costs 48 tokens per session (949 once invoked), scanned A, original, MIT.

A set of rules for writing useful automated tests: checks that can fail when behaviour is wrong and use the project's actual test setup. It covers test structure, assertions, mocks, runners, and project conventions.

In plain words
What is it for?
It helps discover the correct test runner and commands, choose focused and full test runs, follow existing test-file conventions, and test one behaviour at a time.
Why use it?
It helps avoid tests that only exercise mocks, never fail, use the wrong command, or pass locally but fail in continuous integration.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It helps discover the correct test runner and commands, choose focused and full test runs, follow existing test-file conventions, and test one behaviour at a time.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/iliaal/ai-skills/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 iliaal/ai-skills --skill writing-tests
Clone the repo
git clone --depth 1 https://github.com/iliaal/ai-skills

Made for: Claude Code, Codex.

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/iliaal/ai-skills/writing-tests/github.svg)](https://agentmods.dev/skills/iliaal/ai-skills/writing-tests)
Your own site
<a href="https://agentmods.dev/skills/iliaal/ai-skills/writing-tests"><img src="https://agentmods.dev/badge/skills/iliaal/ai-skills/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/iliaal/ai-skills/writing-tests"><img src="https://agentmods.dev/badge/skills/iliaal/ai-skills/writing-tests.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 48 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 949 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 warn 7 Sept 2026
SkillSpector: 1 finding, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Memory Poisoning · line 187
    Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.
    Fix: Protect agent memory and state from modification by untrusted content. Use read-only memory for critical instructions and validate all state changes.
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.00048 $0.00949
Opus 5 $0.00024 $0.00475
Sonnet 5 $0.00010 $0.00190
Haiku 4.5 $0.00005 $0.00095

Measured 2d ago against content hash 5f4450cb9fd5, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, 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 2d 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.

skills/writing-tests/SKILL.md · 41 lines

How it starts

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

Writing tests

Produce tests that prove the requested behavior and fail when that behavior breaks. Follow user scope and the repository's actual contracts; this skill does not authorize implementation, external actions, or changes to acceptance criteria.

Procedure

  1. Discover the repository's runner, pinned wrapper, configuration, neighboring tests, and CI command before writing tests. Learn both focused and full-suite commands. Use project tooling rather than a global default; keep tracked scripts portable and apply personal wrappers only to the outer invocation.
  2. Derive cases from user requirements, implemented behavior, and claims intended for the handoff. Map each acceptance criterion to a discriminating case that a plausible wrong implementation fails. Name tests by observable behavior; keep one behavior per test and make fixtures adversarial on the axis under test.
  3. For bug fixes, write the reproducer, observe the intended failure, apply the smallest fix, and observe green. For new features, develop tests alongside the implementation. Refactor after green. Never alter a specification, assertion, fixture, snapshot, or expected output merely to make the implementation pass.
  4. Prefer real internal objects, real temporary files, and real test databases. Mock only external boundaries, at the last owned adapter; framework-maintained fakes are appropriate where the framework recommends them. Check the real contract and side effects before mocking.
  5. Assert consumer-visible outcomes rather than private structure, mock calls, or framework behavior. Include relevant boundary, invalid-input, concurrency, and failure cases. If error handling catches, logs, substitutes, or rolls back, assert its observable result as well as error visibility.
  6. Prove absence/isolation assertions with a run-unique forbidden violation and observe that specific assertion fail. Confirm the control mutation actually landed and its build completed before evaluating it. Remove the control, restore the artifact, and verify green.
  7. Run the narrow checks during edits and the applicable complete checks before handoff. Inspect passed/executed counts; an empty or skipped suite is not positive evidence. Report failures and skipped checks accurately.

Read the full file on GitHub · 41 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. 2d ago Changed · -277 lines 5f4450cb9fd5
  2. 3d ago Changed · +11 lines 1759c7d9f0ef
  3. 11d ago First seen · 307 lines · 48 tokens per session scan A 7637a83e34a0

Subscribe to this mod's changes

writing-tests is a skill published in the GitHub repository iliaal/ai-skills (41 stars, last pushed 3d ago), licensed MIT. It adds 48 tokens to every session and 949 once invoked, about $0.0002 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

cypress-cloud-cli

Runs the cy-cloud CLI to inspect Cypress Cloud organizations, projects, runs, specs, tests, failure screenshots, and Test Replay data. Use when the user mentions Cypress Cloud, cy-cloud, cypress-cloud-cli, a Cloud run or test URL, failing or flaky Cypress tests, Test Replay, run triage, Cloud artifacts, or asks why a…

cypress-io/ai-toolkit · 79 tokens

cypress-tap

Drives a running Cypress open-mode session through cypress tap to run and rerun specs, wait for fresh results, inspect reporter and command logs, and query or rewind the app under test through DOM, accessibility, styles, and snapshots. Use when authoring or debugging Cypress e2e or component specs, discovering…

cypress-io/ai-toolkit · 113 tokens

cypress-docs

Search and extract Cypress information from official documentation (docs.cypress.io, cypress.io); prefer LLM markdown under /llm/ and refuse unverified API or behavior claims.

cypress-io/ai-toolkit · 41 tokens

cypress-author

Creates, updates, and fixes Cypress tests (E2E/end-to-end and component tests). Use when the user asks to create tests, add tests, write tests, update tests, test this file/component, new spec, or fix a failing or flaky test. Apply even when the user does not say 'Cypress' (e.g. 'create tests for this file'). Prefer…

cypress-io/ai-toolkit · 99 tokens

cypress-explain

Explains Cypress tests (E2E and component tests), and answers questions about Cypress use and behavior. Use when the user asks to explain how a test works, explain how Cypress works, review or critique a test without writing code. Apply even when the user does not say 'Cypress' (e.g. 'explain this test'). Prefer the…

cypress-io/ai-toolkit · 93 tokens

browser-qa

Use when you need lightweight browser QA for a web page, local HTML file, or app: inspect console errors, broken assets, keyboard/focus behavior, viewport readability, and publish evidence-backed findings JSON through a local HTML report viewer.

liatrio-labs/ai-prompts · 51 tokens