Scan your codebase for vulnerabilities with Claude Code
Scan your codebase for security vulnerabilities with the Claude Security plugin in Claude Code, then turn findings into patches you review, in 40 minutes.

What you need
Step 1: Install the Claude Security plugin
2 minThe plugin runs a deep, multi-agent scan inside your own Claude Code session, with no extra key to set up.
- In your project folder, run
claude. - At the prompt, run the command below.
- Pick an install scope on the details screen. If the summary says to, run
/reload-plugins.
Run this in Claude Code/plugin install claude-security@claude-plugins-official
You should see an install summary for
claude-securitywith no error.It says the marketplace isn't found?
Run
/plugin marketplace add anthropics/claude-plugins-official, then run the install command again.- In your project folder, run
Step 2: Run a full scan
20 minA full scan maps your code, builds a threat model and hunts for flaws, then checks every finding before it reports.
- Run
/claude-securityand pick Scan codebase. - Pick the whole repository, or a focused area such as your API or login code. Each option shows its file count and cost.
- Confirm the run, and leave Claude Code open until it finishes.
You should see each stage reported as it starts, then a note that the report is written.
The menu opens with a Python warning?
Install Python 3.9 or newer, or put a newer
python3first on your PATH. Then start a new session.A scan can take a while and use a lot of tokens. It runs best in auto mode, so its agents don't stop for approval at each step.
- Run
Step 3: Read the report
5 minOnly findings that pass an independent check reach the report, so the list stays short and worth reading.
- Open the new
CLAUDE-SECURITY-<timestamp>folder in your repository. - Read
CLAUDE-SECURITY-RESULTS.md. Each finding has an ID such as F1, a severity, a confidence level and an exploit scenario. - Start with the most severe findings.
You should see a report of numbered findings, plus JSONL and SARIF copies of the same list.
A big repository came back with fewer findings than you expected?
Scan one area at a time, or ask for more depth, such as
/claude-security scan my API code at high. Scans vary, so a second run can find more.The folder has its own
.gitignore, so the report won't end up in a commit by accident.- Open the new
Step 4: Turn findings into patches
5 minA second agent reviews each patch and runs your tests when the project has them.
- Run
/claude-securityagain and pick Suggest patches. - Choose the findings you want fixed.
- Open the report's
patchesfolder and read eachF1.patchfile and the note beside it.
You should see one patch file per finding, or a short note on why a safe patch couldn't be written.
Some findings were skipped?
The code changed after the scan, so the report no longer matches it. Run a fresh scan, then ask for patches again.
- Run
Step 5: Apply patches one at a time
5 minNothing is applied for you, so each fix gets its own review and test run.
- Make a new branch for one finding.
- Apply its patch with the command below, using your report folder's name, then run your tests.
- Open a pull request for that fix, then repeat for the next finding.
Run thisgit apply CLAUDE-SECURITY-[TIMESTAMP]/patches/F1.patch
You should see the fix in your working tree, ready to commit.
If a patch has no tests behind it, its note says so. Review that one with extra care.
Step 6: Check each branch before you merge
3 minNew code brings new risks, and a quick pass on each branch catches them before they ship.
- Run
/security-reviewfor a single pass over your branch's changes. - For a deeper check, run
/claude-security scan my branch. - Fix what it finds, then merge.
You should see findings for the branch's changes only, or none.
/security-reviewfails with anambiguous argumenterror?Your clone has no
origin/HEAD. Rungit fetch origin, thengit remote set-head origin --auto, and run the review again.Anthropic's security review GitHub Action checks every pull request. Use it on trusted pull requests only. It needs an API key: keep it in a repository secret, never in the workflow file.
- Run
You get
A verified list of security findings for your codebase, with reviewed patches you apply one pull request at a time
Try next
Did this guide work for you?
Thanks. It helps us fix the steps.


