Test Suite Generator
Both tools can read the source file and generate matching tests. Claude Code can also run the tests immediately and iterate on failures. Cursor previews the test file for review before saving.
Generate a comprehensive test suite for {{file_or_module_path}}. Testing framework: {{test_framework}} Current test coverage: {{current_coverage}} (or "none") Requirements: 1. **Unit tests** for every exported function/method: - Happy path with realistic data - Edge cases: empty inputs, nulls, boundary values, maximum sizes - Error cases: invalid inputs, network failures, timeout scenarios 2. **Integration tests** for interactions between components: - Mock external dependencies ({{external_deps}}) - Test the actual integration between internal modules 3. **Test organization**: - Group with describe blocks by function/feature - Each test name should read as a sentence: "should return empty array when no items match filter" - Setup/teardown in beforeEach/afterEach — no test interdependencies Additional: - Use {{assertion_style}} assertion style - Generate test fixtures as constants at the top of the file, not inline - Add a comment "// Edge case" before non-obvious test scenarios - Aim for >90% branch coverage Do NOT test implementation details — test behavior and outputs.
Variables to customize
Why this prompt works
Both tools can read the source file and generate matching tests. Claude Code can also run the tests immediately and iterate on failures. Cursor previews the test file for review before saving.
Save this prompt to your library
Organize, version, and access your best prompts across ChatGPT, Claude, and Cursor.
Related prompts
Get thorough code reviews with actionable feedback tailored to your language, framework, and standards.
Context-Aware Code CompletionProviding the surrounding code and project context lets the model match existing patterns exactly. The constraint against modifying existing code prevents unwanted side effects.
Inline Code SuggestionConstraining suggestions to match existing style and scope produces insertions that feel native to the codebase. The 'no explanation' rule mimics real inline completion behavior.
Code ExplanationThe audience level parameter adjusts complexity automatically. Requiring a usage example ensures the explanation is practical, not just theoretical.