Documentation missing for `/security-review` slash command and its git dependency

Status Fixed / completed
Maintainer reply ✓ Yes — catherinewu
Activity 7 comments · opened Aug 6, 2025 · closed Nov 30, 2025
💡 Likely answer: A maintainer (catherinewu, contributor) responded on this thread — see the highlighted reply below.

Title: Documentation missing for /security-review slash command and its git dependency

Body:

Description

Hello Claude Code team,

I've discovered a built-in slash command, /security-review, which appears to be a very useful feature. However, it is not documented in the official Slash commands documentation.

Furthermore, this command has a hidden dependency: it only works if Claude Code is running inside a directory that is a git repository. If run in a non-git directory, it fails with a low-level git error.

This undocumented dependency can be confusing for users. I believe adding this command to the documentation, along with its prerequisites, would greatly improve the user experience.

Steps to Reproduce

Scenario 1: Command fails in a non-git repository

  1. Create and navigate to a new directory that is not a git repository.

``bash
mkdir test-project && cd test-project
``

  1. Start Claude Code.

``bash
claude
``

  1. Run the /security-review command.
  2. Observe the error: The command fails with a git error.

``
> /security-review
⎿ Error: Bash command failed for pattern "!
git status": [stderr]
fatal: not a git repository (or any of the parent directories): .git
``

Scenario 2: Command succeeds in a git repository

  1. Navigate to a directory that is an initialized git repository.

``bash
cd /path/to/my/git-repo
``

  1. Start Claude Code.

``bash
claude
``

  1. Run the /security-review command.
  2. Observe the success: The command executes as expected and begins analyzing code changes.

```
> /security-review is analyzing code changes for security risks…

⏺ I'll perform a security-focused code review of the changes...
```

Expected Behavior
  1. The /security-review command should be officially documented in the en/docs/claude-code/slash-commands.md file.
  2. The documentation should clearly state that the command must be run within a git repository.
  3. Ideally, if the command is run outside a git repository, it should return a user-friendly message (e.g., "Error: /security-review must be run inside a git repository.") instead of the raw fatal error.
Suggested Documentation Updates

Please update the documentation to include:

  • A description of what the /security-review command does.
  • Its requirement to be run inside a git repository.
  • The allowed-tools it needs (e.g., Bash(git status:*), Bash(git diff:*), etc.), as it appears to execute git commands under the hood.

Thank you for creating such a powerful tool

View original on GitHub ↗

7 Comments

github-actions[bot] · 1 year ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/5325
  2. https://github.com/anthropics/claude-code/issues/5068
  3. https://github.com/anthropics/claude-code/issues/2177

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

kirby88 · 1 year ago

Not sure if it should be a separate issue, but it also assume that origin/HEAD is set.

/security-review
  ⎿  Error: Bash command failed for pattern "!`git log --no-decorate origin/HEAD...`": [stderr]
     fatal: ambiguous argument 'origin/HEAD...': unknown revision or path not in the working tree.
     Use '--' to separate paths from revisions, like this:
     'git <command> [<revision>...] -- [<file>...]'

But after git remote set-head origin main it fixes the issue.

coygeek · 1 year ago

Title: Docs: Document the built-in /security-review slash command

Labels: documentation, bug

Body:

Description

The built-in slash command /security-review is not documented in the official Claude Code documentation. This command is available by default with a new installation of Claude Code but is not listed among the other built-in commands.

Currently, the only mention of /security-review is in the en/docs/claude-code/common-workflows.md file, where it is incorrectly presented as an example of how to create a custom personal slash command. This is misleading for two reasons:

  1. It implies the command does not exist by default and must be created by the user.
  2. It fails to describe the command's actual functionality and prerequisites.
Undocumented Behavior & Requirements

The built-in /security-review command has the following behavior that needs to be documented:

  • Purpose: It reviews the current code changes within a project for potential security vulnerabilities.
  • Prerequisite: It requires the current working directory to be an initialized Git repository. It likely operates on the output of git diff to identify changes to be reviewed.
  • Availability: It is a default command and does not need to be created by the user.
Impact
  • Users are unaware of a useful, built-in security feature.
  • The current documentation is confusing and may lead users to create a conflicting custom command.
  • Users who discover the command organically will not know its prerequisites (e.g., being in a Git repo) and may not understand why it fails to run.
Suggested Actions
  1. Update en/docs/claude-code/slash-commands.md: Add an entry for /security-review to the "Built-in slash commands" table, including its purpose and the Git repository prerequisite.
  2. Update en/docs/claude-code/common-workflows.md: The section "Create personal slash commands" should be updated to use a different command name as its example (e.g., /my-custom-review) to avoid confusion with the built-in command.
  3. Consider adding a new section to common-workflows.md that explicitly demonstrates how to use the built-in /security-review command effectively.
coygeek · 11 months ago

There are 2 websites where /security-review is now mentioned (but still missing from the official docs.anthropic.com website):

  1. Anthropic.com

Posted on August 06, 2025
https://www.anthropic.com/news/automate-security-reviews-with-claude-code

  1. Support.anthropic.com

Updated last week
https://support.anthropic.com/en/articles/11932705-automated-security-reviews-in-claude-code

Anthropic, please update your documentation page docs.anthropic.com with this important feature.

catherinewu contributor · 9 months ago

the /security-review command is now documented on https://code.claude.com/docs/en/slash-commands. thanks for reporting!

marcindulak · 9 months ago

@catherinewu - please reopen. The requirement of git remote set-head origin main, mentioned in https://github.com/anthropics/claude-code/issues/5268#issuecomment-3189985146, and still needed for Claude Code v2.0.55, is not documented at https://code.claude.com/docs/en/slash-commands

github-actions[bot] · 8 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.