security-scan · alirezarezvani — Claude Code command: what it does, how to install
The security-scan command scans code for leaked secrets via gitleaks, checks Python dependencies with safety, and dispatches a GitHub Actions audit.
MIT ★ 907 updated 2025-11-12
.claude/commands/security-scan.mdWhat security-scan does
The command automates a two-step security verification before code gets pushed or merged. First, it triggers gitleaks detect --verbose --redact to uncover exposed API keys and passwords. If the project contains any requirements*.txt files, it iterates through them and generates vulnerability reports via safety check --full-report.
Next, it triggers remote CI checks by executing gh workflow run security-audit.yml against the active Git branch and watches job progress with gh run watch.
The workflow relies on external binaries: gitleaks, safety==3.2.4, an authenticated gh CLI, plus an existing security-audit.yml file in your repository. Missing any of these tools causes the check to fail.
What it helps with
- detect unredacted secrets and credentials before committing
- audit Python package dependencies for known vulnerabilities
- trigger and monitor remote security workflows via GitHub CLI
- verify local and remote audit status before merging branches
Example prompts for the agent
- /security-scan
- Run local security checks and trigger the audit workflow
- Scan this repository for leaked secrets and audit requirements files
How to install security-scan
Manually: put the files in place
.claude/commands/security-scan.mdCall it with /security-scan. For all projects use ~/.claude/commands/
Manually: put the files in place
~/.codex/prompts/security-scan.mdCall it with /prompts:security-scan. Codex marks this format deprecated in favour of skills
Manually: put the files in place
.github/prompts/security-scan.prompt.mdManually: put the files in place
.gemini/commands/security-scan.tomlGemini stores commands as TOML: the prompt text goes into the prompt field
Questions about security-scan
How to install security-scan in Claude Code?
Add the command file to your repository at .claude/commands/security-scan.md.
What does the security-scan command do?
It scans repository files for exposed secrets with gitleaks, checks requirements*.txt dependencies with safety, and runs the security-audit.yml GitHub workflow.
What dependencies are required for security-scan?
You need gitleaks, Python package safety==3.2.4, the GitHub CLI (gh), and a configured security-audit.yml action in your repository.
Source text
security-scan.md · MIT
---
description: Perform local security scanning and dispatch the security audit workflow.
---
## Local Scan
1. Install tooling (first run): `pip install safety==3.2.4` and `brew install gitleaks` (or `go install github.com/zricethezav/gitleaks/v8@latest`).
2. Detect secrets: `gitleaks detect --verbose --redact`
3. Dependency audit (if `requirements*.txt` exists):
```bash
for f in $(ls **/requirements*.txt 2>/dev/null); do
safety check --full-report --file "$f"
done
```
4. Document results in the commit template.
## Trigger Remote Audit
```bash
gh workflow run security-audit.yml --ref $(git branch --show-current)
gh run watch --workflow "Security Audit (Claude)"
```
## Completion
- Ensure both local and remote scans are clean before pushing or merging.
© alirezarezvani · MIT · alirezarezvani/claude-code-skill-factory
Similar slash commands
All slash commands for Security →security-scan by other authors comes first.