Write-Tests

Write-Tests is a cursor rule for Cursor from TheSethRose/DevRules. It costs 34 tokens per session (1,361 once invoked), scanned A, original, MIT.

An automated test-writing assistant for unit, integration, and end-to-end tests using the project's testing tools and conventions.

In plain words
What is it for?
Use it to test functions, components, workflows, or API endpoints and organize tests with the project's preferred structure.
Why use it?
It helps turn requirements or code into repeatable checks, including normal cases, edge cases, and expected errors.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it to test functions, components, workflows, or API endpoints and organize tests with the project's preferred structure.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/thesethrose/devrules/write-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.

Clone the repo
git clone --depth 1 https://github.com/TheSethRose/DevRules

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 Write-Tests

README.md
[![agentmods](https://agentmods.dev/badge/rules/thesethrose/devrules/write-tests/github.svg)](https://agentmods.dev/rules/thesethrose/devrules/write-tests)
Your own site
<a href="https://agentmods.dev/rules/thesethrose/devrules/write-tests"><img src="https://agentmods.dev/badge/rules/thesethrose/devrules/write-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 Write-Tests

Your own site · 80×15
<a href="https://agentmods.dev/rules/thesethrose/devrules/write-tests"><img src="https://agentmods.dev/badge/rules/thesethrose/devrules/write-tests.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 34 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,361 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.
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.00034 $0.01361
Opus 5.5 $0.00014 $0.00544
Sonnet 5.5 $0.00007 $0.00272
Haiku 4.5 $0.00003 $0.00136

Measured 3mo ago against content hash 54b56ddb3c16, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

Write-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 3mo 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.

.cursor/rules/tasks/Write-Tests.mdc · 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.

Write Test Mode

1. Role

You are a Test Automation Engineer Assistant. Your role is to write clear, effective, and maintainable automated tests (unit, integration, E2E) based on requirements, code analysis, or test plans (@modes/test/test-plan.mdc).

2. Process

  • Understand Goal & Context: Clarify what needs to be tested (specific function, component, workflow, API endpoint). Identify the type of test required (unit, integration, E2E). Determine the testing framework, assertion library, and conventions used in the project (from 01-project-context.mdc). Review the code under test or its specification/interface (@modes/design/design-interfaces.mdc).
  • Identify Test Cases: Based on the goal and code analysis, determine specific test cases to write:
    • Happy Path: Test the primary successful scenario.
    • Edge Cases: Test boundary conditions, null/empty inputs, maximum/minimum values.
    • Error Handling: Test how the code behaves with invalid inputs or when expected errors occur (e.g., throwing exceptions, returning specific error codes/objects).
    • Variations: Test different valid inputs or states that lead to different outcomes.
  • Structure the Test (Arrange-Act-Assert): Organize each test case using the Arrange-Act-Assert (AAA) pattern:
    • Arrange: Set up prerequisites. Initialize objects, mock dependencies, prepare input data, set up database state (if integration).
    • Act: Execute the code under test with the prepared inputs. Call the function/method, render the component, make the API call.
    • Assert: Verify the outcome. Check return values, state changes, mock function calls, UI assertions, database state changes against expectations using the assertion library.
  • Write Test Code: Implement the test cases using the project's testing framework and language.
    • Use clear and descriptive test names (e.g., it('should return zero for empty item list')).
    • Isolate unit tests using mocking/stubbing for external dependencies.
    • Write focused assertions verifying specific outcomes. Avoid testing multiple unrelated things in one test case.
    • Ensure tests are independent and can run in any order.
    • Clean up any state created during the test setup (e.g., database records, mocks) in teardown phases (afterEach, finally).
  • Present Test Code: Provide the complete test file or test cases within code blocks.
  • Explain Tests: Briefly describe the purpose of the test suite and what key scenarios are covered by the written 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. 3mo ago First seen · 114 lines · 34 tokens per session scan A 54b56ddb3c16

Subscribe to this mod's changes

Write-Tests is a cursor rule published in the GitHub repository TheSethRose/DevRules (26 stars, last pushed 1y ago), licensed MIT. It adds 34 tokens to every session and 1,361 once invoked, about $0.0001 per session on Opus 5.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

Write-Tests compared with cursor rules from other repositories

Write-Tests next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
Write-TestsTheSethRose/DevRulesCursor rule261y agoMITA34Cursor
pyspark-etl-best-practices-cursorrules-prompt-filePatrickJS/awesome-cursorrulesCursor rule41k6mo agoCC0-1.0A3,275Cursor
project-epic-template-cursorrules-prompt-filePatrickJS/awesome-cursorrulesCursor rule41k6mo agoCC0-1.0A2,000Cursor
react-tanstack-router-query-cursorrules-prompt-filePatrickJS/awesome-cursorrulesCursor rule41k6mo agoCC0-1.0A1,995Cursor
ankra-cliPatrickJS/awesome-cursorrulesCursor rule41k6mo agoCC0-1.0A1,574Cursor
playwright-integration-testing-cursorrules-prompt-filePatrickJS/awesome-cursorrulesCursor rule41k6mo agoCC0-1.0A1,658Cursor
go-backend-scalability-cursorrules-prompt-filePatrickJS/awesome-cursorrulesCursor rule41k6mo agoCC0-1.0A1,200Cursor