Claude Code is a capable test author when given clear scope. A good starting prompt is "Write unit tests for [function/file] covering edge cases including null inputs, empty arrays, and boundary values." For more advanced coverage, ask for "test fixtures for [model/feature] that cover: a typical case, an edge case with empty values, and a case with maximum data," or for end-to-end assurance, "Write integration tests for [feature] that test the full request/response cycle including database interactions and edge cases." If you want to harden an existing module, "Analyze [file/module] and identify untested code paths. Write tests for the most critical gaps, prioritizing error handling and edge cases" produces a focused improvement plan.
When a test is failing, hand Claude the full error and ask it to find the cause rather than guess at a fix: "This test is failing with [error message]. Read the test and the code it tests, then find and fix the root cause." For reviews, the prompt "Review [file] for code quality, potential bugs, readability issues, and adherence to best practices. Suggest specific improvements" is a strong general-purpose template, and you can apply the same shape to pull requests with "Review the changes in [files] as if doing a code review: check for bugs, security issues, missing tests, and adherence to the project's coding standards."
Specialized reviews benefit from explicit scope. For security, ask "Review [file or feature] for security vulnerabilities including XSS, SQL injection, and OWASP top 10 issues," or build security into a feature from the start with "Implement [feature] with security as the top priority. Validate all inputs, sanitize outputs, and explain any security decisions made." For performance, "Identify performance bottlenecks in [file/function] and suggest optimizations, focusing on [N+1 queries / memory usage / response time]" targets the analysis to your concern. When you are weighing options, the prompt "What are the tradeoffs between [approach A] and [approach B] for [use case]? Which would you recommend and why?" is a good way to get an opinionated answer with reasoning.