# Diff aware semgrep scan

> Diff aware semgrep scan is an open-source agent skill for security. Runs Semgrep only on a code change, surfacing new security findings against a baseline. 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/diff-aware-semgrep-scan
- **Repository:** https://github.com/mtarcure/claude-vibe-squad
- **GitHub stars:** 227
- **License:** MIT
- **Skill name:** diff-aware-semgrep-scan
- **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 a security review of one specific code change rather than a whole repository. It starts by fixing the base commit and listing the changed files along with their languages, then picks Semgrep rule packs according to the language and the kind of change, such as authentication, deserialization, templating, SQL, subprocess calls or cryptography.

The scan runs with a baseline commit so that pre-existing findings are suppressed and only newly introduced ones appear. When history matters, the agent can re-run without the baseline on the changed files, and it treats an old issue in a file the change now exposes to untrusted input as a new risk. Each hit is triaged for reachability from an untrusted source, attacker-controlled input and real consequence, and true positives are reported with a source-to-sink data path and a minimal fix.

The skill expects Semgrep and a git checkout with a base commit to compare against. It also asks the agent to list files skipped for parse errors or unsupported languages as coverage gaps, and to send recurring false positives to a separate rule-authoring skill rather than silencing them one by one.

## When your agent uses it

> Use when reviewing a particular code change against a large pre-existing Semgrep baseline: fix the base commit, choose rules by language and change shape, surface new or newly exposed source-to-sink paths, and report parse or coverage gaps. Route recurring false positives to semgrep-rule-author.

## 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/diff-aware-semgrep-scan)
- [License: MIT](https://github.com/mtarcure/claude-vibe-squad/tree/HEAD/.agents/skills/diff-aware-semgrep-scan)

## Features

- **Base commit diffing:** Fixes the comparison range and collects changed files with their language mix.
- **Change-aware rule selection:** Chooses Semgrep rule packs by language and by the shape of the change.
- **Baseline-suppressed scanning:** Runs Semgrep against a baseline so only newly introduced findings surface.
- **Source-to-sink triage:** Checks each hit for untrusted reachability and real consequence before reporting.
- **Coverage gap reporting:** Lists files skipped for parse errors or unsupported languages instead of treating them as passes.
- **False positive routing:** Sends recurring rule misfires to a separate rule-authoring workflow.

## Good for

- Review a pull request for new injection or auth issues against an existing codebase
- Scan only the files changed since a given commit with Semgrep
- Find newly exposed source-to-sink paths in a legacy project after a change
- Identify which changed files Semgrep could not parse
- Tune Semgrep rules that keep producing the same false positives

## Install

### Claude Code

Copy the skill folder to `~/.claude/skills/diff-aware-semgrep-scan` 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/diff-aware-semgrep-scan &&
cp -R "$tmp/.agents/skills/diff-aware-semgrep-scan" ~/.claude/skills/diff-aware-semgrep-scan &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/diff-aware-semgrep-scan` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/diff-aware-semgrep-scan` 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/diff-aware-semgrep-scan &&
cp -R "$tmp/.agents/skills/diff-aware-semgrep-scan" ~/.agents/skills/diff-aware-semgrep-scan &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/diff-aware-semgrep-scan` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/diff-aware-semgrep-scan` 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/diff-aware-semgrep-scan &&
cp -R "$tmp/.agents/skills/diff-aware-semgrep-scan" ~/.cursor/skills/diff-aware-semgrep-scan &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/diff-aware-semgrep-scan` 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/diff-aware-semgrep-scan
```

Or copy the folder to `~/.gemini/skills/diff-aware-semgrep-scan` yourself.

### VS Code

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

```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/diff-aware-semgrep-scan &&
cp -R "$tmp/.agents/skills/diff-aware-semgrep-scan" ~/.copilot/skills/diff-aware-semgrep-scan &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/diff-aware-semgrep-scan` 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/diff-aware-semgrep-scan` into your agent's skills folder as `diff-aware-semgrep-scan`. Agents that support SKILL.md read one folder per skill.

## FAQ

### What does the skill need to run?

It uses Semgrep and a git repository, and it needs a base commit to compare the current HEAD against.

### How does Diff aware semgrep scan avoid flooding me with old findings?

It runs Semgrep with a baseline commit so pre-existing findings are suppressed and only newly introduced ones are reported.

### What does Diff aware semgrep scan do with false positives?

It records why each rule misfired and routes repeat offenders to the semgrep-rule-author skill instead of silencing them per finding.

### Does Diff aware semgrep scan report files it could not scan?

Yes. Files skipped for parse errors or unsupported languages are listed as coverage gaps rather than passes.

### How do I install Diff aware semgrep scan in Claude Code?

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

### Does Diff aware semgrep scan 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 Diff aware semgrep scan?

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 Diff aware semgrep scan?

The closest alternatives to Diff aware semgrep scan are Semgrep rule author, Security review, Differential review, Security review and Variant analysis.

## Where this comes from

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

## Alternatives

- [Semgrep rule author](https://ai-powered.com/skills/semgrep-rule-author): Semgrep rule author is an open-source agent skill for security.
- [Security review](https://ai-powered.com/skills/security-review-ramboz): Security review is an open-source agent skill for security.
- [Differential review](https://ai-powered.com/skills/differential-review): Differential review is an open-source agent skill for security.
- [Security review](https://ai-powered.com/skills/security-review-nabwinsaud): Security review 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.
- [Source code scanning](https://ai-powered.com/skills/source-code-scanning): Source code scanning is an open-source agent skill for security.
- [Find bugs](https://ai-powered.com/skills/find-bugs): Find bugs is an open-source agent skill for security.
- [Semgrep](https://ai-powered.com/skills/semgrep): Semgrep is an open-source agent skill for security.

---
Source: https://ai-powered.com/skills/diff-aware-semgrep-scan
