semgrep-rule-variant-creator
Qué hace
Esta herramienta te ayuda a adaptar reglas de seguridad para código (llamadas 'reglas de Semgrep') a distintos lenguajes de programación. Si tienes una regla que funciona en un lenguaje, puede ayudarte a crear una versión de esa regla para otros lenguajes.
Cuándo usarla
- ✓Cuando quieres adaptar una regla de seguridad existente a un lenguaje nuevo.
- ✓Cuando necesitas crear versiones de la misma comprobación de seguridad para varios lenguajes de un proyecto.
- ✓Cuando quieres ampliar la cobertura de seguridad de tu código a lenguajes que antes no estaban incluidos.
Link de la skill
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/semgrep-rule-variant-creator/SKILL.mdCópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.
Cómo usar
La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.
Mensaje listo para pegar
Para Claude Code, Codex o Cursor: ejecútalo en la carpeta del proyecto y la skill queda instalada.
Descarga el SKILL.md y ponlo en la carpeta de skills de tu agente.
Ejemplo de qué pedirle a la IA
“Adapta la regla 'sql-injection' para Go y Java.”
5 skills nuevas por semana. 1 minuto de lectura.
Cómo funciona
La herramienta analiza si la regla original tiene sentido en el nuevo lenguaje, crea ejemplos de código para probarla y, después, genera las nuevas reglas y sus pruebas. Se asegura de que cada nueva regla se pruebe por separado.
Contenido técnico (SKILL.md original)
Texto original del autor, en inglés, directo de GitHub.
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-creatorinstead) - 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:
- Existing Semgrep rule - YAML file path or YAML rule content
- 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:
| Rationalization | Why It Fails | Correct Approach |
|---|---|---|
| "Pattern structure is identical" | Different ASTs across languages | Always dump AST for target language |
| "Same vulnerability, same detection" | Data flow differs between languages | Analyze target language idioms |
| "Rule doesn't need tests since original worked" | Language edge cases differ | Write NEW test cases for target |
| "Skip applicability - it obviously applies" | Some patterns are language-specific | Complete applicability analysis first |
| "I'll create all variants then test" | Errors compound, hard to debug | Complete full cycle per language |
| "Library equivalent is close enough" | Surface similarity hides differences | Verify API semantics match |
| "Just translate the syntax 1:1" | Languages have different idioms | Research 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:
- Does the vulnerability class exist in the target language?
- Does an equivalent construct exist (function, pattern, library)?
- Are the semantics similar enough for meaningful detection?
Verdict options:
APPLICABLE→ Proceed with variant creation
…
Preguntas frecuentes
¿Qué son las 'reglas de Semgrep'?
Son como recetas que enseñan a un programa a encontrar patrones concretos de código, normalmente para detectar problemas de seguridad o errores.
¿Por qué no puedo simplemente copiar la regla a otro lenguaje?
Cada lenguaje tiene sus particularidades y sus formas de hacer las cosas. Una regla que funciona perfectamente en un lenguaje puede no funcionar en otro, o detectar cosas incorrectas, aunque los lenguajes parezcan similares.
¿Necesito saber programar para usar esta herramienta?
No necesitas ser un programador experimentado. La herramienta automatiza el proceso de adaptación, pero entender lo básico de lo que hace la regla original te ayuda a elegir bien los lenguajes.
Detalles
Descripción original del autor
Creates language variants of existing Semgrep rules. Use when porting a Semgrep rule to specified target languages. Takes an existing rule and target languages as input, produces independent rule+test directories for each language.
Popularidad
- Estrellas en GitHub
- 48 mil
- Posición en el ranking
- #5714
- Licencia
- MIT
- Actualizada
- 15/10/2026
Comentarios
- …
Más skills de este repositorio
00-andruia-consultant
48 milAyuda a tu agente a iniciar o mejorar proyectos de IA. Analiza código, sugiere herramientas y crea planes de acción en español.
007
48 milPermite que tu agente realice auditorías de seguridad y modelado de amenazas. Es útil para proteger proyectos contra ataques y vulnerabilidades.
10-andruia-skill-smith
48 milAyuda a tu agente a crear o mejorar herramientas de IA. Define cómo funcionan, escribe la documentación y valida la estructura.
20-andruia-niche-intelligence
48 milPermite que tu agente cree un resumen de un sector específico. Es útil para entender su contexto, normas, patrones de uso y riesgos, usando fuentes fiables.
Skills parecidas
diffs
394 milPermite que tu agente genere un diff real y compartible de los cambios, como enlace de visualización o archivo de imagen, en lugar de un resumen escrito a mano.
coding-agent
394 milAyuda a tu agente a pasar un trabajo de programación grande a Codex, Claude Code u OpenCode como trabajador en segundo plano, y después revisar su progreso.
gh-issues
394 milAyuda a tu agente a encontrar incidencias de GitHub, elegir cuáles trabajar y abrir pull requests con correcciones, incluido el seguimiento de los comentarios de revisión.