writing-tests

writing-tests is a skill for Claude Code, Codex from spencerpauly/awesome-cursor-skills. It costs 59 tokens per session (992 once invoked), scanned A, original, CC0-1.0.

A procedure for examining existing code and writing unit and integration tests for it. Unit tests check small pieces of code, while integration tests check how pieces work together.

In plain words
What is it for?
Use it to detect the project’s test setup, analyze functions or components, mock external services, and create tests that match existing conventions.
Why use it?
It helps find untested code paths and verify normal cases, errors, edge cases, dependencies, and side effects.

Skill for Claude CodeCodex

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

Good fit Use it to detect the project’s test setup, analyze functions or components, mock external services, and create tests that match existing conventions.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/spencerpauly/awesome-cursor-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 spencerpauly/awesome-cursor-skills --skill writing-tests
Clone the repo
git clone --depth 1 https://github.com/spencerpauly/awesome-cursor-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/spencerpauly/awesome-cursor-skills/writing-tests/github.svg)](https://agentmods.dev/skills/spencerpauly/awesome-cursor-skills/writing-tests)
Your own site
<a href="https://agentmods.dev/skills/spencerpauly/awesome-cursor-skills/writing-tests"><img src="https://agentmods.dev/badge/skills/spencerpauly/awesome-cursor-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/spencerpauly/awesome-cursor-skills/writing-tests"><img src="https://agentmods.dev/badge/skills/spencerpauly/awesome-cursor-skills/writing-tests.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 59 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 992 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
  • Socket pass 12 Apr 2026
  • Snyk pass 12 Apr 2026
  • 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.00059 $0.00992
Opus 5 $0.00030 $0.00496
Sonnet 5 $0.00012 $0.00198
Haiku 4.5 $0.00006 $0.00099

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

resources/writing-tests/SKILL.md · 114 lines

How it starts

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

Writing Tests

Use this skill when the user asks to add tests to existing code, improve test coverage, or write tests for a specific file or module.

Steps

  1. Detect the test setup — check what's already configured:

    # Check package.json for test runner
    cat package.json | grep -E "jest|vitest|mocha|playwright|cypress"
    

    Look for config files: vitest.config.ts, jest.config.ts, playwright.config.ts, .mocharc.*. Check for existing test files to understand the project's test patterns and conventions.

  2. If no test runner exists — set one up:

    npm install -D vitest @testing-library/react @testing-library/jest-dom
    

    Add a test script to package.json:

    { "test": "vitest run", "test:watch": "vitest" }
    
  3. Analyze the target code — read the file(s) to test and identify:

    • Public API: exported functions, classes, components, hooks
    • Code paths: conditionals, error handling, edge cases
    • Dependencies: external services, databases, APIs that need mocking
    • Side effects: file I/O, network calls, DOM mutations
  4. Create the test file — place it next to the source file or in a __tests__/ directory, matching the project's convention:

    • src/utils/format.tssrc/utils/format.test.ts
    • src/components/Button.tsxsrc/components/Button.test.tsx
  5. Write tests following this structure:

    import { describe, it, expect, vi } from "vitest";
    
    describe("functionName", () => {
      // Happy path
      it("returns formatted output for valid input", () => { ... });
    
      // Edge cases
      it("handles empty string", () => { ... });
      it("handles null/undefined input", () => { ... });
    
      // Error cases
      it("throws on invalid argument", () => { ... });
    
      // Boundary conditions
      it("handles maximum length input", () => { ... });
    });
    
  6. Mock external dependencies — don't make real API calls or database queries in unit tests:

Read the full file on GitHub · 114 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. 9d ago First seen · 114 lines · 59 tokens per session scan A b9312668ed4e

Subscribe to this mod's changes

writing-tests is a skill published in the GitHub repository spencerpauly/awesome-cursor-skills (772 stars, last pushed 1mo ago), licensed CC0-1.0. It adds 59 tokens to every session and 992 once invoked, about $0.0003 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-09-03.