semgrep
Skill by marduk191
Guides an AI assistant through running Semgrep, a static analysis tool, to scan code for security issues and pattern-based bugs. It also covers writing custom YAML rules, taint mode, and CI/CD setup.
Install semgrep
Built from the published package, never by AI.
git clone --depth 1 https://github.com/marduk191/qwen3_mcp /tmp/qwen3_mcp && mkdir -p ~/.claude/skills && cp -r /tmp/qwen3_mcp/skills/static-analysis/skills/semgrep ~/.claude/skills/semgrepRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/marduk191/qwen3_mcp /tmp/qwen3_mcp && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/qwen3_mcp/skills/static-analysis/skills/semgrep ~/.gemini/antigravity-cli/skills/semgrepAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
The semgrep skill teaches an AI assistant to run Semgrep for fast security scanning and pattern matching. It covers quick scans with auto-detected rules, named rulesets such as p/security-audit and p/owasp-top-ten, and output in SARIF or JSON. It also explains how to scan single files or directories and include test folders, which are excluded by default.
The skill includes guidance on writing custom YAML rules with pattern operators and taint mode, which tracks data from sources through propagators and sanitizers to sinks. It describes testing rules with semgrep --test, setting up a GitHub Actions workflow, and ignoring paths with .semgrepignore. The source says Semgrep suits quick, single-file checks and first-pass analysis, and that CodeQL is the better choice for interprocedural data flow. It is aimed at users who want fast first-pass scans.
Written from the project's SKILL.md and checked against it.
What it can do
- Quick scanRuns Semgrep with auto-detected rules on a project or directory.
- RulesetsApplies named registry rulesets such as p/security-audit, p/owasp-top-ten and p/cwe-top-25.
- Output formatsWrites results as SARIF or JSON, and can show data flow traces.
- Custom YAML rulesGuides writing rules with patterns, pattern operators and metavariables.
- Taint modeTracks untrusted data from sources to sinks through propagators and sanitizers.
- Rule testingTests rules with semgrep --test using ruleid and ok comments in test files.
- CI/CD integrationProvides a GitHub Actions workflow using semgrep ci with diff-aware scanning.
- Suppression and ignoresCovers nosemgrep comments and .semgrepignore for false positives and excluded paths.
What you need
- Python with pip, Homebrew, or Docker to install Semgrep
- GitHub Actions for the CI/CD workflow example
Try asking
- Scan this repo with the p/security-audit ruleset and summarize the findings.
- Write a Semgrep taint rule that tracks request.args into os.system.
- Set up a GitHub Actions workflow that runs semgrep ci on pull requests.
Good to know
- Pattern-based, so it may miss complex data flow across functions.
- Taint mode only works if sources, sinks and sanitizers are defined correctly.
- Not suited to binary analysis or compiled code without source.
- Test directories are excluded by default unless included with --include.
Security check
B- Allowed to use Bash without limitsIn
SKILL.md
Checked automatically: skills/static-analysis/skills/semgrep/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
Allowed tools: BashReadGlobGrep
Alternatives to semgrep
All alternatives →Retrieves lab biomarker results and clinician notes from Function Health through its FHIR API. It is for people who want an AI assistant to review their own lab history and notes.
Gives an AI assistant a methodology for finding and exploiting privilege escalation weaknesses on Windows systems during authorized penetration tests. It is for security testers and defenders validating escalation paths.
Guides the assistant through designing, debugging and hardening GitHub Actions CI/CD workflows. It is aimed at teams that run production pipelines on GitHub.
Develops evidence-backed structural security hardening proposals from disclosures, findings, source code, or Codex Security scans. It is for teams that need systemic fixes and architectural tradeoffs.
Claude Security scans code for security issues with Claude Code. It covers whole repositories, branch or pull request diffs, single commits, and existing findings from SARIF files or earlier reports.
Turns vulnerability notes, disclosure reports, PoCs, source code, or Codex Security findings into self-contained vulnerability reports. Built for security researchers who need claims the evidence supports.
Compare with function_health, windows-privilege-escalation or github-actions-advanced
semgrep: common questions
When should I use CodeQL instead of Semgrep?
The source suggests CodeQL for interprocedural taint tracking across files, complex data flow analysis, and custom proprietary frameworks. It recommends Semgrep for quick, single-file pattern checks.
Does Semgrep send telemetry about my code?
The source shows the --metrics=off flag to disable telemetry, and recommends it for proprietary code.
How do I check that my custom rules work?
The source says to write test files with ruleid and ok comments and run semgrep --test on the rules directory. Without tests, false negatives can go unnoticed.
How do I install semgrep?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is semgrep free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is semgrep safe to use?
It scores 55 of 100. Grades: maintenance D, licence A, quality C. Security check: grade B (allowed to use bash without limits). Review the code before you install. How grades work.
What are alternatives to semgrep?
Similar skills: function_health, windows-privilege-escalation, github-actions-advanced, propose-security-hardening.
