From auto-claude-skills
Run Semgrep SAST and Trivy vulnerability scanning during code review with self-healing fix loop
npx claudepluginhub damianpapadopoulos/auto-claude-skillsThis skill uses the workspace's default tool permissions.
Hybrid deterministic scanning: CLI tools find vulnerabilities, you fix them.
Generates design tokens/docs from CSS/Tailwind/styled-components codebases, audits visual consistency across 10 dimensions, detects AI slop in UI.
Records polished WebM UI demo videos of web apps using Playwright with cursor overlay, natural pacing, and three-phase scripting. Activates for demo, walkthrough, screen recording, or tutorial requests.
Delivers idiomatic Kotlin patterns for null safety, immutability, sealed classes, coroutines, Flows, extensions, DSL builders, and Gradle DSL. Use when writing, reviewing, refactoring, or designing Kotlin code.
Hybrid deterministic scanning: CLI tools find vulnerabilities, you fix them.
During REVIEW phase, after code changes are complete. Also invocable on explicit security requests.
Run these checks via Bash to determine what's available:
command -v semgrep && echo "semgrep: available" || echo "semgrep: not installed"
command -v trivy && echo "trivy: available" || echo "trivy: not installed"
command -v gitleaks && echo "gitleaks: available" || echo "gitleaks: not installed"
If neither semgrep nor trivy is installed, fall back to LLM-only code review and recommend installation:
brew install semgrep or pip install semgrepbrew install trivybrew install gitleaksIf semgrep is available, scan for code vulnerabilities.
Fast scan (changed files in current branch — prefer this for inner-loop reviews):
git diff --name-only -z "$(git merge-base HEAD main)..HEAD" | xargs -0 semgrep scan --json --config auto --severity WARNING 2>/dev/null | jq '{count: (.results | length), results: [.results[] | {rule: .check_id, severity: .extra.severity, file: .path, line: .start.line, message: .extra.message}]}'
Note: If merge-base fails (no main branch), fall back to git diff --name-only -z HEAD~1 | xargs -0 ... for the last commit only.
Full project scan (use for thorough reviews or when explicitly asked):
semgrep scan --json --config auto --severity WARNING . 2>/dev/null | jq '{count: (.results | length), results: [.results[] | {rule: .check_id, severity: .extra.severity, file: .path, line: .start.line, message: .extra.message}]}'
If output is large (count > 20), filter by severity first:
semgrep scan --json --config auto --severity ERROR . 2>/dev/null | jq '.results[:20]'
If trivy is available, scan for vulnerable dependencies and IaC misconfigurations.
Dependency scan:
trivy fs --scanners vuln,misconfig --format json --severity HIGH,CRITICAL --ignore-unfixed . 2>/dev/null | jq '{count: (.Results // [] | map(.Vulnerabilities // [] | length) | add // 0), results: [.Results // [] | .[].Vulnerabilities // [] | .[] | {pkg: .PkgName, installed: .InstalledVersion, fixed: .FixedVersion, severity: .Severity, cve: .VulnerabilityID, title: .Title}]}'
If Dockerfile exists, also scan the image config:
trivy config --format json --severity HIGH,CRITICAL . 2>/dev/null | jq '.Results // []'
If gitleaks is available, scan for hardcoded secrets.
gitleaks detect --source . --no-banner --report-format json 2>/dev/null | jq '{count: (. | length), results: [.[] | {rule: .RuleID, file: .File, line: .StartLine, description: .Description}]}'
Present findings as a structured table:
## Security Scan Results
### Semgrep (SAST) — N findings
| Severity | File | Line | Rule | Message |
|----------|------|------|------|---------|
### Trivy (Dependencies) — N vulnerabilities
| Severity | Package | Installed | Fixed | CVE | Title |
|----------|---------|-----------|-------|-----|-------|
### Gitleaks (Secrets) — N findings
| Rule | File | Line | Description |
|------|------|------|-------------|
Fix priority: CRITICAL > HIGH > ERROR > WARNING
For each fixable finding:
Max 3 fix-rescan iterations to prevent infinite loops.
After fixing, present a final summary:
If false positives are found, help the user configure:
.semgrepignore for Semgrep exclusions.trivyignore for Trivy exclusions.gitleaksignore for Gitleaks exclusions