create-tests

A set of instructions for creating software tests that fit the project's existing test runner and conventions.

In plain words
What is it for?
Use it when adding tests to an unfamiliar codebase. It helps find the test setup, understand how tests run, and write matching test files.
Why use it?
It reduces guesswork about which commands, files, settings, and shared test utilities the project uses. This helps avoid tests that are hard to run or inconsistent with the rest of the codebase.

Cursor rule for 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/zackiles/cursor-config/create-tests
Clone the repo
git clone --depth 1 https://github.com/zackiles/cursor-config

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 589 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 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.00000 $0.00589
Opus 5 $0.00000 $0.00295
Sonnet 5 $0.00000 $0.00118
Haiku 4.5 $0.00000 $0.00059

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

Security

Grade A, and why

create-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 yesterday.

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

Copies of this mod

2 near-identical copies found in the catalogue:

.cursor/rules/global/create-tests.mdc · 30 lines

How it starts

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

Steps To Writing or Creating Tests

  1. Determine the commands, arguments, and path of the code file that runs the tests by searching for the nearest package file that typically will list the available test runners and commands. For example, this is often a package.json or deno.json file that exposes the project's scripts and hopefully a set of test commands.

  2. Review the entry point of the test runner to understand what global utilities, patterns, strategies, logging, and high-level capabilities are implemented so you're able to debug any issues with the tests if you run into any while running them.

  3. Use the expertise you've gained in the overall testing system in the previous steps to write your tests in a way that's consistent across the codebase and avoids duplicated code or bugs introduced into the overall testing system.

NOTE ON UNDERSTANDING THE OVERALL TESTING SYSTEM:
Determine any remaining arguments or configuration needed to run the tests by reviewing the entry point of the file the test command calls. For example, this is often an index.{js/ts} or main.{js/ts} file at the root or relative root of the project in folders like ./src or ./lib. This entry point will typically provide clues on what modes, environment settings, and command arguments can be passed when running the tests. Understand how your test fits into the overall suite, and leverage or add to its overall capabilities when possible.

Requirements for ALL Written Tests

  • Light and Practical Tests: Prefer simpler, multi-purpose testing strategies such as single smoke tests or integration tests that test multiple parts of core functionality with as little code as possible.
  • Simple Tests: Avoid large test files above 500 lines of code that make it hard to refactor. Avoid testing for edge cases unless the test was written while fixing a bug and trying to prevent that bug from happening again. Avoid complicated mocking solutions.
  • Native Test Runners: Deno / Bun, otherwise Vite test.
  • Locality: Tests should be placed near the code they're testing.
  • Naming Convention: {filename_being_tested}.test.{js/ts}
  • Reusability: Extract shared functionality, e.g., ./test-utilities.{ts/js}
  • Own Environment: ALL tests MUST be run with either a flag, environment variable, or setting that makes the application know it's running in testing mode.
  • Needs Package Script: Must have, at the minimum, a simple script that runs all tests in the codebase. For example, {deno, bun, node} run tests.

Read the full file on GitHub · 30 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. yesterday First seen · 30 lines · 589 tokens per session scan A c9bf7cefc6a5

Subscribe to this mod's changes

create-tests is a cursor rule published in the GitHub repository zackiles/cursor-config (17 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 589 tokens. 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.