Back to guide/Developer Tools

Test Generation

Specifies the framework, scopes coverage to public APIs, and tells Claude Code to match existing test patterns rather than inventing new conventions.

claude-code-tipsfile_pathtest_framework
Edit View
Prompt
Generate tests for {{file_path}}.

Testing requirements:
- Framework: {{test_framework}}
- Cover happy path, edge cases, and error handling
- Mock external dependencies (DB, API calls, file system)
- Follow the test patterns already used in this project (check existing test files first)
- Each test should have a descriptive name explaining the scenario

Do NOT test private implementation details — only test the public API/exports of the module.

Variables to customize

{{file_path}}{{test_framework}}

Why this prompt works

Specifies the framework, scopes coverage to public APIs, and tells Claude Code to match existing test patterns rather than inventing new conventions.

Save this prompt to your library

Organize, version, and access your best prompts across ChatGPT, Claude, and Cursor.