Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

semgrep-rule-variant-creator

Skill by waybarrios

Ports an existing Semgrep rule to one or more target languages, producing a separate rule and test directory for each. Built for teams expanding Semgrep rule coverage across a polyglot codebase.

  • Score 72
  • 562 stars
  • MIT
  • Updated
Works withClaude CodeClaude apps Antigravity CLI

Install semgrep-rule-variant-creator

Built from the published package, never by AI.

git clone --depth 1 https://github.com/waybarrios/opencode-power-pack /tmp/opencode-power-pack && mkdir -p ~/.claude/skills && cp -r /tmp/opencode-power-pack/skills/semgrep-rule-variant-creator ~/.claude/skills/semgrep-rule-variant-creator

Run in your terminal. Claude Code loads skills from ~/.claude/skills automatically.

Step-by-step: install semgrep-rule-variant-creator in Claude Code

Skills can run scripts on your machine. Some need an API key: check the README.

About

The semgrep-rule-variant-creator skill ports an existing Semgrep rule to one or more target languages. You give it a rule as a YAML file or YAML content, plus the languages to port to, such as Golang and Java. For each language, it first runs an applicability analysis that returns a verdict of applicable, applicable with adaptation, or not applicable.

For each applicable language, the skill writes test cases first, then creates the rule, then validates it with Semgrep. The output is a separate rule and test directory per language. The workflow is strict: each language must reach a full test pass before the next language starts. It is aimed at teams that want to extend Semgrep rule coverage across a polyglot codebase.

Written from the project's SKILL.md and checked against it.

What it can do

  • Applicability analysisDecides whether a vulnerability pattern applies to each target language, with a verdict per language.
  • Test-first variant creationWrites vulnerable and safe test cases with target language idioms before writing the rule.
  • Pattern translationDumps the AST for the target language and translates the original rule patterns to its syntax.
  • Per-language outputProduces a rule YAML and a test file in a separate directory for each applicable language.
  • Rule validationChecks the rule with semgrep --validate and runs tests with semgrep --test.

What you need

  • Semgrep CLI

Try asking

  • Port this Semgrep sql-injection rule to Golang and Java.
  • Check whether this XSS rule applies to Python and TypeScript before porting it.
  • Create Semgrep rule variants with tests for each language in my polyglot repo.

Good to know

  • Each language must reach a 100% test pass before the next language starts.
  • Languages where the vulnerability pattern does not apply are skipped.
  • Not for creating new rules from scratch or for running existing rules.

Security check

A

No download-and-run commands, hidden instructions or signs of sending keys out were found.

Checked automatically: skills/semgrep-rule-variant-creator/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work

Alternatives to semgrep-rule-variant-creator

All alternatives →

Compare with function_health, windows-privilege-escalation or github-actions-advanced

semgrep-rule-variant-creator: common questions

What does this skill output?

For each applicable language it creates a directory with a Semgrep rule YAML file and a test file containing ruleid and ok annotations.

When should I use semgrep-rule-creator instead?

The source says to use semgrep-rule-creator when creating a new Semgrep rule from scratch rather than porting an existing one.

What happens if a pattern does not apply to a language?

The skill gives a NOT_APPLICABLE verdict, skips that language, and documents why.

How do I install semgrep-rule-variant-creator?

Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.

Is semgrep-rule-variant-creator free?

The code is published under the MIT licence. The service it connects to may have its own pricing.

Is semgrep-rule-variant-creator safe to use?

It scores 72 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.

What are alternatives to semgrep-rule-variant-creator?

Similar skills: function_health, windows-privilege-escalation, github-actions-advanced, propose-security-hardening.

semgrep-rule-variant-creator Install

Add to stack

Loading.