Before you open a pull request, a second pair of eyes on the risky parts helps. Claude Code has a command for exactly that review.
/security-review
It looks at the diff between your current branch and the default branch on origin, so only your changes, not the whole codebase. Claude goes through them for issues like injection, broken authentication or authorisation, and data that ends up where it shouldn’t, and reports what it finds with an explanation.
Since it only sees the diff, it fits right before a pull request. Commit your work on a feature branch first, because the review compares branches.
It needs an origin remote. In a local-only repository, or one where origin/HEAD isn’t set, it fails with an “ambiguous argument” error. The Claude Code error reference has an entry for exactly that case, so look there before fiddling with git.
A clean result doesn’t mean the code is secure. It’s a review of the lines you changed, so a hole that comes from how your change interacts with old code elsewhere can be missed, and so can anything in config that isn’t in the diff. I see it as a useful checklist pass, not as a security audit.
Further reading: Commands: /security-review, Error reference