# Semgrep rule author

> Semgrep rule author is an open-source agent skill for security. Builds Semgrep detectors that find sibling instances of a confirmed defect pattern. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/mtarcure/claude-vibe-squad/tree/main/.agents/skills/semgrep-rule-author
- **Repository:** https://github.com/mtarcure/claude-vibe-squad
- **GitHub stars:** 227
- **License:** MIT
- **Skill name:** semgrep-rule-author
- **Collection:** https://github.com/mtarcure/claude-vibe-squad
- **Categories:** [security](https://ai-powered.com/categories/security), [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-02

## About

This skill guides an agent through turning a bug that has already been confirmed into a reusable Semgrep rule. It starts from a minimal vulnerable snippet and a minimal safe snippet, then picks a rule shape: a syntactic pattern for a fixed misuse, pattern-inside and pattern-not for context-dependent cases, or taint mode with sources and sinks for data-flow defects such as injection.

The workflow stresses precision. It has the agent exclude sanitizers and safe wrappers the codebase actually uses, bind attacker-controlled values with metavariables, and write a message that explains the consequence and the fix. The rule is then tested against known vulnerable and safe fixtures and run over the whole repository, with the false-positive rate measured and recorded.

The skill expects a Semgrep installation and a confirmed example of the defect to work from. It also tags each rule with the defect class it came from so that the companion variant-analysis skill can reuse it.

## When your agent uses it

> Use after a defect pattern is confirmed and you need a reusable Semgrep detector for sibling instances: derive syntactic or taint rules from vulnerable and safe fixtures, encode project sanitizers, and measure repository-wide false positives. Not for choosing generic rulesets or scanning only a change.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/mtarcure/claude-vibe-squad/tree/HEAD/.agents/skills/semgrep-rule-author)
- [License: MIT](https://github.com/mtarcure/claude-vibe-squad/tree/HEAD/.agents/skills/semgrep-rule-author)

## Features

- **Rule shape selection:** Guides choosing between syntactic patterns, context-constrained patterns and taint mode based on the defect.
- **Fixture-based testing:** Requires known vulnerable instances to match and known safe snippets to stay unflagged.
- **Project sanitizer exclusion:** Adds pattern-not clauses for the sanitizers and safe wrappers used in the codebase.
- **Repository false-positive measurement:** Runs the rule across the full repo and records the false-positive rate before shipping.
- **Actionable rule messages:** Asks for messages that name the consequence of the defect and the recommended fix.
- **Provenance versioning:** Tags rules with the defect class they originated from for reuse and review.

## Good for

- Write a Semgrep rule that finds other places where a confirmed SQL injection pattern appears
- Build a taint-mode rule tracking user input to a dangerous sink in this codebase
- Reduce false positives in an existing Semgrep rule by excluding project sanitizers
- Measure how many hits a new Semgrep detector produces across the whole repository

## Install

### Claude Code

Copy the skill folder to `~/.claude/skills/semgrep-rule-author` to use it in all your projects:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/mtarcure/claude-vibe-squad.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/semgrep-rule-author &&
cp -R "$tmp/.agents/skills/semgrep-rule-author" ~/.claude/skills/semgrep-rule-author &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/semgrep-rule-author` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/semgrep-rule-author` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/mtarcure/claude-vibe-squad.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/semgrep-rule-author &&
cp -R "$tmp/.agents/skills/semgrep-rule-author" ~/.agents/skills/semgrep-rule-author &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/semgrep-rule-author` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/semgrep-rule-author` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/mtarcure/claude-vibe-squad.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/semgrep-rule-author &&
cp -R "$tmp/.agents/skills/semgrep-rule-author" ~/.cursor/skills/semgrep-rule-author &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/semgrep-rule-author` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/mtarcure/claude-vibe-squad.git --path .agents/skills/semgrep-rule-author
```

Or copy the folder to `~/.gemini/skills/semgrep-rule-author` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/semgrep-rule-author`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/mtarcure/claude-vibe-squad.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/semgrep-rule-author &&
cp -R "$tmp/.agents/skills/semgrep-rule-author" ~/.copilot/skills/semgrep-rule-author &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/semgrep-rule-author` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/mtarcure/claude-vibe-squad.git
```

Then copy `claude-vibe-squad/.agents/skills/semgrep-rule-author` into your agent's skills folder as `semgrep-rule-author`. Agents that support SKILL.md read one folder per skill.

## FAQ

### When should Semgrep rule author be used?

After a defect pattern has been confirmed and you need a reusable Semgrep detector for similar instances. It is not meant for choosing generic rulesets or for scanning only a change.

### What inputs does Semgrep rule author need?

It needs a confirmed instance of the defect, plus a minimal vulnerable snippet and a minimal safe snippet to test against.

### Does Semgrep rule author run any scripts?

No scripts are included in the skill folder. It is a single SKILL.md with instructions.

### Does Semgrep rule author set any tool restrictions?

No allowed tools are set in the skill's frontmatter.

### How do I install Semgrep rule author in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/semgrep-rule-author to use it in all your projects, or to .claude/skills/semgrep-rule-author in one project.

### Does Semgrep rule author run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Semgrep rule author?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Semgrep rule author?

The closest alternatives to Semgrep rule author are Semgrep rule creator, Diff aware semgrep scan, Semgrep rule variant creator, Variant analysis and Detection as code.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Semgrep rule creator](https://ai-powered.com/skills/semgrep-rule-creator): Semgrep rule creator is an open-source agent skill for security.
- [Diff aware semgrep scan](https://ai-powered.com/skills/diff-aware-semgrep-scan): Diff aware semgrep scan is an open-source agent skill for security.
- [Semgrep rule variant creator](https://ai-powered.com/skills/semgrep-rule-variant-creator): Semgrep rule variant creator is an open-source agent skill for security.
- [Variant analysis](https://ai-powered.com/skills/variant-analysis-mtarcure): Variant analysis is an open-source agent skill for security.
- [Detection as code](https://ai-powered.com/skills/detection-as-code): Detection as code is an open-source agent skill for security.
- [Semgrep](https://ai-powered.com/skills/semgrep): Semgrep is an open-source agent skill for security.
- [Variant analysis](https://ai-powered.com/skills/variant-analysis): Variant analysis is an open-source agent skill for security.
- [Security review](https://ai-powered.com/skills/security-review-getsentry): Security review is an open-source agent skill for security.

---
Source: https://ai-powered.com/skills/semgrep-rule-author
