semgrep-rule-creator

Create Semgrep rules with test-first validation and structured metadata.

6.5k|561|Updated Jan 14, 2026
One-click install
npx skills add https://github.com/trailofbits/skills --skill semgrep-rule-creator-trailofbits
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: semgrep-rule-creator
Source: https://github.com/trailofbits/skills/tree/main/plugins/semgrep-rule-creator/skills/semgrep-rule-creator
Command: npx skills add https://github.com/trailofbits/skills --skill semgrep-rule-creator-trailofbits

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writing Semgrep rules often requires a clear, testable workflow to ensure accurate detections and minimize false positives. This skill guides developers to create production-grade Semgrep rules with a test-first approach, built-in validation, and structured metadata.

Core Features & Use Cases

  • Guides the end-to-end authoring of Semgrep rules with a test-first mindset.
  • Supports taint-mode and pattern-based approaches for robust security detections.
  • Provides guidance for debugging, testing, and iterating rules to production readiness.

Quick Start

Write a Semgrep rule following the test-first workflow and validate it with semgrep --test to ensure 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 production-ready Semgrep rules with tests?

Production-ready Semgrep rules require a test-first workflow, one-rule-per-file structure with frontmatter metadata, and iterative optimization to ensure accurate detections and minimize false positives.

What is taint-mode in Semgrep and when should I use it for security detection?

Taint-mode in Semgrep tracks data flow from sources to sinks for security detection. Use it when pattern-based approaches cannot capture complex data propagation across custom static analysis rules.

How do I validate and debug Semgrep rules to reduce false positives?

Validate and debug Semgrep rules by running semgrep --test to ensure all tests pass, then iteratively optimize rule patterns and taint-mode configurations to reduce false positives in security-focused codebases.

Does Semgrep rule authoring work across multiple programming languages?

Semgrep rule authoring supports custom static analysis across multiple programming languages, enabling pattern-based and taint-mode security detections for diverse codebases through a unified rule structure.

What is the best way to structure Semgrep rules for production use?

The best way to structure Semgrep rules for production is a one-rule-per-file format with frontmatter metadata, ensuring each rule is independently testable, maintainable, and validated through structured testing workflows.