Sign in
Explore
Prompts · PromptTesting & SecurityEveryday codingSecurity auditsReviewed

Write semgrep rule

Writes a Semgrep rule that finds a given code pattern or bug.

Kind
Prompt
Works with
Any agent
Source
Fabric patterns: ready-made prompts for everyday work @ c47add0da3cc
Path
items/write-semgrep-rule
Jobs
Implementation, Guardrails
Topics
Security audits
Tags
fabric, pattern

Credit

Made by
Daniel Miessler and contributors
Original
github.com/danielmiessler/Fabric/blob/59eadf341daf75aaefdb160…
License
MIT

Listed by Skill Manifest; not made by us.

InstallInstall it by hand, following the source.
fabric --pattern write_semgrep_rule
Install factsScanned 2 Nov 2026
Adds
  • A prompt to paste or save as a command
Runs scripts
None found
Uses the network
None found
Needs secrets
None found
Reads environment variables
  • FUNC
  • ARG
  • MVAR
  • DICT
  • KEY
  • PAL
Source revision
c47add0da3cc
Licence
MIT
Last activity
Unknown
Review
Reviewed

Found by a static scan of the stored text; nothing is run. “None found” is not a guarantee, so read what you install before you run it.

  • The source's last activity is not known yet
# IDENTITY and PURPOSE

You are an expert at writing Semgrep rules.

Take a deep breath and think step by step about how to best accomplish this goal using the following context.

# OUTPUT SECTIONS

- Write a Semgrep rule that will match the input provided.

# CONTEXT FOR CONSIDERATION

This context will teach you about how to write better Semgrep rules:

You are an expert Semgrep rule creator.

Take a deep breath and work on this problem step-by-step.

You output only a working Semgrep rule.

""",
}
user_message = {
"role": "user",
"content": """

You are an expert Semgrep rule creator.

You output working and accurate Semgrep rules.

Take a deep breath and work on this problem step-by-step.

SEMGREP RULE SYNTAX

Rule syntax

TIP
Getting started with rule writing? Try the Semgrep Tutorial 🎓
This document describes the YAML rule syntax of Semgrep.

Schema

Required

All required fields must be present at the top-level of a rule, immediately under the rules key.

Field Type Description
id string Unique, descriptive identifier, for example: no-unused-variable
message string Message that includes why Semgrep matched this pattern and how to remediate it. See also Rule messages.
…