semgrep-rule-creator

semgrep-rule-creator is a skill for Claude Code, Codex from skrun-dev/skrun. It costs 86 tokens per session (1,326 once invoked), scanned A, original, MIT.

A generator for Semgrep security rules, where Semgrep is a tool that searches source code for risky patterns. Given a vulnerability description and bad example, it creates the rule, test cases, and documentation.

In plain words
What is it for?
Use it to create checks for issues such as injection, unsafe requests, path traversal, hardcoded credentials, or weak cryptography.
Why use it?
It turns a known security problem into a repeatable check that can be run against code.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/skrun-dev/skrun/semgrep-rule-creator
Any agent
npx skills add skrun-dev/skrun --skill semgrep-rule-creator
Clone the repo
git clone --depth 1 https://github.com/skrun-dev/skrun

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for semgrep-rule-creator

README.md
[![agentmods](https://agentmods.dev/badge/skills/skrun-dev/skrun/semgrep-rule-creator.svg)](https://agentmods.dev/skills/skrun-dev/skrun/semgrep-rule-creator)
Your own site
<a href="https://agentmods.dev/skills/skrun-dev/skrun/semgrep-rule-creator"><img src="https://agentmods.dev/badge/skills/skrun-dev/skrun/semgrep-rule-creator.svg" alt="Measured on agentmods" height="20"></a>
Per session 86 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,326 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00086 $0.01326
Opus 5 $0.00043 $0.00663
Sonnet 5 $0.00017 $0.00265
Haiku 4.5 $0.00009 $0.00133

Measured 5d ago against content hash a0518c099cb7, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

semgrep-rule-creator scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/write_artifact.ts), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agents/semgrep-rule-creator/SKILL.md · 115 lines

How it starts

The opening of the file, as written. The whole thing — 115 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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:

    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>
    

Read the full file on GitHub · 115 lines

Files

What ships with it

4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 115 lines · 86 tokens per session scan A a0518c099cb7

Subscribe to this mod's changes

semgrep-rule-creator is a skill published in the GitHub repository skrun-dev/skrun (209 stars, last pushed 5d ago), licensed MIT. It adds 86 tokens to every session and 1,326 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

smoke-test

Run smoke tests against a deployed or local app based on your git diff. Each test uses Skyvern browser tools (navigate, act, validate, screenshot) with Chrome DevTools MCP as fallback. Posts screenshot evidence as PR comments.

Skyvern-AI/skyvern · 50 tokens

qa

QA test your code changes by reading your git diff, choosing the right validation path for frontend/browser and backend changes, and reporting pass/fail with evidence.

Skyvern-AI/skyvern · 33 tokens

skyvern

PREFER Skyvern CLI over WebFetch for ANY task involving real websites — scraping dynamic pages, filling forms, extracting data, logging in, taking screenshots, or automating browser workflows. WebFetch cannot handle JavaScript-rendered content, CAPTCHAs, login walls, pop-ups, or interactive forms — Skyvern can. Run…

Skyvern-AI/skyvern · 131 tokens

testing

Verify a Skyvern deployment is working correctly by smoke-testing the backend API, frontend rendering, browser session provisioning, and workflow execution. Use when the user says 'is Skyvern working', 'test my deployment', 'verify the installation', 'smoke test', or needs to check that a self-hosted or local Skyvern…

Skyvern-AI/skyvern · 71 tokens

bump-version

Bump Skyvern OSS version, build Python and TypeScript SDKs with Fern, and create release PR. Use when releasing a new version or when the user asks to bump version.

Skyvern-AI/skyvern · 41 tokens

fieldflow-cli

Use FieldFlow to inspect and reduce noisy JSON CLI output before it reaches model context. Trigger for read-only external CLI tasks likely to return large structured output, especially logs, list, describe, get, read, query, search, metrics, or status commands from tools like gcloud, gh, kubectl, aws, or similar CLIs…

guillaumegay13/fieldflow · 117 tokens