30 code review and refactoring prompts for Claude

The full set has 30 prompts in 6 groups, as a 6-page PDF plus a Markdown file, for 1 USD. Below is one whole group, free: Bug hunting, 5 prompts.

Copy a prompt, replace every [BRACKET] placeholder with your own details, and paste it into Claude (in Claude Code, a chat, or an API call). Each prompt is followed by one line on when to use it. Language-agnostic unless a placeholder says otherwise.

Tips: paste the code or name the file path; ask Claude to quote line numbers; run the tests yourself before trusting any suggested change.

Section 1: Bug hunting

1. Line-by-line bug scan

Review [FILE_OR_PASTED_CODE] written in [LANGUAGE]. List every likely bug, ordered by severity. For each: the line, what goes wrong, a minimal input that triggers it, and a one-line fix. Do not rewrite unrelated code.

When to use it: a first pass over a function or file before you open a pull request.

2. Off-by-one and boundary check

Examine every loop, slice, index and range in [FILE_OR_PASTED_CODE]. For each, state the first and last value it touches and whether that matches the intent: [INTENDED_BEHAVIOR]. Flag any off-by-one, empty-input or single-element failure.

When to use it: code that handles pagination, arrays, strings or date ranges.

3. Null, undefined and error-path audit

In [FILE_OR_PASTED_CODE], trace every value that can be null, undefined, empty or an error result. Show where it is used without a check, and what happens at runtime. Propose the smallest guard for each.

When to use it: after a crash report with a null or undefined error and no clear cause.

4. Concurrency and race review

Review [FILE_OR_PASTED_CODE] for race conditions, shared mutable state, missing locks or awaits, and ordering assumptions. Describe one concrete interleaving of [THREADS_OR_ASYNC_TASKS] that produces a wrong result, then suggest a fix.

When to use it: async, threaded or event-driven code that fails only sometimes.

5. Reproduce from a stack trace

Here is an error and stack trace:
[STACK_TRACE]
Here is the relevant code:
[CODE]
Explain the most likely root cause, list two alternative causes, and tell me what to log or inspect to tell them apart. Do not guess a fix until you name the evidence it relies on.

When to use it: you have a failure but no idea where it starts.

Get all 30 prompts

6 groups, 6-page PDF plus Markdown, 1 USD. AI-assisted content; independent from Anthropic.

Buy the prompts, 1 USD