meltedinhex/analyst-ai-pack / skills/writing-sigma-detection-rules
writing-sigma-detection-rules
VerifiedConverts 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 portable SIEM detection logic.
| File | Kind | Size |
|---|---|---|
| LICENSE | other | 340 B |
| SKILL.md | skill md | 3.1 KB |
| references/api-reference.md | markdown | 1.2 KB |
| scripts/analyst.py | script | 2.0 KB |
scripts/analyst.py
View on GitHub#!/usr/bin/env python3
"""Scaffold a valid Sigma detection rule skeleton.
Emits a Sigma YAML rule with a pinned logsource, a selection/filter pattern, ATT&CK tags, level,
and a falsepositives list for the analyst to complete. It emits text only; it does not validate
or convert (use sigma-cli for that).
"""
from __future__ import annotations
import argparse
import datetime as _dt
import sys
def scaffold(title: str, category: str, technique: str, level: str, author: str) -> str:
today = _dt.date.today().isoformat()
tag = technique.lower().replace("t", "attack.t", 1) if technique.startswith("T") else technique
return f"""title: {title}
id: <generate-a-uuid>
status: experimental
description: Detects {title.lower()} (drafted from a hunt finding).
author: {author}
date: {today}
references:
- <analysis report or hunt link>
logsource:
product: windows
category: {category}
detection:
selection:
Image|endswith: '\\powershell.exe'
CommandLine|contains:
- '-enc'
- 'FromBase64String'
filter_known_good:
ParentImage|endswith:
- '\\trusted_admin_tool.exe'
condition: selection and not filter_known_good
falsepositives:
- Administrative scripts that legitimately use encoded commands
level: {level}
tags:
- {tag}
"""
def main(argv: list[str] | None = None) -> int:
parser = argparse.ArgumentParser(description="Scaffold a Sigma rule")
sub = parser.add_subparsers(dest="cmd", required=True)
p = sub.add_parser("scaffold")
p.add_argument("--title", required=True)
p.add_argument("--category", default="process_creation")
p.add_argument("--technique", default="T1059.001")
p.add_argument("--level", default="high",
choices=["informational", "low", "medium", "high", "critical"])
p.add_argument("--author", default="analyst-ai-pack")
args = parser.parse_args(argv)
print(scaffold(args.title, args.category, args.technique, args.level, args.author))
return 0
if __name__ == "__main__":
sys.exit(main())
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |