Cursor AI Testing Patterns

Cursor AI Testing Patterns is a skill for Claude Code, Codex from PramodDutta/qaskills. It costs 46 tokens per session (4,668 once invoked), scanned A, original, MIT.

A guide to using Cursor, an AI-powered code editor, for creating and maintaining automated tests. It covers test generation, inline edits, multi-file changes, debugging, and rules for consistent test code.

In plain words
What is it for?
Use it to generate test suites, edit individual tests, debug failures, configure testing conventions, and coordinate fixtures, helpers, and test files.
Why use it?
It helps developers work with existing codebase patterns instead of writing every test from scratch. It also organizes larger test changes and makes failed tests easier to investigate.

Skill for Claude CodeCodex

Which agent this was written for is unclear — built for aider. Also seen: mentions Codex; built for aider; mentions Cursor.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is vi.mock('../db/connection', () => ({.

Good fit Use it to generate test suites, edit individual tests, debug failures, configure testing conventions, and coordinate fixtures, helpers, and test files.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/PramodDutta/qaskills
agentmods
npx agentmods add skills/pramoddutta/qaskills/cursor-testing-patterns

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 Cursor AI Testing Patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/pramoddutta/qaskills/cursor-testing-patterns.svg)](https://agentmods.dev/skills/pramoddutta/qaskills/cursor-testing-patterns)
Your own site
<a href="https://agentmods.dev/skills/pramoddutta/qaskills/cursor-testing-patterns"><img src="https://agentmods.dev/badge/skills/pramoddutta/qaskills/cursor-testing-patterns.svg" alt="Measured on agentmods" height="20"></a>
Per session 46 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,668 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 medium

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 →

  • medium Excessive Agency · line 518
    Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.
    Fix: Add human-in-the-loop confirmation for destructive, irreversible, or high-impact operations. Never auto-execute commands that modify files, send data, or alter system state.
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.00046 $0.04668
Opus 5 $0.00023 $0.02334
Sonnet 5 $0.00009 $0.00934
Haiku 4.5 $0.00005 $0.00467

Measured 4d ago against content hash 48cf86947e36, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

Cursor AI Testing Patterns 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 4d 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.

seed-skills/cursor-testing-patterns/SKILL.md · 519 lines

How it starts

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

Cursor AI Testing Patterns Skill

You are an expert in using Cursor AI IDE for test automation. When the user asks you to generate tests with Cursor, configure Cursor rules for testing, use Composer for multi-file test generation, or optimize Cursor workflows for QA, follow these detailed instructions.

Core Principles

  1. Codebase-aware generation -- Cursor indexes your entire codebase. Reference files, functions, and patterns using @mentions to give the AI full context for test generation.
  2. Rules for consistent quality -- Configure .cursorrules to enforce testing conventions, naming patterns, and framework preferences across all AI-generated tests.
  3. Composer for multi-file operations -- Use Cursor Composer for generating test suites that span multiple files: page objects, fixtures, helpers, and test specs.
  4. Cmd+K for surgical edits -- Use inline editing (Cmd+K) for targeted changes: adding a test case, fixing an assertion, or refactoring a single test function.
  5. Chat for investigation -- Use Cursor Chat with @codebase to understand existing test patterns before generating new ones. Ask it to explain failures.
  6. Apply from Chat -- When Chat suggests code, use the Apply button to directly insert or replace code in your editor rather than copy-pasting.
  7. Iterative test development -- Generate a basic test suite first, run it, then use Cursor to fix failures and add edge cases based on execution results.

Project Structure

project/
  .cursorrules                 # Testing conventions
  .cursor/
    rules/
      testing.mdc              # Testing-specific rules
  src/
    services/
      user-service.ts
      user-service.test.ts
    components/
      LoginForm.tsx
      LoginForm.test.tsx
  tests/
    e2e/
      login.spec.ts
      checkout.spec.ts
    fixtures/
      test-data.ts
    helpers/
      test-utils.ts

Cursor Rules for Testing

<!-- .cursorrules -->
# Testing Rules

## Test Framework
- Use vitest for all unit and integration tests
- Use Playwright for E2E tests
- TypeScript strict mode in all test files

## Test Conventions
- Follow Arrange-Act-Assert (AAA) pattern
- Name tests: "should [expected behavior] when [condition]"
- Group related tests in describe blocks
- One assertion focus per test (multiple asserts allowed if testing same behavior)
- Always include edge cases: null, undefined, empty values, boundary conditions
- Always include error/failure test cases

## Mocking
- Use vi.mock() for module mocking
- Use vi.fn() for function mocking
- Use vi.spyOn() for spying on existing methods
- Reset mocks in beforeEach with vi.clearAllMocks()
- Never mock the module under test

## Assertions
- Prefer specific assertions: toBe, toEqual, toContain over toBeTruthy
- Use toThrow for error testing
- Use resolves/rejects for async assertions
- Include meaningful error messages in assertions

## File Organization
- Colocate tests with source files: foo.ts -> foo.test.ts
- E2E tests in tests/e2e/
- Shared test utilities in tests/helpers/
- Test fixtures in tests/fixtures/

## Do Not
- Use any type in test files
- Use setTimeout for async waiting
- Write tests that depend on execution order
- Hard-code API URLs or credentials
- Skip tests without a TODO comment explaining why

Read the full file on GitHub · 519 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. 4d ago First seen · 519 lines · 46 tokens per session scan A 48cf86947e36

Subscribe to this mod's changes

Cursor AI Testing Patterns is a skill published in the GitHub repository PramodDutta/qaskills (218 stars, last pushed 8d ago), licensed MIT. It adds 46 tokens to every session and 4,668 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-09-03.