semgrep-rule-creator

Generate custom Semgrep rules using test-first development and AST validation.

Updated Dec 29, 2025
One-click install
npx skills add https://github.com/AmidVoshakul/chatorai --skill semgrep-rule-creator-amidvoshakul
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: semgrep-rule-creator
Source: https://github.com/AmidVoshakul/chatorai/tree/main/assets/skills/semgrep-rule-creator
Command: npx skills add https://github.com/AmidVoshakul/chatorai --skill semgrep-rule-creator-amidvoshakul

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill addresses the difficulty of writing accurate, high-quality static analysis rules by enforcing a rigorous test-first development workflow that minimizes false positives and ensures reliable detection of security vulnerabilities.

Core Features & Use Cases

  • Taint Mode Prioritization: Focuses on tracking data flow from untrusted sources to dangerous sinks to identify injection vulnerabilities with high precision.
  • Test-Driven Development: Mandates the creation of test cases before rule writing to ensure all patterns are validated against both vulnerable and safe code.
  • Use Case: Use this skill when you need to create a custom security rule to detect a specific internal API misuse or a new variant of a known vulnerability pattern in your codebase.

Quick Start

Use the semgrep-rule-creator skill to generate a new taint-mode rule for detecting insecure file path concatenation in your Python project.

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 custom Semgrep rules to detect security vulnerabilities?

Custom Semgrep rules are generated by enforcing a test-first development methodology, creating test cases before rule writing to validate patterns against both vulnerable and safe code, minimizing false positives.

How does taint analysis work for tracking injection vulnerabilities in static analysis?

Taint analysis tracks data flow from untrusted sources to dangerous sinks to identify injection vulnerabilities with high precision. This approach prioritizes tracking untrusted inputs through the codebase to detect security flaws.

What is the best way to reduce false positives when creating static analysis rules for code patterns?

The best way to reduce false positives is to mandate test-driven development for static analysis rules, requiring iterative validation against AST structures and test cases to ensure rule accuracy before deployment.

Can I use Semgrep to detect internal API misuse and specific bug patterns in my codebase?

Yes, Semgrep can detect specific internal API misuse and new variants of known vulnerability patterns by generating custom rules that target specific coding standard violations and bug patterns within your codebase.

Do I need test cases before writing a Semgrep rule for taint-mode vulnerabilities?

Yes, test cases are required before writing Semgrep rules. The test-first development methodology mandates creating test cases to validate all patterns against both vulnerable and safe code, ensuring reliable detection.

Why does my static analysis rule fail to match the correct AST structure during validation?

Static analysis rules fail AST structure validation when they lack iterative validation against test cases. Ensuring rule accuracy requires validating patterns against both vulnerable and safe code to minimize false positives.