Text of code.claude.com › docs › en › security-guidance as Styx crawled it on Nov 20, 2026. The page may have changed since. Only its words are kept, without pictures or layout, and only the first part of a long page.

Open the live page

Catch security issues as Claude writes code - Claude Code Docs

Documentation Index Fetch the complete documentation index at: /docs/llms.txt Use this file to discover all available pages before exploring further. Skip to main content Assistant Responses are generated using AI and may contain mistakes. The security guidance plugin makes Claude review its own code changes for common vulnerabilities while it works and fix what it finds in the same session. The plugin catches issues such as injection, unsafe deserialization, and unsafe DOM APIs before the code reaches a pull request, reducing how much security review falls to human reviewers downstream.

Once installed, the plugin runs automatically. There is nothing to invoke and no separate command to remember. The plugin is the in-session companion to Code Review , which runs on pull requests. This plugin reduces what reaches the PR. Code Review catches what does. For how the plugin layers with on-demand review and CI scanning, or to scan code you already have rather than changes Claude is writing, see How this fits with other security tools .

Prerequisites Python 3.7 or later on your PATH . The agentic commit review needs Python 3.10 or later, as do all model-backed reviews when Claude Code uses a third-party provider such as Amazon Bedrock or Google Cloud’s Agent Platform. The plugin prefers the versioned interpreters python3.13 through python3.10 , then falls back to python3 , python , and py -3 A git repository for the directory you work in. The end-of-turn and commit reviews diff against git state and skip silently outside a repository.

The per-edit pattern check works anywhere On first run the plugin creates a virtual environment under ~/.claude/security/ and installs the Claude Agent SDK into it, which requires pip and network access. If that install fails, or the available Python is older than 3.10, the commit review on first-party authentication falls back to a single-shot review instead of the agentic one; on a third-party provider such as Amazon Bedrock or Google Cloud’s Agent Platform the model-backed reviews need the SDK themselves, so they skip.

The plugin shows a one-time notice when an older Python is the cause. Install the plugin In a terminal Claude Code session, install from the official Anthropic marketplace : /plugin install security-guidance@claude-plugins-official /plugin opens an interactive panel in the terminal CLI. If Claude replies that /plugin isn’t available in this environment, install another way: Claude desktop app, local or SSH session : use the Desktop app tab under Install a plugin VS Code extension : install from the Manage plugins dialog Cloud sessions : a cloud session doesn’t load plugins from your user settings or from the repository’s .claude/settings.json , as What carries over from your setup explains.

For plugins your organization distributes through managed settings, see Manage plugins for your organization The terminal install prompts for a scope. Choose user scope to write the plugin to your user settings, so it loads in every new local session you start on this machine. If the install fails, match the message Claude Code reports: Marketplace "claude-plugins-official" not found : add the marketplace with /plugin marketplace add anthropics/claude-plugins-official , then retry the install.

Plugin "<name>" not found in marketplace "claude-plugins-official" : your local copy of the marketplace catalog may be out of date. Refresh it with /plugin marketplace update claude-plugins-official , then retry the install. If the retry prints the same message, see Plugin not found in marketplace . Check the install summary. If it reports Run /reload-plugins to apply. , see Apply plugin changes without restarting to activate the plugin in your current session.

Enable for your team in local sessions To turn the plugin on in the local sessions your teammates start in the repository, declare it in the project’s checked-in settings: .claude/settings.json { "enabledPlugins" : { "security-guidance@claude-plugins-official" : true } } Each teammate also runs claude plugin install security-guidance@claude-plugins-official --scope project once per clone. Administrators can enable the plugin organization-wide by setting enabledPlugins in managed settings .

What the plugin checks The plugin reviews Claude’s work at three points, each at a different depth: On each file edit : a fast pattern match for risky calls, with no model call At the end of each turn : a background model review of everything that turn changed On each commit or push Claude makes : a deeper agentic review that reads surrounding code You can extend each layer by adding your own rules . Built-in checks cannot be removed individually, but you can disable each layer independently.

Checks on each file edit When Claude writes to a file, the plugin scans the new content for known risky patterns. This is a pattern match with no model call, so it adds no usage cost. Example pattern categories: Dynamic code execution: eval( , new Function , os.system , child_process.exec Unsafe deserialization: pickle DOM injection: dangerouslySetInnerHTML , .innerHTML = , document.write Workflow files: edits under .github/workflows/ , which can grant repository-level permissions The check runs after the edit lands and appends the warning to Claude’s context for the next step.

Each warning fires once per pattern per file per session, so repeat matches in the same file do not flood the conversation. You can add your own patterns to this layer with a security-patterns.yaml file. Checks at the end of each turn A turn is one round of Claude responding: you send a message, Claude works and replies, and the turn ends. After each turn, the plugin computes a git diff of everything that changed in the working tree during the turn, including changes from Claude’s edit tools, Bash commands, and subagents, and sends it to a separate Claude review focused on security.

The review runs in the background, so Claude’s reply is not delayed. If the review finds issues, Claude is re-prompted with the findings and addresses them as a follow-up. This catches issues a string match cannot, such as: Authorization bypass Insecure direct object references Injection Server-side request forgery Weak cryptography You see both the finding and Claude’s resolution directly in your session. The review covers up to 30 changed files per turn and fires at most three times in a row before yielding back to you.

Checks on each commit or push Claude makes When Claude runs git commit or git push through its Bash tool, the plugin runs a deeper agentic review of the change in the background. This review reads surrounding code, including callers, sanitizers, and related files, to decide whether a finding is real before reporting it. The extra context keeps false positives low on patterns that look dangerous in isolation but are safe in your codebase.

This layer fires only on commits and pushes Claude makes through its Bash tool. Commits you run from your own shell, including the ! shell escape inside a session, are not reviewed. Commit and push reviews are capped at 20 per rolling hour. If the commit review’s findings duplicate what the end-of-turn review already reported, Claude is not re-prompted, so a clean commit produces no visible output from this layer. Review independence and limits The plugin does not ask the same Claude instance that wrote the code to grade itself.

The per-edit check is a deterministic string match with no model involved. The end-of-turn and commit reviews run as a separate Claude call with a fresh context and a security-focused prompt: the reviewer starts from the diff, has no investment in the original approach, and is instructed only to find problems. None of the layers block writes or commits. Findings reach the writing Claude as instructions, Claude addresses them in the conversation, and the review model can miss issues.

Treat the plugin as one layer of defense in depth, not a complete se

The rest of this page is on the live site.