How to install Claude Code's security-guidance plugin and add your repo's own security rules
Install Anthropic's official security-guidance plugin in Claude Code and Claude reviews its own code changes for vulnerabilities while it works, then fixes them in the same session. There's no command to call. A pre-launch security checklist that passed 1,500 likes on X on October 16 also recommends this plugin as its last step.
- Install it in a terminal session. When asked for a scope, pick user.
/plugin install security-guidance@claude-plugins-official
If you see Marketplace "claude-plugins-official" not found, add the marketplace first and retry.
/plugin marketplace add anthropics/claude-plugins-official
-
Checks run at three points. On every file edit, a string match looks for risky patterns such as
eval(,pickle, and.innerHTML =(no model call). At the end of each turn, a separate Claude reviews that turn's git diff in the background, covering up to 30 changed files and firing at most three times in a row. When Claude runsgit commitorgit pushthrough Bash, a deeper review that reads surrounding code runs (capped at 20 per rolling hour). Turn and commit reviews only run inside a git repository, and commits you make from your own shell aren't reviewed. -
To turn it on in your teammates' local sessions, add it to the repo's
.claude/settings.json.
{
"enabledPlugins": {
"security-guidance@claude-plugins-official": true
}
}
- Write repo-specific rules in plain language in
.claude/claude-security-guidance.md. The model-backed reviews read it alongside the built-in checklist.
- All routes under /admin must call require_role("admin") before any database read.
- Do not log customer_id at INFO level or above.
You need Python 3.7 or later, and 3.10 or later for the agentic commit review. Turn and commit reviews spend extra usage, and both use Claude Opus 4.7 by default. Set SECURITY_REVIEW_MODEL for the end-of-turn review and SG_AGENTIC_MODEL for the commit review, or set ENABLE_CODE_SECURITY_REVIEW=0 to turn off all model-backed reviews. The plugin doesn't block writes or commits and can miss issues, so treat it as one layer of defense. It's available on all plans.
Sources
Get notified when a new tip lands
Tip alerts only go out in the app. Install it and turn notifications on.