Writing sigma detection rules

From meltedinhex/analyst-ai-pack · View interactive version

Writing sigma detection rules is an AI agent skill from the GitHub repository meltedinhex/analyst-ai-pack. Converts hunt findings into portable Sigma detection rules: choosing the right logsource, expressing robust selection/filter logic, setting level and ATT&CK tags, and validating before converting to a SIEM query. Activates for requests to write a Sigma rule, convert a hunt to a detection, or create

How to use this skill

Skill file

Writing Sigma Detection Rules

When to Use

Do not use Sigma for stateful/correlation logic it cannot express well (complex sequence or

statistical detections) — keep those in the SIEM's native correlation engine.

Prerequisites

Workflow

Step 1: Define the logsource

Pin category/product/service precisely (e.g., product: windows,

category: process_creation) so the rule maps to the right pipeline.

Step 2: Write robust selection logic

Express the detection on stable fields. Prefer multiple ANDed conditions over a single brittle

string; use contains/endswith modifiers thoughtfully to resist evasion.

python scripts/analyst.py scaffold --title "Encoded PowerShell" --category process_creation \
  --technique T1059.001 --level high

Step 3: Add filters to cut false positives

Use a filter block (negated in the condition) to exclude known-good processes/paths rather

than narrowing selection until it misses variants.

Step 4: Tag and document

Add tags (ATT&CK technique), level, status, references, and a falsepositives list so

consumers can tune.

Step 5: Validate and convert

Lint the rule, then convert to the target backend and test against true/false-positive data

before deploying.

sigma convert -t splunk rules/encoded_powershell.yml

Validation

Pitfalls

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.