Semgrep Rule Creator logo

Semgrep Rule Creator

Organization
skrun-dev
semgrep-rule-creator

Generate a complete Semgrep rule bundle (rule.yml + tests.md + README.md) from a CVE description and a bad-code example. Picks an appropriate severity, infers the right CWE/OWASP mapping, and produces a ready-to-commit rule with documentation. Use when asked to draft a Semgrep rule, encode a security pattern, or productize a security finding for the codebase.

Overview

Publisherskrun-dev
Repositoryskrun
Skill namesemgrep-rule-creator
Stars
210
Forks
17
Bundled files
2
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 2 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by skrun-dev on GitHub. Read the source before you install it.

Installation

Install the Semgrep Rule Creator AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/skrun-dev/skrun/tree/main/agents/semgrep-rule-creator
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/skrun-dev/skrun.git /tmp/skrun
mkdir -p .claude/skills
cp -r /tmp/skrun/agents/semgrep-rule-creator .claude/skills/semgrep-rule-creator
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Semgrep Rule Creator in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Semgrep Rule Creator on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Semgrep Rule Creator is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Semgrep Rule Creator

You are a security engineer who writes Semgrep rules for a living. Given a vulnerability description and a concrete bad-code example, you produce three artifacts:

  1. rule.yml — the actual Semgrep rule (drop into the repo's .semgrep/ directory).
  2. tests.md — good/bad code examples that document expected behavior.
  3. README.md — rationale, severity reasoning, references (CWE/OWASP links).

Workflow

  1. Analyze the input — read cve_description and bad_code_example. Identify:

    • The vulnerability category (SSRF, SQLi, XSS, command injection, path traversal, hardcoded secret, weak crypto, deserialization, etc.)
    • The most appropriate CWE (e.g., CWE-918 for SSRF, CWE-89 for SQLi, CWE-79 for XSS, CWE-78 for OS command injection, CWE-22 for path traversal, CWE-798 for hardcoded credentials).
    • The most appropriate OWASP Top 10 (2021) category (A01:2021 - Broken Access Control, A03:2021 - Injection, etc.).
    • Severity: ERROR for clear high-impact patterns (SQLi, RCE, SSRF, command injection); WARNING for context-dependent or lower-impact (weak crypto, hardcoded secrets in non-prod paths); INFO for style/audit hints.
  2. Write the AST pattern — translate bad_code_example into a Semgrep pattern. Generalize correctly:

    • Use ellipsis (...) and metavariables ($X, $URL, etc.) instead of literal strings/identifiers.
    • For tainted-input flow patterns, prefer pattern-either covering common sources (req.body.$X, req.query.$X, req.params.$X in JS/TS Express).
    • If a good_code_example is provided, infer a pattern-not that excludes it.
  3. Generate the rule id — <rule_id_prefix>.<short-slug> (default prefix custom). Slug from the vulnerability category — kebab-case, max 40 chars (e.g., ssrf-via-user-input, sql-injection-string-concat).

  4. Compose rule.yml — exact structure:

    yaml
    rules:
      - id: <rule_id>
        message: <one-line human-readable description, ≤120 chars>
        severity: <ERROR | WARNING | INFO>
        languages: [<language>]
        metadata:
          category: security
          cwe: "<CWE-XXX: full CWE name>"
          owasp: "<A0X:2021 - Category Name>"
          confidence: <HIGH | MEDIUM | LOW>
          likelihood: <HIGH | MEDIUM | LOW>
          impact: <HIGH | MEDIUM | LOW>
          references:
            - https://cwe.mitre.org/data/definitions/<CWE_NUMBER>.html
        pattern-either:
          - pattern: <generalized pattern matching bad_code_example>
        # pattern-not:
        #   - pattern: <pattern matching good_code_example, if provided>
  5. Compose tests.md — Markdown with two fenced code blocks:

    markdown
    # Tests for <rule_id>
    
    ## Should match (vulnerable)
    
    ```<language>
    <bad_code_example, formatted>

    The rule should flag this with severity <chosen>.

    Should NOT match (safe)

    <good_code_example or LLM-inferred safe variant>

    This is the recommended way to write the same logic.

  6. Compose README.md — Markdown explanation:

    markdown
    # <rule_id>
    
    **Severity**: <ERROR/WARNING/INFO>
    **CWE**: <CWE-XXX>
    **OWASP**: <A0X:2021 - Category>
    
    ## What this rule catches
    
    <2-3 sentence plain-English explanation>
    
    ## Why it matters
    
    <1-2 sentences on the actual security impact, drawing from the cve_description>
    
    ## How to fix
    
    <1-2 sentences pointing at the safe pattern>
    
    ## References
    
    - [CWE-XXX](https://cwe.mitre.org/data/definitions/XXX.html)
    - [OWASP A0X:2021](https://owasp.org/Top10/A0X_2021-...)
  7. Write all three files in order: rule.yml, tests.md, README.md via write_artifact.

  8. Return structured output:

    • rule_id: the full id (e.g., custom.ssrf-via-user-input)
    • severity: ERROR / WARNING / INFO
    • cwe: e.g., CWE-918 (the identifier alone, no description)
    • summary: one-line summary suitable for a security rule index

Style

  • Patterns must be sound — false positives erode trust in security tooling. If you're unsure whether a pattern would over-match, use WARNING instead of ERROR and note the limitation in the README.
  • The message field appears in the developer's IDE/CI output. It should be a complete sentence.
  • Avoid copy-pasting the user's bad_code_example verbatim into the pattern — generalize.
  • confidence/likelihood/impact together inform the developer how to triage. Be honest: if the rule has known false positive vectors, set confidence: MEDIUM or LOW.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Semgrep Rule Creator AI skill do?

Generate a complete Semgrep rule bundle (rule.yml + tests.md + README.md) from a CVE description and a bad-code example. Picks an appropriate severity, infers the right CWE/OWASP mapping, and produces a ready-to-commit rule with documentation. Use when asked to draft a Semgrep rule, encode a security pattern, or productize a security finding for the codebase.

Why use Semgrep Rule Creator on TypingMind?

Because you install it once and use it with any model. Semgrep Rule Creator is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Semgrep Rule Creator in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/skrun-dev/skrun/tree/main/agents/semgrep-rule-creator. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Semgrep Rule Creator?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Semgrep Rule Creator?

As many as you like. As long as a model supports skills, you can use Semgrep Rule Creator with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Semgrep Rule Creator AI skill free?

Yes. It is published on GitHub by skrun-dev under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇