semgrep-rule-creator

Create Semgrep YAML rules with test-first development and validation.

965|142|Updated Mar 8, 2026
One-click install
npx skills add https://github.com/vigolium/vigolium --skill semgrep-rule-creator-vigolium
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: semgrep-rule-creator
Source: https://github.com/vigolium/vigolium/tree/main/platform/vigolium-audit/src/content/skills/semgrep-rule-creator
Command: npx skills add https://github.com/vigolium/vigolium --skill semgrep-rule-creator-vigolium

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It helps you create accurate Semgrep rules for security vulnerabilities and bug patterns while minimizing false positives and false negatives through mandatory test-first development and validated semantics.

Core Features & Use Cases

  • Test-first rule authoring: Design vulnerable and safe test cases before writing the Semgrep YAML rule to ensure correctness.
  • AST-informed precision: Use Semgrep AST inspection to align patterns with how Semgrep actually parses your target language.
  • Pattern matching and taint mode: Choose pattern matching for syntactic checks or taint mode for data-flow vulnerabilities with sources/sinks/sanitizers.
  • Production-grade output structure: Enforce a per-rule directory layout with exactly one YAML rule file and one test file.

Quick Start

Use the semgrep-rule-creator skill to generate a new rule by writing tests first for your target language, validating with semgrep --test, and then iterating on the rule until all tests pass.

Frequently Asked Questions about semgrep-rule-creator

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

FAQPage Schema
How do I write Semgrep rules for security vulnerabilities?

To write Semgrep rules for security vulnerabilities, use a test-first approach by creating vulnerable and safe test cases with ruleid and ok annotations before authoring the YAML configuration to ensure reliable correctness guarantees.

When should I use taint mode vs pattern matching in Semgrep?

Use Semgrep taint mode for data-flow vulnerabilities involving sources, sinks, and sanitizers. Use pattern matching for syntactic checks to detect specific bug patterns. Taint mode is preferred for tracking untrusted data propagation across your codebase.

How do I test Semgrep rules to avoid false positives?

Test Semgrep rules by generating a test file with required ok and ruleid annotations, then running semgrep --test. Iterate between AST understanding and rule adjustments using Semgrep validation until all tests pass to minimize false positives and false negatives.

Why does my Semgrep pattern not match the expected code?

Your Semgrep pattern may not match because it differs from how Semgrep actually parses the target language. Use Semgrep AST inspection to align patterns with the parsed syntax, and validate with semgrep --test to ensure rule correctness.

What is the correct directory structure for a Semgrep rule?

The correct structure for a Semgrep rule enforces a per-rule directory layout containing exactly one YAML rule file and one test file. This production-grade output structure ensures strict testing and validated semantics for your security rules.

Do I need to review Semgrep documentation before creating rules?

Yes, you must review WebFetch-backed Semgrep documentation before implementation. This ensures your rules comply with strict testing standards, avoid generic patterns, and correctly utilize taint mode or pattern matching features.