Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

semgrep-rule-creator

Skill by CraftOS-dev

Creates custom Semgrep rules for detecting security vulnerabilities, bug patterns and code patterns. Aimed at developers and security engineers who write their own static analysis detections.

  • Score 70
  • 432 stars
  • MIT
  • Updated
Works withClaude CodeClaude apps Antigravity CLI

Install semgrep-rule-creator

Built from the published package, never by AI.

git clone --depth 1 https://github.com/CraftOS-dev/CraftBot /tmp/CraftBot && mkdir -p ~/.claude/skills && cp -r /tmp/CraftBot/skills/semgrep-rule-creator ~/.claude/skills/semgrep-rule-creator

Run in your terminal. Claude Code loads skills from ~/.claude/skills automatically.

Step-by-step: install semgrep-rule-creator in Claude Code

Skills can run scripts on your machine. Some need an API key: check the README.

About

Semgrep Rule Creator is an agent skill that guides an AI assistant through writing custom Semgrep rules for security vulnerabilities, bug patterns and code patterns. It follows a fixed workflow: analyze the problem, write tests first, inspect the AST, write the rule, then iterate until all tests pass. The skill prefers taint mode for data flow issues where untrusted input reaches a dangerous sink, and falls back to pattern matching when that works better.

Each rule is saved in a directory named after its rule ID, with one YAML file for the rule and one test file with ruleid and ok annotations. The skill tells the assistant to read seven Semgrep and Trail of Bits documentation pages before writing rules. It is aimed at developers and security engineers who write their own Semgrep detections. It does not run existing Semgrep rulesets.

Written from the project's SKILL.md and checked against it.

What it can do

  • Test-first rule writingRequires test files with ruleid and ok cases before a rule is written.
  • Taint mode rulesBuilds data flow rules that track untrusted input to dangerous sinks.
  • Pattern matching rulesWrites simple syntactic Semgrep patterns when no data flow is needed.
  • AST analysis stepInspects the AST so patterns match syntactic variations of the code.
  • Test run loopRuns semgrep --test and iterates until all tests pass.
  • Two-file rule outputCreates a rule directory with one YAML rule file and one test file.
  • Documentation lookupReads Semgrep and Trail of Bits testing handbook pages before writing rules.

What you need

  • Semgrep CLI

Try asking

  • Write a Semgrep taint rule for user input reaching eval in Python
  • Create a Semgrep rule that flags os.system calls built from user input
  • Write a Semgrep rule with ruleid and ok test cases for a SQL injection sink

Good to know

  • Does not run existing Semgrep rulesets; use the static-analysis skill for general analysis
  • Each YAML file must contain only one rule
  • Generic language rules and todoruleid or todook test annotations are not allowed

Security check

A

No download-and-run commands, hidden instructions or signs of sending keys out were found.

Checked automatically: skills/semgrep-rule-creator/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work

Inside the skill

Allowed tools: Bash Read Write Edit Glob Grep WebFetch

Alternatives to semgrep-rule-creator

All alternatives →

Compare with function_health, windows-privilege-escalation or github-actions-advanced

semgrep-rule-creator: common questions

What does semgrep-rule-creator produce?

It produces a rule directory named after the rule ID, containing a Semgrep YAML rule and a test file with ruleid and ok annotations.

Does it prefer taint mode or pattern matching?

The source says taint mode is prioritized for data flow vulnerabilities, with pattern matching used for simple syntactic patterns or when taint works poorly.

Can it be used to run Semgrep scans?

No. The source says the skill is not for running existing Semgrep rulesets.

How do I install semgrep-rule-creator?

Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.

Is semgrep-rule-creator free?

The code is published under the MIT licence. The service it connects to may have its own pricing.

Is semgrep-rule-creator safe to use?

It scores 70 of 100. Grades: maintenance A, licence A, quality B. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.

What are alternatives to semgrep-rule-creator?

Similar skills: function_health, windows-privilege-escalation, github-actions-advanced, propose-security-hardening.

semgrep-rule-creator Install

Add to stack

Loading.