# Variant analysis

> Variant analysis is an open-source agent skill for security. Sweeps a codebase for siblings of a confirmed defect and proposes one root-cause fix. 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/variant-analysis
- **Repository:** https://github.com/mtarcure/claude-vibe-squad
- **GitHub stars:** 227
- **License:** MIT
- **Skill name:** variant-analysis
- **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 hunting for structurally related copies of a bug right after one instance has been confirmed. It asks the agent to state the root cause precisely, choose which variant axes to examine, and encode the pattern as a Semgrep rule or AST query rather than relying on plain text search. The search is meant to cover the current working tree, git history, copied files, vendored forks and other services or languages in the same repository.

Each candidate hit is run through reachability and impact checks, delegated to a companion findings-filter skill, so that only independently reachable variants count as findings. Confirmed variants are grouped under a single root cause, and the agent is directed toward one structural fix such as a safe wrapper or a type that prevents the unsafe state, with a detection rule added to the static-analysis config where a local patch is unavoidable.

The skill expects a confirmed defect to start from and a codebase to search, and it refers to Semgrep and the semgrep-rule-author skill for rule authoring. It asks the agent to report which axes were swept, which paths were excluded and what might still be missed.

## When your agent uses it

> Use immediately after one defect is confirmed to sweep for structurally related siblings across current code, history, copies, vendored forks, services, or languages; encode a repeatable Semgrep or AST query, gate each hit independently, and propose one root-cause fix.

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

## Features

- **Root cause characterization:** Defines the unsafe primitive, the missing check and the condition that makes the defect exploitable.
- **Structural pattern search:** Encodes the defect as a Semgrep rule or AST query so reformatted code is still matched.
- **History and copy sweep:** Searches git history, copied files, vendored forks and unmerged branches as well as the working tree.
- **Per-hit reachability gating:** Checks each candidate independently for reachability and impact before treating it as a finding.
- **Single root-cause fix:** Groups confirmed variants and proposes one structural fix instead of many local patches.
- **Coverage reporting:** Requires the sweep's axes, exclusions and known gaps to be stated explicitly.

## Good for

- Find other places in the repo that repeat a bug I just confirmed
- Write a Semgrep rule that catches this unsafe call pattern across the codebase
- Check vendored copies and old git branches for the same defect
- Propose one shared helper that fixes every instance of this missing check

## Install

### Claude Code

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

For one project only, put the folder in `.claude/skills/variant-analysis` inside it instead.

### Codex

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

For one repository only, put the folder in `.agents/skills/variant-analysis` inside it instead.

### Cursor

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

For one project only, put the folder in `.cursor/skills/variant-analysis` 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/variant-analysis
```

Or copy the folder to `~/.gemini/skills/variant-analysis` yourself.

### VS Code

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

```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/variant-analysis &&
cp -R "$tmp/.agents/skills/variant-analysis" ~/.copilot/skills/variant-analysis &&
rm -rf "$tmp"
```

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

## FAQ

### When does Variant analysis trigger?

The skill's description says to use it immediately after one defect is confirmed, to sweep for structurally related siblings.

### What does Variant analysis need to run?

It refers to Semgrep and the semgrep-rule-author skill for writing rules, and to a findings-filter skill for reachability and impact gates. The skill itself is a single SKILL.md file with no bundled scripts.

### Does Variant analysis change my code?

The instructions ask for a single structural fix and a detection rule added to the repo's static-analysis config, but the skill itself contains no scripts that modify files.

### Which agent clients does Variant analysis support?

The repository's SKILL.md does not tie it to a specific client, so it follows the shared agent skills format.

### How do I install Variant analysis in Claude Code?

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

### Does Variant analysis 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 Variant analysis?

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 Variant analysis?

The closest alternatives to Variant analysis are Variant analysis, Semgrep rule author, Diff aware semgrep scan, Find bugs and Principle fix root causes.

## Where this comes from

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

## Alternatives

- [Variant analysis](https://ai-powered.com/skills/variant-analysis): Variant analysis is an open-source agent skill for security.
- [Semgrep rule author](https://ai-powered.com/skills/semgrep-rule-author): Semgrep rule author 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.
- [Find bugs](https://ai-powered.com/skills/find-bugs): Find bugs is an open-source agent skill for security.
- [Principle fix root causes](https://ai-powered.com/skills/principle-fix-root-causes): Principle fix root causes is an open-source agent skill for developer tools.
- [Trailmark variant neighborhood](https://ai-powered.com/skills/trailmark-variant-neighborhood): Trailmark variant neighborhood is an open-source agent skill for security.
- [Security audit](https://ai-powered.com/skills/security-audit): Security audit 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.

---
Source: https://ai-powered.com/skills/variant-analysis-mtarcure
