semgrep-rule-variant-creator

Port Semgrep rules into language-specific variants with test-first validation.

Updated May 2, 2026
One-click install
npx skills add https://github.com/ayehiaa/my-travel-assistant --skill semgrep-rule-variant-creator-ayehiaa
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: semgrep-rule-variant-creator
Source: https://github.com/ayehiaa/my-travel-assistant/tree/main/.agents/skills/semgrep-rule-variant-creator
Command: npx skills add https://github.com/ayehiaa/my-travel-assistant --skill semgrep-rule-variant-creator-ayehiaa

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Semgrep rule authors often need to port existing detection logic to new target languages, but naïve translation leads to missed findings or false positives.

Core Features & Use Cases

  • Applicability analysis per target language to decide whether a port is applicable, needs adaptation, or should be skipped.
  • Test-first variant creation by generating language-specific test cases with required vulnerable and safe examples.
  • Rule creation from AST-informed translation, then validation to require that all tests pass for each language.
  • Multi-language output generation, producing independent rule and test files for each target language with consistent naming.

Quick Start

Use the semgrep-rule-variant-creator skill to port an existing Semgrep rule to Go and Java by providing the original rule plus the target languages, then follow its workflow to generate and validate test-backed language variants.

Frequently Asked Questions about semgrep-rule-variant-creator

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I port a Semgrep rule to another language?

Port a Semgrep rule by analyzing applicability for the target language, translating the rule using AST-informed logic, generating test-first vulnerable and safe examples, and validating that all tests pass.

Does Semgrep rule translation work across multiple languages at once?

Yes, Semgrep rule translation applies to polyglot codebases by generating independent rule and test files for each target language with consistent naming, requiring mandatory applicability analysis before porting.

Why do my ported Semgrep rules produce false positives or missed findings?

Naïve Semgrep rule translation causes false positives and missed findings because it lacks AST-informed rule translation and test-first generation with required vulnerable and safe examples to guarantee correctness.

How do I write tests for a translated Semgrep rule?

Write tests for a translated Semgrep rule using test-first variant creation, generating language-specific test cases with required vulnerable and safe examples, then validating with Semgrep to require all tests pass.

When should I skip porting a Semgrep rule to a target language?

You should skip porting a Semgrep rule when mandatory applicability analysis determines the rule is not applicable to the target language, rather than forcing an adaptation that may produce incorrect detection logic.

Can I use taint analysis when porting Semgrep rules to new languages?

Yes, taint analysis rules can be ported to new target languages using AST-informed rule translation, producing independent rule and test files with correctness guarantees validated by passing all Semgrep tests.