OmniscioGuidesPromptsSecurity review
Claude Code prompt for security review
A security review is not a search for suspicious words. It is a walk along the data: something a user or an attacker controls enters, and the question is where it ends up and what it can do when it gets there. A prompt that asks for that walk tends to produce findings; one that asks for "security issues" tends to produce a list of patterns.
The prompt below asks for the path rather than the pattern: what an attacker controls, the line it reaches, and what they get for it.
- The prompt, ready to copy.
- Why each line is there.
- The read-only subagent version.
- What good output looks like.
- The common failure.
- Make it a one-word command.
Checked against Anthropic's Claude Code documentation on November 25, 2026. By the Omniscio team. Updated .
The prompt
Paste this into a session on the branch you want reviewed, and replace main with your base branch.
Review the diff between this branch and main for security problems only. Follow the data: for each changed file, name what a user or an attacker controls that reaches it, and where it goes from there — the database, the filesystem, a shell, a template or the DOM, or an HTTP call made in another service's name.
Report separately anything dangerous that has no input flow at all: a secret committed to the repository, a missing authorisation check, a CORS origin that is too wide, a cookie without HttpOnly.
For each finding: the input, the line it reaches, what an attacker gets, and the fix. Rank them worst first. For each path you checked and found safe, one line saying why.
Ignore style and naming. Look at performance only where no input can make it unbounded. Change nothing.
Finish with the two or three areas this diff touches or depends on that you have not covered, and say what you would look for there.The last paragraph is not filler. It is the reviewer telling you where its own coverage stops, which is the first thing you need to know before you decide how much the report is worth — and the second paragraph is there because the most serious problem in a diff often has no data flow to follow at all.
Why each line is there
"the diff on this branch"
A security review of the whole repository returns the same findings every time and buries the one your change introduced. Scoping to the diff makes the report about the change in front of you, which is the thing you can still alter.
"name what a user or an attacker controls that reaches it"
This is the line that separates a finding from a worry. A security finding is a path: attacker-controlled input, a route through the code, and an effect. If the prompt does not require the first element, the answer is a list of code shapes that look dangerous, which is the same list you would get from a linter.
"where it goes from there — the database, the filesystem, a shell, or an HTTP call"
Naming the sinks turns an open question into a checklist. It is also how Anthropic's guidance on a specific prompt works: say what "fixed" looks like up front, so the answer is aimed rather than exploratory. The list is an example rather than a definition — a template engine in an ordinary web service belongs on it as much as the database does.
"the line it reaches … and the fix"
Line and fix together are what make a finding closable. The line is the one thing that turns a class of bug into an instance of it, and the fix is the smallest change that instance needs — which is usually smaller than the redesign the report would otherwise propose. A finding with a line and no fix is a bug report; a finding with a fix and no line cannot be checked.
"what an attacker gets"
Impact is the ranking. An injection into a log line and an injection into a query are the same shape and not the same severity. Asking what is obtained forces the finding to be ranked by consequence instead of by pattern name, and it is the difference between a report you can triage and one you have to re-derive.
"For each path you checked and found safe, one line saying why"
A report that lists only findings tells you nothing about what was examined, so you cannot tell a clean diff from a shallow review. One line per safe path is cheap to write and turns the report into a record of coverage.
"Ignore style, naming, performance and test coverage"
The same reason Anthropic says to include skip style in a review prompt: a reviewer asked to find problems will always find something, and if each finding costs you a decision, the noise has a real price. Listing what to ignore is more reliable than asking it to focus, because it names the things it would otherwise reach for. Performance is the one exception written into the prompt, because work an attacker can make unbounded is a security bug wearing a performance problem's clothes.
"Change nothing"
A review that edits as it goes mixes the audit with the fix, and a security fix applied without a test is a change you cannot verify. Read first, decide second, fix third — and if you want the fixes in one pass, that is a separate instruction with its own review.
The read-only subagent version
A security review is a good subagent job: it reads widely and returns a short report, so the file contents stay in the subagent's context instead of riding along in yours for the rest of the session. Anthropic lists both of those — keeping long output out of the main conversation, and getting a reviewer that has not seen how the code was written — as reasons to use one.
Give it a tool list with no way to write. One consequence to plan for: a subagent with no Bash cannot run git diff, so name the changed files, or paste the diff, in the message that starts it.
---
name: security-reviewer
description: Reviews a diff for security problems only. Use before a merge that touches auth, input handling, file paths or queries.
tools: Read, Grep, Glob
---
You are reviewing code you did not write. For each changed file, find what an
attacker controls that reaches it, and where it lands. Report the input, the
line, the impact and the fix. One line for each path you checked and found safe.
Change nothing.Limiting it to Read, Grep, Glob is enforced by Claude Code rather than requested in the prompt, which is why it is worth doing here and not only in the text. One trap: a subagent denied Edit and Write can still change files through Bash, so leaving that out is part of the point.
The site also has a ready-made agent for this job: the security reviewer subagent, among the subagent examples. That one keeps Bash so it can read the diff itself, and says why in its own page.
What good output looks like
- Findings that read as paths. "The
redirectquery parameter reachesres.redirecton line 41 without a host check, so an attacker gets an open redirect." Input, line, effect. - Ranked by what an attacker gets. Data exposure ahead of a missing header.
- A safe list. One line per path that was followed and closed — a large diff may need more than a few.
- Fixes that are smaller than the finding. One validation at the boundary, not a rewrite of the handler.
- A next-areas list. What this diff touches that the review did not reach, so you know where to look next.
The common failure
The report is a page of advice with no lines in it. "Validate all user input." "Use parameterised queries." "Ensure proper authorisation." Every sentence is true and none of them is about your code, so nothing in the report can be acted on, argued with, or closed.
It usually comes from a prompt that asked for security issues in general. The fix is structural rather than emphatic: require the attacker-controlled input, require the line, and require the impact. A reviewer that has to fill in those fields is more likely to find a real path, and having nothing to say about a clean diff is a correct answer.
A second failure is silence that reads as safety. The review finds nothing and you take that as a clean bill. It is not: a diff review sees only the code in the diff, and the most common serious problems in a change — a missing check in a caller that was not touched, a permission that was widened in configuration, a dependency with a new advisory — are outside it. The next-areas list exists to make that boundary visible.
Make it a one-word command
Claude Code ships /security-review, which analyzes the changes on your current branch for security vulnerabilities, reviewing the diff between your branch and origin's default branch for risks such as injection, auth issues and data exposure. It needs an origin remote; if it fails with an ambiguous argument error, that is the missing remote, and Anthropic's error reference covers that case.
Use it first. Write your own prompt when you know which boundary matters — auth, file paths, a new upload route — and want the review aimed at that rather than at everything the diff touches.
Or save this prompt as one: a SKILL.md at .claude/skills/security-reviewer/SKILL.md, with a name and a description in YAML frontmatter, runs as /security-reviewer and its body loads only when it runs, so the checklist costs almost nothing on the tasks that do not need it. Your own checks — the auth helper everyone must use, the one place a query is allowed to be built — belong in the same file, added to the prompt above. The skills guide has the mechanics.
Worked examples of both reusable forms are here: skills examples and CLAUDE.md examples.
How this page was written
Everything here about /security-review, what a subagent can and cannot touch, and what Anthropic recommends saying in a review prompt was read from Anthropic's Claude Code documentation on November 25, 2026, and checked against the wording in the Sources below.
The prompt is ours: an example written for this site, following the patterns Anthropic documents. It is not a prompt Anthropic publishes.
Sources
- Anthropic's Commands reference, for what
/security-reviewanalyzes, what it needs and how it fails without anoriginremote, read November 25, 2026. - Anthropic's Best practices for Claude Code, for the
skip styleline, what subagents cost, and the read-only reviewer, read November 25, 2026. - Anthropic's Create custom subagents, for the enforced tool limit and the note that a reviewer without Edit and Write can still write through Bash, read November 25, 2026.
- Anthropic's Prompt library, for giving Claude a way to check its work and for saying how you want the answer, read November 25, 2026.
- Anthropic's Extend Claude with skills, for where a skill lives and when its body loads, read November 25, 2026.
- Google's autocomplete suggestions for "claude code prompt for security review" and "claude code prompts for security", read November 25, 2026, for the queries this page answers.
Common questions
What is a good Claude Code prompt for a security review?
One that follows the data from what an attacker controls to where it lands, asks for the impact of each finding and the fix, records the paths that were checked and found safe, and keeps the reviewer from changing anything. The prompt in the first section is an example you can copy.
Does Claude Code have a built-in security review?
Yes, for a first pass. /security-review covers the diff against origin's default branch for injection, auth issues and data exposure. It does not know what your system considers sensitive, and it needs an origin remote — if the review fails with an ambiguous argument error, that is the missing remote, and Anthropic's error reference covers it.
Can a security review subagent change my code?
Only if it has a tool that can. Limiting it to Read, Grep, Glob is enforced by Claude Code, but a subagent that still has Bash can change files through it — so drop that too when the point is that it cannot write.
Is a Claude Code security review a replacement for a real audit?
No. It is a reading of the diff you give it, so it sees only what changed in front of it: a check in a caller nobody touched, a setting that lives outside the repository, an advisory against a dependency on the same version, an attacker who never touches your code at all. Treat it as a first pass that makes a human review cheaper, not as the review.
Why does the report have no findings?
Because the prompt asked for attacker-controlled input, a line, and an impact, and the diff had none. That is the right answer for a clean change. If you suspect otherwise, ask for the safe list — the paths that were followed and closed — to see what the review actually looked at.
One review per session. All of them on one board.
A security review prompt runs inside one Claude Code session. Omniscio is the level above: a desktop app for running Claude Code and other coding agents side by side, with one list of sessions and one inbox, so an agent only interrupts you when a decision needs you.
The features page lists what is in it today, pricing covers the plans, and you can download it for Windows, macOS or Linux.