semgrep-rule-creator — creating custom Semgrep rules semgrep-rule-creator, community, creating custom Semgrep rules, ide skills, semgrep-rule-creator install, Claude Code, Cursor, Windsurf

v1.0.0
GitHub

About this Skill

Perfect for Code Security Agents needing custom Semgrep rule creation for bug patterns and security vulnerabilities. semgrep-rule-creator is a skill that enables developers to create production-quality Semgrep rules with proper testing and validation for detecting security vulnerabilities and enforcing coding standards.

Features

Creates custom Semgrep rules for specific bug patterns
Writes rules to detect security vulnerabilities in codebases
Supports writing taint mode rules for data flow vulnerabilities
Enforces coding standards with custom rules
Validates rules with proper testing

# Core Topics

pratyushdeosingh pratyushdeosingh
[0]
[0]
Updated: 3/7/2026

Agent Capability Analysis

The semgrep-rule-creator skill by pratyushdeosingh is an open-source community AI agent skill for Claude Code and other IDE workflows, helping agents execute tasks with better context, repeatability, and domain-specific guidance. Optimized for creating custom Semgrep rules, semgrep-rule-creator install.

Ideal Agent Persona

Perfect for Code Security Agents needing custom Semgrep rule creation for bug patterns and security vulnerabilities.

Core Value

Empowers agents to write production-quality Semgrep rules with proper testing and validation, enabling detection of specific bug patterns, security vulnerabilities, and enforcement of coding standards using taint mode rules for data flow vulnerabilities.

Capabilities Granted for semgrep-rule-creator

Writing custom Semgrep rules for specific bug patterns
Detecting security vulnerabilities in codebases using Semgrep rules
Enforcing coding standards with custom Semgrep rules
Creating taint mode rules for data flow vulnerability detection

! Prerequisites & Limits

  • Not suitable for running existing Semgrep rulesets
  • Not intended for general static analysis without custom rules
Labs Demo

Browser Sandbox Environment

⚡️ Ready to unleash?

Experience this Agent in a zero-setup browser environment powered by WebContainers. No installation required.

Boot Container Sandbox

semgrep-rule-creator

Install semgrep-rule-creator, an AI agent skill for AI agent workflows and automation. Works with Claude Code, Cursor, and Windsurf with one-command setup.

SKILL.md
Readonly

Semgrep Rule Creator

Create production-quality Semgrep rules with proper testing and validation.

When to Use

Ideal scenarios:

  • Writing Semgrep rules for specific bug patterns
  • Writing rules to detect security vulnerabilities in your codebase
  • Writing taint mode rules for data flow vulnerabilities
  • Writing rules to enforce coding standards

When NOT to Use

Do NOT use this skill for:

  • Running existing Semgrep rulesets
  • General static analysis without custom rules (use static-analysis skill)

Rationalizations to Reject

When writing Semgrep rules, reject these common shortcuts:

  • "The pattern looks complete" → Still run semgrep --test --config <rule-id>.yaml <rule-id>.<ext> to verify. Untested rules have hidden false positives/negatives.
  • "It matches the vulnerable case" → Matching vulnerabilities is half the job. Verify safe cases don't match (false positives break trust).
  • "Taint mode is overkill for this" → If data flows from user input to a dangerous sink, taint mode gives better precision than pattern matching.
  • "One test is enough" → Include edge cases: different coding styles, sanitized inputs, safe alternatives, and boundary conditions.
  • "I'll optimize the patterns first" → Write correct patterns first, optimize after all tests pass. Premature optimization causes regressions.
  • "The AST dump is too complex" → The AST reveals exactly how Semgrep sees code. Skipping it leads to patterns that miss syntactic variations.

Anti-Patterns

Too broad - matches everything, useless for detection:

yaml
1# BAD: Matches any function call 2pattern: $FUNC(...) 3 4# GOOD: Specific dangerous function 5pattern: eval(...)

Missing safe cases in tests - leads to undetected false positives:

python
1# BAD: Only tests vulnerable case 2# ruleid: my-rule 3dangerous(user_input) 4 5# GOOD: Include safe cases to verify no false positives 6# ruleid: my-rule 7dangerous(user_input) 8 9# ok: my-rule 10dangerous(sanitize(user_input)) 11 12# ok: my-rule 13dangerous("hardcoded_safe_value")

Overly specific patterns - misses variations:

yaml
1# BAD: Only matches exact format 2pattern: os.system("rm " + $VAR) 3 4# GOOD: Matches all os.system calls with taint tracking 5mode: taint 6pattern-sinks: 7 - pattern: os.system(...)

Strictness Level

This workflow is strict - do not skip steps:

  • Read documentation first: See Documentation before writing Semgrep rules
  • Test-first is mandatory: Never write a rule without tests
  • 100% test pass is required: "Most tests pass" is not acceptable
  • Optimization comes last: Only simplify patterns after all tests pass
  • Avoid generic patterns: Rules must be specific, not match broad patterns
  • Prioritize taint mode: For data flow vulnerabilities
  • One YAML file - one Semgrep rule: Each YAML file must contain only one Semgrep rule; don't combine multiple rules in a single file
  • No generic rules: When targeting a specific language for Semgrep rules - avoid generic pattern matching (languages: generic)
  • Forbidden todook and todoruleid test annotations: todoruleid: <rule-id> and todook: <rule-id> annotations in tests files for future rule improvements are forbidden

Overview

This skill guides creation of Semgrep rules that detect security vulnerabilities and code patterns. Rules are created iteratively: analyze the problem, write tests first, analyze AST structure, write the rule, iterate until all tests pass, optimize the rule.

Approach selection:

  • Taint mode (prioritize): Data flow issues where untrusted input reaches dangerous sinks
  • Pattern matching: Simple syntactic patterns without data flow requirements

Why prioritize taint mode? Pattern matching finds syntax but misses context. A pattern eval($X) matches both eval(user_input) (vulnerable) and eval("safe_literal") (safe). Taint mode tracks data flow, so it only alerts when untrusted data actually reaches the sink—dramatically reducing false positives for injection vulnerabilities.

Iterating between approaches: It's okay to experiment. If you start with taint mode and it's not working well (e.g., taint doesn't propagate as expected, too many false positives/negatives), switch to pattern matching. Conversely, if pattern matching produces too many false positives on safe cases, try taint mode instead. The goal is a working rule—not rigid adherence to one approach.

Output structure - exactly 2 files in a directory named after the rule-id:

<rule-id>/
├── <rule-id>.yaml     # Semgrep rule
└── <rule-id>.<ext>    # Test file with ruleid/ok annotations

Quick Start

yaml
1rules: 2 - id: insecure-eval 3 languages: [python] 4 severity: HIGH 5 message: User input passed to eval() allows code execution 6 mode: taint 7 pattern-sources: 8 - pattern: request.args.get(...) 9 pattern-sinks: 10 - pattern: eval(...)

Test file (insecure-eval.py):

python
1# ruleid: insecure-eval 2eval(request.args.get('code')) 3 4# ok: insecure-eval 5eval("print('safe')")

Run tests (from rule directory): semgrep --test --config <rule-id>.yaml <rule-id>.<ext>

Quick Reference

  • For commands, pattern operators, and taint mode syntax, see quick-reference.md.
  • For detailed workflow and examples, you MUST see workflow.md

Workflow

Copy this checklist and track progress:

Semgrep Rule Progress:
- [ ] Step 1: Analyze the Problem
- [ ] Step 2: Write Tests First
- [ ] Step 3: Analyze AST structure
- [ ] Step 4: Write the rule
- [ ] Step 5: Iterate until all tests pass (semgrep --test)
- [ ] Step 6: Optimize the rule (remove redundancies, re-test)
- [ ] Step 7: Final Run

Documentation

REQUIRED: Before writing any rule, use WebFetch to read all of these 4 links with Semgrep documentation:

  1. Rule Syntax
  2. Pattern Syntax
  3. ToB Testing Handbook - Semgrep
  4. Constant propagation
  5. Writing Rules Index

FAQ & Installation Steps

These questions and steps mirror the structured data on this page for better search understanding.

? Frequently Asked Questions

What is semgrep-rule-creator?

Perfect for Code Security Agents needing custom Semgrep rule creation for bug patterns and security vulnerabilities. semgrep-rule-creator is a skill that enables developers to create production-quality Semgrep rules with proper testing and validation for detecting security vulnerabilities and enforcing coding standards.

How do I install semgrep-rule-creator?

Run the command: npx killer-skills add pratyushdeosingh/mdp/semgrep-rule-creator. It works with Cursor, Windsurf, VS Code, Claude Code, and 19+ other IDEs.

What are the use cases for semgrep-rule-creator?

Key use cases include: Writing custom Semgrep rules for specific bug patterns, Detecting security vulnerabilities in codebases using Semgrep rules, Enforcing coding standards with custom Semgrep rules, Creating taint mode rules for data flow vulnerability detection.

Which IDEs are compatible with semgrep-rule-creator?

This skill is compatible with Cursor, Windsurf, VS Code, Trae, Claude Code, OpenClaw, Aider, Codex, OpenCode, Goose, Cline, Roo Code, Kiro, Augment Code, Continue, GitHub Copilot, Sourcegraph Cody, and Amazon Q Developer. Use the Killer-Skills CLI for universal one-command installation.

Are there any limitations for semgrep-rule-creator?

Not suitable for running existing Semgrep rulesets. Not intended for general static analysis without custom rules.

How To Install

  1. 1. Open your terminal

    Open the terminal or command line in your project directory.

  2. 2. Run the install command

    Run: npx killer-skills add pratyushdeosingh/mdp/semgrep-rule-creator. The CLI will automatically detect your IDE or AI agent and configure the skill.

  3. 3. Start using the skill

    The skill is now active. Your AI agent can use semgrep-rule-creator immediately in the current project.

Related Skills

Looking for an alternative to semgrep-rule-creator or another community skill for your workflow? Explore these related open-source skills.

View All

widget-generator

Logo of f
f

f.k.a. Awesome ChatGPT Prompts. Share, discover, and collect prompts from the community. Free and open source — self-host for your organization with complete privacy.

149.6k
0
AI

flags

Logo of vercel
vercel

flags is a Next.js feature management skill that enables developers to efficiently add or modify framework feature flags, streamlining React application development.

138.4k
0
Browser

zustand

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
AI

data-fetching

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
AI