Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Find similar vulnerabilities and bugs across codebases using pattern-based analysis. Use when hunting bug variants, building CodeQL/Semgrep queries, analyzing security vulnerabilities, or performing systematic code audits after finding an initial issue.
.claude/skills/lingxling-variant-analysis/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-06 | ✗→✓ | ▲ Improved | 106% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 49% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 21% | 0% |
| case-13 | ✗→✓ | ▲ Improved | 12% | 0% |
| case-14 | ✗→✓ | ▲ Improved | -14% | 0% |
You are a variant analysis expert. Your role is to help find similar vulnerabilities and bugs across a codebase after identifying an initial pattern.
Use this skill when:
Do NOT use this skill for:
Before searching, deeply understand the known bug:
Start with a pattern that matches ONLY the known instance:
bashrg -n "exact_vulnerable_code_here"
Verify: Does it match exactly ONE location (the original)?
| Element | Keep Specific | Can Abstract | |---------|---------------|--------------| | Function name | If unique to bug | If pattern applies to family | | Variable names | Never | Always use metavariables | | Literal values | If value matters | If any value triggers bug | | Arguments | If position matters | Use ... wildcards |
Change ONE element at a time:
Stop when false positive rate exceeds ~50%
For each match, document:
For deeper strategic guidance, see METHODOLOGY.md.
| Scenario | Tool | Why | |----------|------|-----| | Quick surface search | ripgrep | Fast, zero setup | | Simple pattern matching | Semgrep | Easy syntax, no build needed | | Data flow tracking | Semgrep taint / CodeQL | Follows values across functions | | Cross-function analysis | CodeQL | Best interprocedural analysis | | Non-building code | Semgrep | Works on incomplete code |
These common mistakes cause analysts to miss real vulnerabilities:
Searching only the module where the original bug was found misses variants in other locations.
Example: Bug found in api/handlers/ → only searching that directory → missing variant in utils/auth.py
Mitigation: Always run searches against the entire codebase root directory.
Using only the exact attribute/function from the original bug misses variants using related constructs.
Example: Bug uses isAuthenticated check → only searching for that exact term → missing bugs using related properties like isActive, isAdmin, isVerified
Mitigation: Enumerate ALL semantically related attributes/functions for the bug class.
Focusing on only one manifestation of the root cause misses other ways the same logic error appears.
Example: Original bug is "return allow when condition is false" → only searching that pattern → missing:
null == null evaluates to true)Mitigation: List all possible manifestations of the root cause before searching.
Testing patterns only with "normal" scenarios misses vulnerabilities triggered by edge cases.
Example: Testing auth checks only with valid users → missing bypass when userId = null matches resourceOwnerId = null
Mitigation: Test with: unauthenticated users, null/undefined values, empty collections, and boundary conditions.
Ready-to-use templates in resources/:
CodeQL (resources/codeql/):
python.ql, javascript.ql, java.ql, go.ql, cpp.qlSemgrep (resources/semgrep/):
python.yaml, javascript.yaml, java.yaml, go.yaml, cpp.yamlReport: resources/variant-report-template.md
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→fail | 18,319 | 26,783 | +46% | 1 | 1 | 0% | 2,355 | 4,197 | +78% | 0 | 0 | — |
case-07 | pass→pass | 14,831 | 19,861 | +34% | 1 | 1 | 0% | 2,507 | 2,963 | +18% | 0 | 0 | — |
case-02 | fail→fail | 15,006 | 13,372 | -11% | 1 | 1 | 0% | 1,985 | 2,766 | +39% | 0 | 0 | — |
case-03 | fail→fail | 25,880 | 32,135 | +24% | 1 | 1 | 0% | 4,605 | 6,303 | +37% | 0 | 0 | — |
case-04 | pass→pass | 10,510 | 10,782 | +3% | 1 | 1 | 0% | 1,657 | 2,670 | +61% | 0 | 0 | — |
case-05 | pass→pass | 5,789 | 3,149 | -46% | 1 | 1 | 0% | 909 | 1,724 | +90% | 0 | 0 | — |
case-06 | fail→pass | 27,202 | 12,122 | -55% | 1 | 1 | 0% | 1,381 | 2,846 | +106% | 0 | 0 | — |
case-08 | fail→pass | 11,476 | 8,777 | -24% | 1 | 1 | 0% | 1,837 | 2,731 | +49% | 0 | 0 | — |
case-09 | pass→pass | 14,880 | 16,503 | +11% | 1 | 1 | 0% | 1,905 | 2,901 | +52% | 0 | 0 | — |
case-10 | fail→fail | 18,513 | 12,890 | -30% | 1 | 1 | 0% | 1,455 | 3,021 | +108% | 0 | 0 | — |
case-11 | fail→pass | 18,563 | 23,392 | +26% | 1 | 1 | 0% | 2,841 | 3,445 | +21% | 0 | 0 | — |
case-12 | pass→pass | 16,710 | 14,624 | -12% | 1 | 1 | 0% | 2,774 | 3,689 | +33% | 0 | 0 | — |
case-13 | fail→pass | 26,392 | 16,515 | -37% | 1 | 1 | 0% | 3,939 | 4,398 | +12% | 0 | 0 | — |
case-14 | fail→pass | 14,212 | 3,575 | -75% | 1 | 1 | 0% | 2,096 | 1,796 | -14% | 0 | 0 | — |
case-15 | fail→pass | 22,587 | 3,652 | -84% | 1 | 1 | 0% | 2,308 | 1,817 | -21% | 0 | 0 | — |
case-16 | fail→pass | 11,416 | 1,928 | -83% | 1 | 1 | 0% | 1,886 | 1,599 | -15% | 0 | 0 | — |
case-17 | fail→pass | 12,289 | 10,743 | -13% | 1 | 1 | 0% | 1,977 | 2,985 | +51% | 0 | 0 | — |
case-18 | fail→pass | 5,122 | 5,126 | +0% | 1 | 1 | 0% | 824 | 2,128 | +158% | 0 | 0 | — |
case-19 | pass→pass | 15,736 | 11,139 | -29% | 1 | 1 | 0% | 2,025 | 2,730 | +35% | 0 | 0 | — |
case-20 | pass→pass | 12,297 | 7,116 | -42% | 1 | 1 | 0% | 1,701 | 2,457 | +44% | 0 | 0 | — |
case-21 | fail→fail | 15,185 | 16,685 | +10% | 1 | 1 | 0% | 2,336 | 3,663 | +57% | 0 | 0 | — |
case-22 | fail→fail | 8,426 | 7,293 | -13% | 1 | 1 | 0% | 726 | 2,130 | +193% | 0 | 0 | — |
case-23 | fail→fail | 17,284 | 20,123 | +16% | 1 | 1 | 0% | 2,565 | 3,100 | +21% | 0 | 0 | — |
case-24 | fail→fail | 34,747 | 31,655 | -9% | 1 | 1 | 0% | 5,376 | 6,199 | +15% | 0 | 0 | — |
case-25 | fail→pass | 5,228 | 5,139 | -2% | 1 | 1 | 0% | 749 | 2,134 | +185% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 25 cases were attempted, and 24 counted toward the lift figure. The other 1 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +40 percentage points is the difference between those two pass rates over the 24 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.