strix/skills/tooling/semgrep.md
Official docs:
Canonical syntax:
semgrep scan [flags]
High-signal flags:
--config <rule_or_ruleset> ruleset, registry pack, local rule file, or directory--metrics=off disable telemetry and metrics reporting--json JSON output--sarif SARIF output--output <file> write findings to file--severity <level> filter by severity--error return non-zero exit when findings exist--quiet suppress progress noise--jobs <n> parallel workers--timeout <seconds> per-file timeout--exclude <pattern> exclude path pattern--include <pattern> include path pattern--exclude-rule <rule_id> suppress specific rule--baseline-commit <sha> only report findings introduced after baseline--pro enable Pro engine if available--oss-only force OSS engine onlyAgent-safe baseline for automation:
semgrep scan --config p/default --metrics=off --json --output semgrep.json --quiet --jobs 4 --timeout 20 /workspace
Common patterns:
semgrep scan --config p/default --metrics=off --json --output semgrep.json --quiet /workspacesemgrep scan --config p/default --severity ERROR --metrics=off --json --output semgrep_high.json --quiet /workspacesemgrep scan --config p/owasp-top-ten --metrics=off --sarif --output semgrep.sarif --quiet /workspacesemgrep scan --config p/python --config p/secrets --metrics=off --json --output semgrep_python.json --quiet /workspacesemgrep scan --config p/default --metrics=off --json --output semgrep_api.json --quiet /workspace/services/apisemgrep scan --config p/default --pro --metrics=off --json --output semgrep_pro.json --quiet /workspaceCritical correctness rules:
--metrics=off; Semgrep sends telemetry by default.--config; do not rely on vague or implied defaults.--json --output <file> or --sarif --output <file> for machine-readable downstream processing.. when possible.Usage rules:
p/default unless the task clearly calls for a narrower pack.p/secrets, p/python, or p/javascript only when they match the target stack.--quiet in automation to reduce noisy logs.--jobs and --timeout explicitly for reproducible runtime behavior.-h/--help for routine operation unless absolutely necessary.Failure recovery:
--timeout modestly or lower --jobs.--config, add --severity, or exclude known irrelevant paths.--oss-only or without --pro and note the loss of cross-file coverage.If uncertain, query web_search with:
site:semgrep.dev semgrep <flag> cli