semgrep-rule-variant-creator — porting Semgrep rules to new languages semgrep-rule-variant-creator, superloop-core-contracts, community, porting Semgrep rules to new languages, ide skills, polyglot codebase management, universal vulnerability pattern creation, test-driven validation for Semgrep rules, applicability analysis for rule porting, Claude Code, Cursor

v1.0.0
GitHub

About this Skill

Perfect for Code Security Agents needing to port Semgrep rules across multiple programming languages. semgrep-rule-variant-creator is a skill that ports existing Semgrep rules to new target languages with applicability analysis and test-driven validation.

Features

Ports existing Semgrep rules to new target languages
Performs applicability analysis for rule validation
Supports test-driven validation for ensured accuracy
Expands rule coverage across polyglot codebases
Creates language-specific variants of universal vulnerability patterns
Translates rules between languages with equivalent constructs

# Core Topics

Superlend Superlend
[0]
[0]
Updated: 3/8/2026

Agent Capability Analysis

The semgrep-rule-variant-creator skill by Superlend is an open-source community AI agent skill for Claude Code and other IDE workflows, helping agents execute tasks with better context, repeatability, and domain-specific guidance. Optimized for porting Semgrep rules to new languages, polyglot codebase management, universal vulnerability pattern creation.

Ideal Agent Persona

Perfect for Code Security Agents needing to port Semgrep rules across multiple programming languages.

Core Value

Empowers agents to port existing Semgrep rules to new target languages with proper applicability analysis and test-driven validation, leveraging universal vulnerability patterns and supporting polyglot codebases through languages with equivalent constructs.

Capabilities Granted for semgrep-rule-variant-creator

Porting existing Semgrep rules to new target languages
Creating language-specific variants of universal vulnerability patterns
Expanding rule coverage across polyglot codebases
Translating rules between languages with equivalent constructs

! Prerequisites & Limits

  • Not suitable for creating new Semgrep rules from scratch
  • Requires existing Semgrep rules to port or translate
Labs Demo

Browser Sandbox Environment

⚡️ Ready to unleash?

Experience this Agent in a zero-setup browser environment powered by WebContainers. No installation required.

Boot Container Sandbox

semgrep-rule-variant-creator

Install semgrep-rule-variant-creator, an AI agent skill for AI agent workflows and automation. Works with Claude Code, Cursor, and Windsurf with one-command...

SKILL.md
Readonly

Semgrep Rule Variant Creator

Port existing Semgrep rules to new target languages with proper applicability analysis and test-driven validation.

When to Use

Ideal scenarios:

  • Porting an existing Semgrep rule to one or more target languages
  • Creating language-specific variants of a universal vulnerability pattern
  • Expanding rule coverage across a polyglot codebase
  • Translating rules between languages with equivalent constructs

When NOT to Use

Do NOT use this skill for:

  • Creating a new Semgrep rule from scratch (use semgrep-rule-creator instead)
  • Running existing rules against code
  • Languages where the vulnerability pattern fundamentally doesn't apply
  • Minor syntax variations within the same language

Input Specification

This skill requires:

  1. Existing Semgrep rule - YAML file path or YAML rule content
  2. Target languages - One or more languages to port to (e.g., "Golang and Java")

Output Specification

For each applicable target language, produces:

<original-rule-id>-<language>/
├── <original-rule-id>-<language>.yaml     # Ported Semgrep rule
└── <original-rule-id>-<language>.<ext>    # Test file with annotations

Example output for porting sql-injection to Go and Java:

sql-injection-golang/
├── sql-injection-golang.yaml
└── sql-injection-golang.go

sql-injection-java/
├── sql-injection-java.yaml
└── sql-injection-java.java

Rationalizations to Reject

When porting Semgrep rules, reject these common shortcuts:

RationalizationWhy It FailsCorrect Approach
"Pattern structure is identical"Different ASTs across languagesAlways dump AST for target language
"Same vulnerability, same detection"Data flow differs between languagesAnalyze target language idioms
"Rule doesn't need tests since original worked"Language edge cases differWrite NEW test cases for target
"Skip applicability - it obviously applies"Some patterns are language-specificComplete applicability analysis first
"I'll create all variants then test"Errors compound, hard to debugComplete full cycle per language
"Library equivalent is close enough"Surface similarity hides differencesVerify API semantics match
"Just translate the syntax 1:1"Languages have different idiomsResearch target language patterns

Strictness Level

This workflow is strict - do not skip steps:

  • Applicability analysis is mandatory: Don't assume patterns translate
  • Each language is independent: Complete full cycle before moving to next
  • Test-first for each variant: Never write a rule without test cases
  • 100% test pass required: "Most tests pass" is not acceptable

Overview

This skill guides the creation of language-specific variants of existing Semgrep rules. Each target language goes through an independent 4-phase cycle:

FOR EACH target language:
  Phase 1: Applicability Analysis → Verdict
  Phase 2: Test Creation (Test-First)
  Phase 3: Rule Creation
  Phase 4: Validation
  (Complete full cycle before moving to next language)

Foundational Knowledge

The semgrep-rule-creator skill is the authoritative reference for Semgrep rule creation fundamentals. While this skill focuses on porting existing rules to new languages, the core principles of writing quality rules remain the same.

Consult semgrep-rule-creator for guidance on:

  • When to use taint mode vs pattern matching - Choosing the right approach for the vulnerability type
  • Test-first methodology - Why tests come before rules and how to write effective test cases
  • Anti-patterns to avoid - Common mistakes like overly broad or overly specific patterns
  • Iterating until tests pass - The validation loop and debugging techniques
  • Rule optimization - Removing redundant patterns after tests pass

When porting a rule, you're applying these same principles in a new language context. If uncertain about rule structure or approach, refer to semgrep-rule-creator first.

Four-Phase Workflow

Phase 1: Applicability Analysis

Before porting, determine if the pattern applies to the target language.

Analysis criteria:

  1. Does the vulnerability class exist in the target language?
  2. Does an equivalent construct exist (function, pattern, library)?
  3. Are the semantics similar enough for meaningful detection?

Verdict options:

  • APPLICABLE → Proceed with variant creation
  • APPLICABLE_WITH_ADAPTATION → Proceed but significant changes needed
  • NOT_APPLICABLE → Skip this language, document why

See applicability-analysis.md for detailed guidance.

Phase 2: Test Creation (Test-First)

Always write tests before the rule.

Create test file with target language idioms:

  • Minimum 2 vulnerable cases (ruleid:)
  • Minimum 2 safe cases (ok:)
  • Include language-specific edge cases
go
1// ruleid: sql-injection-golang 2db.Query("SELECT * FROM users WHERE id = " + userInput) 3 4// ok: sql-injection-golang 5db.Query("SELECT * FROM users WHERE id = ?", userInput)

Phase 3: Rule Creation

  1. Analyze AST: semgrep --dump-ast -l <lang> test-file
  2. Translate patterns to target language syntax
  3. Update metadata: language key, message, rule ID
  4. Adapt for idioms: Handle language-specific constructs

See language-syntax-guide.md for translation guidance.

Phase 4: Validation

bash
1# Validate YAML 2semgrep --validate --config rule.yaml 3 4# Run tests 5semgrep --test --config rule.yaml test-file

Checkpoint: Output MUST show All tests passed.

For taint rule debugging:

bash
1semgrep --dataflow-traces -f rule.yaml test-file

See workflow.md for detailed workflow and troubleshooting.

Quick Reference

TaskCommand
Run testssemgrep --test --config rule.yaml test-file
Validate YAMLsemgrep --validate --config rule.yaml
Dump ASTsemgrep --dump-ast -l <lang> <file>
Debug taint flowsemgrep --dataflow-traces -f rule.yaml file

Key Differences from Rule Creation

Aspectsemgrep-rule-creatorThis skill
InputBug pattern descriptionExisting rule + target languages
OutputSingle rule+testMultiple rule+test directories
WorkflowSingle creation cycleIndependent cycle per language
Phase 1Problem analysisApplicability analysis per language
Library researchAlways relevantOptional (when original uses libraries)

Documentation

REQUIRED: Before porting rules, read relevant Semgrep documentation:

Next Steps

FAQ & Installation Steps

These questions and steps mirror the structured data on this page for better search understanding.

? Frequently Asked Questions

What is semgrep-rule-variant-creator?

Perfect for Code Security Agents needing to port Semgrep rules across multiple programming languages. semgrep-rule-variant-creator is a skill that ports existing Semgrep rules to new target languages with applicability analysis and test-driven validation.

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

Run the command: npx killer-skills add Superlend/superloop-core-contracts/semgrep-rule-variant-creator. It works with Cursor, Windsurf, VS Code, Claude Code, and 19+ other IDEs.

What are the use cases for semgrep-rule-variant-creator?

Key use cases include: Porting existing Semgrep rules to new target languages, Creating language-specific variants of universal vulnerability patterns, Expanding rule coverage across polyglot codebases, Translating rules between languages with equivalent constructs.

Which IDEs are compatible with semgrep-rule-variant-creator?

This skill is compatible with Cursor, Windsurf, VS Code, Trae, Claude Code, OpenClaw, Aider, Codex, OpenCode, Goose, Cline, Roo Code, Kiro, Augment Code, Continue, GitHub Copilot, Sourcegraph Cody, and Amazon Q Developer. Use the Killer-Skills CLI for universal one-command installation.

Are there any limitations for semgrep-rule-variant-creator?

Not suitable for creating new Semgrep rules from scratch. Requires existing Semgrep rules to port or translate.

How To Install

  1. 1. Open your terminal

    Open the terminal or command line in your project directory.

  2. 2. Run the install command

    Run: npx killer-skills add Superlend/superloop-core-contracts/semgrep-rule-variant-creator. The CLI will automatically detect your IDE or AI agent and configure the skill.

  3. 3. Start using the skill

    The skill is now active. Your AI agent can use semgrep-rule-variant-creator immediately in the current project.

Related Skills

Looking for an alternative to semgrep-rule-variant-creator or another community skill for your workflow? Explore these related open-source skills.

View All

widget-generator

Logo of f
f

f.k.a. Awesome ChatGPT Prompts. Share, discover, and collect prompts from the community. Free and open source — self-host for your organization with complete privacy.

149.6k
0
AI

flags

Logo of vercel
vercel

flags is a Next.js feature management skill that enables developers to efficiently add or modify framework feature flags, streamlining React application development.

138.4k
0
Browser

zustand

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
AI

data-fetching

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
AI