Generate a .cursorrules File for a QA Codebase
Returns a `.cursorrules` file tailored for QA work — locator preferences, anti-patterns to avoid, test naming conventions, assertion style, and rules for asking clarification before fabricating selectors or test data.
When to use it
- Adding Cursor IDE to a QA codebase.
- Reducing time spent fixing Cursor's auto-generated tests.
- Standardizing AI assistance across QA engineers using Cursor.
- Migrating from generic .cursorrules to QA-specific.
The prompt
XML-tagged — best for Claude 4.x
<role>
You are a Cursor power user. You know that .cursorrules dramatically improves output quality but only if rules are specific to the QA domain — generic rules ("write clean code") add no value.
</role>
<context>
.cursorrules is loaded into every prompt Cursor sends to its underlying model. Good content:
- Locator preferences (which to use, which to avoid)
- Test naming conventions
- Assertion patterns
- Anti-patterns to NEVER produce
- "Ask before guessing" rules (selectors, test data, env vars)
- Framework-specific gotchas (Cypress chaining, Playwright auto-waiting, Vitest mocking semantics)
The file is plain markdown / text. Keep < 150 lines; longer dilutes signal.
</context>
<task>
Generate a `.cursorrules` with these sections:
1. Project context (1-2 sentences)
2. When generating tests
3. When generating POMs
4. Anti-patterns to NEVER produce
5. Ask for clarification rules
6. Style conventions
</task>
<input>
Project framework: {framework}
Language: {language}
Locator strategy: {locator_strategy}
Test data convention: {test_data}
Known anti-patterns from your codebase: {anti_patterns}
</input>
<constraints>
- Rules SPECIFIC, not generic ("Use data-testid first, not class selectors").
- Anti-patterns called out by NAME (waitForTimeout, magic numbers, etc.).
- "Ask before guessing" must be explicit (clarify which scenarios).
- Style conventions named, not implied.
- 80-150 lines total.
</constraints>
<output_format>
A complete `.cursorrules` file as a Markdown code block.
</output_format>
Before writing, identify the 3-5 most common pain points in this team's Cursor output and address them in the file.Example
Common pitfalls
- Rules become generic ('write good code'); force specifics tied to your stack.
- Anti-patterns called out without naming the specific construct (e.g., 'avoid waits' vs 'no page.waitForTimeout').
- Ask-before-guessing rules missing; Cursor fabricates selectors / data without asking.
- .cursorrules file balloons past 200 lines; signal dilutes. Keep tight.
Tips
- Test the .cursorrules by giving Cursor a small task and watching the output; refine rules iteratively.
- Pair with `claude-md-for-qa` for the Claude Code equivalent in the same repo.
- Refresh when major framework versions land (Playwright 1.50 → 1.55, etc.).
- Document team-specific style conventions in the file; they get applied automatically across all Cursor invocations.
FAQ
Cursor (most popular in 2026): native AI IDE with .cursorrules + composer + commands. Continue: open-source VS Code extension; similar concept. Cody (Sourcegraph): code-search powered AI; great for large codebases. All accept similar instruction files; the format differs.
Related prompts
Generate CLAUDE.md for a QA Project
Reads a description of your QA project (framework, language, conventions, CI setup) and returns a ready-to-commit `CLAUDE.md` covering project structure, allowed bash commands, test execution workflow, code conventions, and 'do/do not' rules tailored to QA work — making Claude Code dramatically more useful in your repo.
Open →Build an AI PR Review Bot for Test Quality
Returns a prompt + decision framework for an AI PR-review bot tuned for QA — checks for test anti-patterns, missing tests for new branches/conditions, naming convention violations, and assertion quality, with explicit rules for when to comment vs skip and how to phrase comments without false confidence.
Open →Review Test Code for Anti-Patterns
Reads a test file and returns a categorized list of anti-patterns — hard sleeps, shared mutable state, weak assertions (`toBeTruthy` instead of `toEqual`), missing teardown, mixed setup/assertion concerns — each with line numbers, severity, and a suggested fix.
Open →Build an AI Bug Triage Workflow
Returns a 5-step AI bug triage workflow (intake → classify → severity → owner assignment → duplicate detection) with the prompt for each step, the structured output schema, and the handoff between steps. Final step emits a structured triage decision.
Open →