variant-analysis skill
✓ OfficialLocates multiple instances of a known bug or vulnerability pattern across a codebase by generalizing root causes into search queries.
- GitHub stars
- 8,136
- Files
- 18
- Last commit
- Nov 11, 2026
- License
- CC-BY-SA-4.0
- Allowed tools
- —
What does the variant-analysis skill do?
variant-analysis locates multiple instances of a known bug or vulnerability pattern across a codebase by generalizing root causes into search queries.
Summary generated from the skill's SKILL.md.
About the variant-analysis skill
Security researchers and developers use this skill to hunt for additional instances of a bug or vulnerability pattern after an initial issue is discovered. Instead of searching for a single line of code, it generalizes a known root cause into broader search queries to find similar manifestations across an entire codebase. It is designed for use immediately after a vulnerability or logic bug is identified, rather than for initial discovery of unknown issues.
Users can run the /variant-analysis:variants workflow to execute a five-step process across parallel subagents. This process involves understanding the root cause, creating an exact match, generalizing the pattern one element at a time, and triaging candidates. The skill relies on specific reference files like root-cause.md and searching.md to guide the abstraction process. It produces refined patterns and can help build CodeQL or Semgrep queries for specific languages including Python, JavaScript, Java, Go, and C++.
What an agent can do with it
- 1Find similar vulnerability instancesLocate other occurrences of a specific bug pattern throughout a large codebase after finding the first instance.
- 2Generate security tool queriesTransform a single known bug into a generalized CodeQL or Semgrep query to catch an entire pattern family.
- 3Triage potential bug candidatesEvaluate a set of code snippets that look like a known bug to determine if they are real vulnerabilities.
- 4Perform systematic code auditsConduct a structured search for error patterns following the discovery of an initial security issue.
Written from the skill's SKILL.md. Every use case is checked against a quote from it.
How to install the variant-analysis skill
Each command copies the skill folder into the client's skills directory. Restart the client or start a new session to load it.Install the variant-analysis skill in Plugin
/plugin marketplace add trailofbits/skills /plugin install variant-analysis@trailofbits
Install the variant-analysis skill in Claude Code
~/.claude/skills/variant-analysis/SKILL.md
$ npx degit trailofbits/skills/plugins/variant-analysis/skills/variant-analysis ~/.claude/skills/variant-analysisInstall the variant-analysis skill in Claude Code (project)
.claude/skills/variant-analysis/SKILL.md
$ npx degit trailofbits/skills/plugins/variant-analysis/skills/variant-analysis .claude/skills/variant-analysisInstall the variant-analysis skill in Codex
~/.agents/skills/variant-analysis/SKILL.md
$ npx degit trailofbits/skills/plugins/variant-analysis/skills/variant-analysis ~/.agents/skills/variant-analysisInstall the variant-analysis skill in Gemini CLI
~/.gemini/skills/variant-analysis/SKILL.md
$ npx degit trailofbits/skills/plugins/variant-analysis/skills/variant-analysis ~/.gemini/skills/variant-analysisInstall the variant-analysis skill in Claude.ai
npx degit trailofbits/skills/plugins/variant-analysis/skills/variant-analysis variant-analysis && zip -r variant-analysis.zip variant-analysis # claude.ai → Customize → Skills → + → Create skill → Upload a skill → variant-analysis.zip
Automated checks
Ran Nov 15, 2026Full report →Not verified yet. A skill needs a score of 80, no serious finding, and enough data for us to check. How checks work · What to fix for more points
- Source repository linked and reachabletrailofbits/skills/plugins/variant-analysis/skills/variant-analysis is public and reachablegithub.com/trailofbits/skills/tree/HEAD/plugins/variant-anal ↗Pass
- Open source license (OSI)CC-BY-SA-4.0 is not OSI-approvedspdx.org/licenses/CC-BY-SA-4.0.html ↗Finding
- Commit or release in the last yearLast commit 2026-11-11github.com/trailofbits/skills/commits ↗Pass
- No download-and-run or credential theft in scriptsNo scripts in the skill folderPass
- No hidden instructions in SKILL.mdNo override phrases, safeguard switches, credential requests or hidden charactersgithub.com/trailofbits/skills/blob/HEAD/plugins/variant-anal ↗Pass
- Pre-approved tools are scopedNo pre-approved tools; the agent asks before using onegithub.com/trailofbits/skills/blob/HEAD/plugins/variant-anal ↗Pass
- SKILL.md follows the Agent Skills formatthe description does not say when to use the skillgithub.com/trailofbits/skills/blob/HEAD/plugins/variant-anal ↗Finding
SKILL.md
View on GitHubVariant Analysis
Find the other instances of a bug you have already found. One root cause usually has several manifestations, and they are rarely in the module where you found the first one.
When to Use
- A vulnerability has been found and you need to search for similar instances
- Building or refining CodeQL/Semgrep queries for security patterns
- Performing systematic code audits after an initial issue discovery
- Analyzing how a single root cause manifests in different code paths
When NOT to Use
- Initial vulnerability discovery — use audit-context-building or a domain-specific audit
- General code review with no known pattern to search for
- Writing fix recommendations — use issue-writer
- Understanding unfamiliar code — use audit-context-building first
The Five Steps
Read the reference for a step when you reach it.
1. Understand the original issue. Extract the root cause — why the code is wrong, not what it does — and enumerate the directions a variant could hide in: related identifiers, other manifestations of the same mistake, data-type edge cases. → references/root-cause.md
2. Create an exact match. Write a pattern matching ONLY the known instance and confirm it hits. A pattern that matches nothing means you have misunderstood the bug, and every search built on it is calibrated against the wrong code.
3–4. Generalize one element at a time. Climb from the exact match toward the pattern family, running and reading all matches after each single change. Stop when more than half the matches are noise. → references/searching.md — abstraction ladder, tool selection, false-positive filters
5. Triage. Decide which candidates are real, and say so with a severity attached. → references/triage.md
Then write it up, including the patterns that failed and a CI rule to prevent regression. → references/reporting.md
Running it as a Workflow
This plugin ships /variant-analysis:variants, which runs the five steps across parallel
subagents — one per expansion axis, looping until the sweep stops finding anything new.
Each stage reads the reference above that matches its job.
Use the workflow when the codebase is large or the root cause has many manifestations. Work the steps directly when the search is narrow or you want a say in each generalization.
What Makes Hunts Fail
- Narrow scope — searching only the module the original bug was in
- Pattern too specific — searching one attribute and missing the family around it
- One vulnerability class — chasing a single manifestation of the root cause
- Happy-path testing — never trying the null, empty, and boundary cases
- Generalizing too fast — abstracting several elements at once, so noise cannot be attributed to any one of them
The first three are covered in root-cause.md and searching.md, the fourth in triage.md.
Resources
CodeQL (resources/codeql/): python.ql, javascript.ql, java.ql, go.ql, cpp.ql
Semgrep (resources/semgrep/): python.yaml, javascript.yaml, java.yaml, go.yaml, cpp.yaml
Report: resources/variant-report-template.md
Files in this skill
18variant-analysis skill questions
How do I install the variant-analysis skill in Claude Code?
Run npx degit trailofbits/skills/plugins/variant-analysis/skills/variant-analysis ~/.claude/skills/variant-analysis. Claude Code loads skills from ~/.claude/skills (all projects) or .claude/skills (one project) and uses a skill when its description matches the task.
Which clients can use the variant-analysis skill?
Any client that reads the Agent Skills format: Claude Code, Codex, Gemini CLI and claude.ai (upload as a ZIP). Scripts in the skill run only where the client allows code execution.
When should I use variant analysis?
Use it after a vulnerability, logic bug, or bad pattern is found to search for similar instances, build CodeQL/Semgrep queries, or triage look-alike candidates.
Can I use this skill for initial vulnerability discovery?
No, this skill is not intended for initial discovery when no bug is currently in hand.