Claude Code: Review a Diff Against the Spec

A review prompt that sends a subagent to check a diff against SPEC.md requirement by requirement and report only correctness gaps, skipping style.

  • 🤖 Claude Code
  • 🗂️ Coding

Last verified: write-up checked

Prompt by Anthropic · Original source (opens in a new tab)

Claude Code: Review a Diff Against the Spec — prompt preview

The prompt

prompt
use a subagent to review the rate limiter diff against SPEC.md, check every requirement is implemented and the listed edge cases have tests, report gaps that affect correctness and skip style

What it is

From the "Review against your spec" section of Anthropic's Claude Code best-practices page. Instead of a general bug hunt, you write the review prompt yourself so the reviewer checks the work against your plan. The prompt asks a subagent to confirm every requirement in SPEC.md is implemented and every listed edge case has tests, and to report only gaps that affect correctness.

Who it's for

  • Developers who wrote a spec first and want the code checked against it
  • Teams using Claude Code subagents for review

Requirements

Requirements

  • Claude Code

طلب مراجعة يكلّف وكيلاً فرعياً بفحص التعديلات مقابل ملف SPEC.md بنداً بنداً والإبلاغ عن الثغرات المؤثرة في الصحة فقط مع تجاهل الأسلوب.

Examples

From the source

Prompt
prompt
use a subagent to review the rate limiter diff against SPEC.md, check every requirement is implemented and the listed edge cases have tests, report gaps that affect correctness and skip style

Expected output: Exact prompt from Anthropic docs.

Pros & cons

Pros

  • Pro:A fresh subagent reviews without the bias of the session that wrote the code
  • Pro:Checks against a written spec, not just style

Cons

  • Con:Needs a spec file to compare against

Tips

  • Keep the "skip style" part: the source warns a reviewer asked to find problems will always find something, and fixing every finding adds needless abstraction and tests
  • A fresh reviewer helps because it hasn't seen your reasoning; for a general review the source points to /code-review