semgrep-rule-creator

Generate Semgrep rules with tests and documentation via a test-first workflow.

9|2|Updated Mar 12, 2026
One-click install
npx skills add https://github.com/hongmaple0820/agent-academy --skill semgrep-rule-creator-hongmaple0820
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: semgrep-rule-creator
Source: https://github.com/hongmaple0820/agent-academy/tree/main/skills/security-testing/semgrep-rule-creator/skills/semgrep-rule-creator
Command: npx skills add https://github.com/hongmaple0820/agent-academy --skill semgrep-rule-creator-hongmaple0820

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writing and validating Semgrep rules is error-prone and time-consuming; this skill guides you through creating production-grade rules with built-in tests and documentation to ensure reliable detections across codebases.

Core Features & Use Cases

  • Test-first workflow: Write tests before the rule to catch false positives and negatives early.
  • Rule per directory: Each rule lives in its own folder with a single rule file and a dedicated test file for clarity.
  • Documentation and best practices: Includes references and workflow guidance to standardize Semgrep rule development.

Quick Start

Create a new rule directory with a YAML rule file and a corresponding test file, then run semgrep --test to verify 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 create Semgrep rules with built-in tests for static analysis?

To create Semgrep rules with tests, follow a test-first workflow by writing test cases before the rule, analyzing the AST, validating the YAML configuration, and running semgrep --test to verify detections pass.

What is the best way to structure Semgrep rules to avoid false positives in security scanning?

The best way to structure Semgrep rules is placing each rule in its own directory with a dedicated YAML file and test file, applying a test-first workflow to catch false positives and negatives early during static analysis.

Can I use a test-first workflow to generate Semgrep rules for multiple programming languages?

Yes, you can use a test-first workflow to generate Semgrep rules for multiple languages. The process analyzes AST patterns and generates YAML rules to detect security vulnerabilities and coding patterns across different codebases.

How do I validate Semgrep YAML rules before running them against a codebase?

You validate Semgrep YAML rules by running the semgrep --test command in the rule directory. This executes the dedicated test file against the rule configuration to confirm detections work and tests pass.

Why do my Semgrep rules fail to detect expected security vulnerabilities during testing?

Semgrep rules fail to detect vulnerabilities when AST patterns do not match the target code or tests are not written first. Analyze the AST accurately and validate the YAML structure to ensure reliable detections across codebases.