Claude Code Security Review: Run /security-review Before a Client Build Ships

David IyaDavid Iya October 4, 2026 9 min read
A sturdy brass padlock resting on a closed laptop beside a magnifying glass and a short printed checklist, in warm late-afternoon desk light
Original image, Claude Code Club

What Claude Code security review is

Claude Code security review is a built-in command, /security-review, that analyzes the changes on your current branch for security vulnerabilities. It looks at the difference between your branch and your origin remote's default branch, then reports risks such as injection, authentication and authorization problems, and data exposure. You run it on demand, once, when the work is ready. It is not a background scanner and it does not touch your deployed app.

I treat it as the security half of the final check before anything goes to a client. Claude Code code review catches correctness bugs. /security-review asks a different question: if someone hostile used this, what could they get? Those are different reviews, and on client work I want both.

How to run /security-review in the desktop app

  1. Finish the feature on its own branch. The review compares your branch with the default branch on your origin remote, so the work you want checked needs to be on a branch, not committed straight to main. Use Claude Code with Git covers the branch habit if it is new to you.
  2. Make sure the project has an origin remote and that you have fetched from it recently. The review needs that remote to know what "before" looks like.
  3. In the desktop app, type / in the prompt box (or click the + button and choose Slash commands) and pick security-review. You can send it on its own; it already knows to look at the branch diff.
  4. Read the findings. Each one should name the file, the risk and why it matters. Ask Claude to explain any finding you do not understand in plain words before you touch it.
  5. Fix what is real, one finding at a time, then run the review again on the updated branch. Stop when it comes back clean or when what remains is a decision you have made on purpose and written down.

The terminal works the same way: type /security-review in a session. The desktop app is just where I run it, because I can keep the findings open next to the diff view and work through them in order.

What it covers, and what it does not

The most common mistake with this command is assuming it reviewed more than it did. It reads the changes on your branch. It does not audit the code that was already on main, it does not test the running site, and it does not check your hosting settings, your database rules or your API key dashboard.

Where /security-review sits among Claude Code's security layers

LayerWhen it runsWhat it covers
Security guidance pluginAutomatically, while Claude writes codeCommon vulnerabilities in code Claude is writing, fixed in the same session
/security-reviewWhen you ask, onceThe changes on your current branch versus origin's default branch
Claude Security pluginWhen you ask, deep scanA multi-agent scan of a repository or diff, with reviewed findings and patches
Code Review on pull requestsOn every PR (Team and Enterprise plans)Correctness and security review with full codebase context
Your CI scannersOn every pushLanguage-specific rules and dependency checks

To check code that already exists rather than new changes, ask Claude in a session to review a specific file or folder for vulnerabilities. For anything that is live, the review only ever sees source code in your checkout, so settings that live in a dashboard are still yours to check by hand.

When I run it

  • Before merging anything that touches login, sign-up, passwords or user roles. Add authentication with Claude Code covers building those pieces; this is the check after.
  • Before shipping any form, upload or search box that takes input from strangers. Input from outside is where injection risks live.
  • Before deploying anything that holds a paid API key. A key on the server is not safe if the endpoint around it has no authentication, no rate limit and an open origin policy. Our free guide on keeping API keys safe with Claude Code covers the setup side.
  • Before handing a client build over. It goes into the same pre-flight list as reviewing Claude Code output before you ship.

Fixing the "ambiguous argument 'origin/HEAD'" error

If /security-review stops straight away with an error mentioning origin/HEAD and "unknown revision or path not in the working tree", the command could not find your remote's default branch. It builds its context by diffing against a local ref called origin/HEAD, and some setups never create it: single-branch or CI checkouts, a repository with no origin remote, or one you never fetched.

  1. Run git fetch origin, then git remote set-head origin --auto. That asks the remote which branch is its default and records it.
  2. If that fails, name the branch yourself: git remote set-head origin main (use your real default branch name).
  3. If the project has no remote at all, add one with git remote add origin followed by the repository URL, fetch, then set the head.
  4. Run /security-review again.

You can also just ask Claude in the desktop app to run those commands for you and explain each one. Claude Code permissions explained covers how to approve them without opening the floodgates.

How to act on the findings without breaking the build

Do not paste the whole findings list back and say "fix all of this". That produces one large change that is hard to check. Take the findings one at a time, highest risk first. For each: ask Claude to restate the risk in one sentence, ask what the smallest fix is, apply it, and run the app to confirm nothing else broke. Commit after each fix so you can roll back a single change if needed.

Some findings will be about risk you accepted on purpose, such as an internal tool that only runs on a private network. Write that down in your project notes or CLAUDE.md so the next review and the next person understand the decision. If you are handing the project to a client, the same note belongs in the handover. How to hand off a Claude Code project covers what to include.

Free Claude Code drops, straight to your inbox

Short, practical drops on skills, MCP, agents, prompts, and more. No spam, unsubscribe anytime.

Frequently asked questions

What does /security-review do in Claude Code?

It analyzes the changes on your current branch for security vulnerabilities. It reviews the difference between your branch and your origin remote's default branch and reports risks such as injection, authentication problems and data exposure.

Does /security-review work in the Claude Code desktop app?

Yes. Type / in the prompt box, or click the + button and choose Slash commands, then pick security-review. Built-in commands are available in the desktop app as well as the terminal.

Does Claude Code security review scan my whole codebase?

No. It reviews only the changes on your current branch compared with origin's default branch. To check existing code, ask Claude to review a specific file or folder for vulnerabilities, or use a deeper scanning tool across the repository.

Why does /security-review say ambiguous argument origin/HEAD?

Your clone is missing the origin/HEAD ref that records the remote's default branch. Run git fetch origin and then git remote set-head origin --auto, or name the branch directly with git remote set-head origin main, then run the review again.

Is /security-review enough before shipping client work?

It is a strong filter, not a guarantee. Pair it with a correctness review, test the running app yourself, and check settings that live outside the code, such as hosting, database rules and API key limits.

Last reviewed by David Iya on October 4, 2026

David Iya

Written by

David Iya

Forbes 30 Under 30 · Y Combinator

Keep reading

AgencyClaude Code

How to Demo a Claude Code Build to a Client (Show the Outcome, Not the Code)

To demo a Claude Code build to a client, show them one job done start to finish on their own data, on a link that is already live, and then ask for the next step before the call ends. Do not show the code, the prompts or the terminal. Here is the demo structure, the prep checklist, and what to do when something breaks on screen.

David Iya 9 min
Read article
Claude CodeWorkflows

Claude Code Goal Command: How /goal Keeps Claude Working Until the Job Is Actually Done

The Claude Code goal command is /goal followed by a condition, such as all tests in test/auth pass. Claude keeps taking turns until a separate small model confirms the condition is met, judges it impossible, or an error you have to fix clears it. Here is how to set one in the desktop app, how to write a condition the evaluator can judge, how /goal differs from /loop, auto mode and a Stop hook, and what stops or pauses a goal.

David Iya 8 min
Read article

Ready to build it yourself?

Join Claude Code Club, the #1 community for learning claude code, for $9/month.

← Back to the blog