semgrep-rule-creator

Create custom Semgrep rules using test-driven development and AST analysis.

Updated Jan 30, 2026
One-click install
npx skills add https://github.com/andrescardonas7/salchipapa-web --skill semgrep-rule-creator-andrescardonas7
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: semgrep-rule-creator
Source: https://github.com/andrescardonas7/salchipapa-web/tree/main/.cursor/skills/semgrep-rule-creator
Command: npx skills add https://github.com/andrescardonas7/salchipapa-web --skill semgrep-rule-creator-andrescardonas7

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill streamlines the creation of custom Semgrep rules for detecting complex bug patterns and security vulnerabilities, ensuring code quality and security.

Core Features & Use Cases

  • Test-Driven Development: Guides users to write test cases before the rule itself, ensuring comprehensive coverage.
  • Taint Mode Prioritization: Emphasizes taint mode for precise data flow analysis, reducing false positives.
  • AST Analysis: Helps users understand and leverage Semgrep's Abstract Syntax Tree parsing for accurate pattern matching.
  • Use Case: A security engineer needs to create a new Semgrep rule to detect a specific type of SQL injection vulnerability in Python code. This Skill will guide them through writing test cases for both vulnerable and safe code, analyzing the AST, crafting the taint-mode rule, and iterating until all tests pass.

Quick Start

Use the semgrep-rule-creator skill to help you write a new Semgrep rule for detecting command injection vulnerabilities in Python.

Frequently Asked Questions about semgrep-rule-creator

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

FAQPage Schema
How do I create custom Semgrep rules for security vulnerabilities?

To create custom Semgrep rules for security vulnerabilities, use a test-driven approach by writing vulnerable and safe test cases first, crafting the pattern or taint-mode rule, and iterating until tests pass.

How does taint analysis work in Semgrep rule creation?

Taint analysis in Semgrep rule creation tracks data flow from sources to sinks, enabling precise detection of vulnerabilities like SQL injection while minimizing false positives compared to basic pattern matching.

Do I need Semgrep installed locally to write and test custom rules?

Yes, you need Semgrep installed locally to validate custom rules, run test cases against vulnerable and safe code snippets, and iterate on pattern matching or taint-mode configurations until successful.

What is the best way to reduce false positives in static analysis rules?

The best way to reduce false positives in static analysis rules is prioritizing taint-mode tracking over generic pattern matching, leveraging AST analysis for accurate syntax matching, and validating with comprehensive test cases.

How do I use AST analysis to match bug patterns in source code?

AST analysis helps match bug patterns in source code by parsing the abstract syntax tree, allowing you to define precise structural patterns that Semgrep uses to identify complex security vulnerabilities.

Why should I write test cases before creating a Semgrep rule?

Writing test cases before creating a Semgrep rule ensures comprehensive coverage by defining expected vulnerable and safe behaviors upfront, guiding the AST pattern or taint-mode development, and verifying detection accuracy iteratively.