unit-test-manners

unit-test-manners is a cursor rule for Cursor from yu-iskw/skill-inspector. It costs 334 tokens per session, scanned A, a copy of unit-test-manners, Apache-2.0.

A set of guidelines for writing unit tests—small tests that check individual pieces of code. It recommends separating business logic from network, database, and file-system work so the logic can be tested with fixed inputs and outputs.

In plain words
What is it for?
Use it when designing or reviewing unit tests and when separating application logic from infrastructure such as databases, networks, or files.
Why use it?
It reduces tests that break when external services change and avoids tests that only confirm a mock behaved as expected. It also makes the code easier to test in isolation.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

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 rules/yu-iskw/skill-inspector/unit-test-manners
Clone the repo
git clone --depth 1 https://github.com/yu-iskw/skill-inspector

Made for: Cursor.

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 unit-test-manners

README.md
[![agentmods](https://agentmods.dev/badge/rules/yu-iskw/skill-inspector/unit-test-manners.svg)](https://agentmods.dev/rules/yu-iskw/skill-inspector/unit-test-manners)
Your own site
<a href="https://agentmods.dev/rules/yu-iskw/skill-inspector/unit-test-manners"><img src="https://agentmods.dev/badge/rules/yu-iskw/skill-inspector/unit-test-manners.svg" alt="Measured on agentmods" height="20"></a>
Per session 334 This file is loaded in full into every session.
When invoked 334 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin 92% copy Near-identical to another mod 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.00334 $0.00334
Opus 5 $0.00167 $0.00167
Sonnet 5 $0.00067 $0.00067
Haiku 4.5 $0.00033 $0.00033

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

Security

Grade A, and why

unit-test-manners 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 5d 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.

Origin

This is a copy

92% identical to unit-test-manners — 3 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.cursor/rules/unit-test-manners.mdc · 20 lines

What it actually says

Unit Test Manners: Decoupling for Testability

When implementing unit tests, adhere to the following principles to ensure robust, maintainable, and fast tests:

  1. Avoid Mocks and Patches for External Dependencies:

    • Do not rely on mocks or patches, especially for methods or functions that involve external interactions such as network requests, database calls, or file system operations.
    • Such tests often become brittle, difficult to maintain, and can give a false sense of security, as they test the interaction with a mocked dependency rather than the actual behavior of the system under test when integrated with real dependencies.
  2. Decouple Methods and Functions:

    • Design your methods and functions to be as decoupled as possible from external dependencies.
    • Focus on creating "pure" functions or components with clear inputs and deterministic outputs, allowing them to be tested in isolation without the need for network requests or other I/O operations.
    • Consider patterns such as "functional core, imperative shell" or "Hexagonal Architecture" to separate business logic from infrastructure concerns.
    • For infrastructure components that still require testing, explore techniques like "Nullables" where production code includes an "off" switch for dependencies or mechanisms to track output for state-based assertions, as discussed in "Testing Without Mocks: A Pattern Language" by James Shore [https://www.jamesshore.com/v2/blog/2018/testing-without-mocks].

By following these guidelines, you can write unit tests that are reliable, fast, and accurately reflect the behavior of your code.

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. 5d ago First seen · 20 lines · 334 tokens per session scan A 47cb0628f0c8

Subscribe to this mod's changes

unit-test-manners is a cursor rule published in the GitHub repository yu-iskw/skill-inspector (2 stars, last pushed 5d ago), licensed Apache-2.0. It adds 334 tokens to every session, about $0.0017 per session on Opus 5. A static security scan graded it A with 0 findings. It is 92% identical to unit-test-manners, differing in 3 lines, and is treated as a copy.