semgrep-rule-creator

Create Semgrep YAML rules with deterministic vulnerable and safe test cases.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you create Semgrep detection rules that reliably find security vulnerabilities and bug patterns without producing misleading false positives or missed matches.

Core Features & Use Cases

  • Custom Semgrep rule creation: Build a production-quality YAML rule tailored to a specific vulnerability pattern or coding standard.
  • Test-first validation: Design both vulnerable and safe test cases and require 100% test pass before considering the rule complete.
  • Precision via taint mode: Prefer taint analysis for data-flow vulnerabilities (e.g., untrusted input reaching dangerous sinks) to reduce noise and improve accuracy.

Quick Start

Use the semgrep-rule-creator skill to generate a Semgrep taint-mode rule with a complete test file and then run semgrep --test to verify that all cases 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 a Semgrep rule for detecting security vulnerabilities?

To write a Semgrep rule for detecting security vulnerabilities, you define a YAML configuration specifying the target pattern and use taint mode to track untrusted input reaching dangerous sinks, validating the rule with deterministic test cases.

What is taint mode in static analysis and when should I use it for secure coding?

Taint mode in static analysis tracks data flow from untrusted sources to dangerous sinks, reducing false positives. You should use taint mode for secure coding when detecting vulnerabilities involving user input reaching sensitive functions.

How do I test Semgrep rules to prevent false positives and missed matches?

You test Semgrep rules by creating a test file with vulnerable, safe, and edge-case code variations, then running semgrep --test to verify 100% pass rate before considering the rule complete and validated against false positives.

Can I use pattern matching to enforce custom coding standards with Semgrep?

You can use Semgrep pattern matching to enforce custom coding standards by creating YAML rules that detect buggy code patterns, applying guardrails against overly broad configurations to ensure high precision and accurate detection.

Why does my Semgrep static analysis rule produce false positives on safe code?

Semgrep static analysis rules produce false positives on safe code when they lack precise pattern definitions or proper test coverage, requiring taint mode for data-flow vulnerabilities and mandatory semgrep --test verification to resolve.

What is the best way to create custom static analysis rules for unvalidated input?

The best way to create custom static analysis rules for unvalidated input is authoring taint-mode Semgrep YAML configurations with mandatory documentation review and deterministic test validation covering vulnerable and safe code variations.