semgrep-rule-creator

semgrep-rule-creator is a skill for Claude Code from CraftOS-dev/CraftBot. It costs 37 tokens per session (1,729 once invoked), scanned A, a copy of semgrep-rule-creator, MIT.

A guide for creating custom Semgrep rules, which are code checks that find security vulnerabilities, bug patterns, or unwanted coding patterns. It also covers testing and validating those rules.

In plain words
What is it for?
Use it to write Semgrep rules for security issues, data-flow vulnerabilities, bug patterns, coding standards, and their test cases.
Why use it?
It helps avoid rules that miss real problems or flag safe code by requiring checks for both vulnerable and safe examples.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Good fit Use it to write Semgrep rules for security issues, data-flow vulnerabilities, bug patterns, coding standards, and their test cases.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/craftos-dev/craftbot/semgrep-rule-creator
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.

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

Made for: Claude Code.

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/craftos-dev/craftbot/semgrep-rule-creator/github.svg)](https://agentmods.dev/skills/craftos-dev/craftbot/semgrep-rule-creator)
Your own site
<a href="https://agentmods.dev/skills/craftos-dev/craftbot/semgrep-rule-creator"><img src="https://agentmods.dev/badge/skills/craftos-dev/craftbot/semgrep-rule-creator/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for semgrep-rule-creator

Your own site · 80×15
<a href="https://agentmods.dev/skills/craftos-dev/craftbot/semgrep-rule-creator"><img src="https://agentmods.dev/badge/skills/craftos-dev/craftbot/semgrep-rule-creator.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 37 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,729 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin 86% copy Near-identical to another mod 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.1 $0.00037 $0.01729
Opus 5.5 $0.00015 $0.00692
Sonnet 5.5 $0.00007 $0.00346
Haiku 4.5 $0.00004 $0.00173

Measured 1mo ago against content hash e915f8b04351, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

semgrep-rule-creator scanned grade A with 1 finding 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 1mo ago.

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.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

pattern: os.system("rm " + $VAR)
Origin

This is a copy

86% identical to semgrep-rule-creator — 26 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

skills/semgrep-rule-creator/SKILL.md · 166 lines

How it starts

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

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:

# BAD: Matches any function call
pattern: $FUNC(...)

# GOOD: Specific dangerous function
pattern: eval(...)

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

# BAD: Only tests vulnerable case
# ruleid: my-rule
dangerous(user_input)

# GOOD: Include safe cases to verify no false positives
# ruleid: my-rule
dangerous(user_input)

# ok: my-rule
dangerous(sanitize(user_input))

# ok: my-rule
dangerous("hardcoded_safe_value")

Read the full file on GitHub · 166 lines

Files

What ships with it

2 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. 1mo ago First seen · 166 lines · 37 tokens per session scan A e915f8b04351

Subscribe to this mod's changes

semgrep-rule-creator is a skill published in the GitHub repository CraftOS-dev/CraftBot (399 stars, last pushed today), licensed MIT. It adds 37 tokens to every session and 1,729 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 1 finding (runs shell commands). It is 86% identical to semgrep-rule-creator, differing in 26 lines, and is treated as a copy.

Related

Other skills, from other repositories

conductor-implement

Execute tasks from a track's implementation plan following TDD workflow.

rmyndharis/antigravity-skills · 17 tokens

principle-test-behavior-not-implementation

Apply when you write, change, or keep a test. Assert what the code's users can observe, so that the test fails when that behavior breaks and keeps passing when only the internals change.

michael-denyer/pstack-claude · 50 tokens

python

Python development with ruff, mypy, pytest - TDD and type safety.

alinaqi/maggy · 18 tokens

etl-stabilization

Phase-based orchestrator for fixing SnowConvert ETL conversion gaps in ETL-to-Snowflake migrations (SSIS, Informatica, and other platforms). Analyzes units holistically, creates a ROADMAP with test strategies, and executes fixes through phased TDD with cross-phase learning. Use when user says "fix ETL unit", "fix SSIS…

sfc-gh-dflippo/snowflake-dbt-demo · 154 tokens

tdd

Drive a change through a red-green-refactor loop - failing test first, minimal code to pass, then clean up. Use when implementing a feature or fixing a bug where correctness matters and a test can pin the behavior. Says "TDD", "test first", "red green refactor", "write the test first".

rohitg00/pro-workflow · 68 tokens

bug-fix

Regression-first TDD bug fix workflow with real tests. Use when: fixing bugs, resolving regressions, addressing runtime errors, debugging failures, or when the user reports something broken. Triggers on words like: bug, broken, error, crash, regression, not working, fix.

bluebear-io/angry-bear · 61 tokens