/secskills-defense:writing-sigma-rulesfrom secskills-defense
Authors and maintains Sigma detection rules with logsource taxonomy, detection logic, and backend conversion. Useful for translating threat intel into portable detection and building detection-as-code pipelines.
Ships in secskills-defense. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Sigma is the common language for detection logic -- write once, convert to any SIEM. The value is portability and reviewability, but only if the rule is precise: a Sigma rule that matches everything is worse than no rule, because it consumes analyst time and trains the team to ignore alerts. The work is specificity without brittleness.
engineering-detectionswriting-yara-ruleshunting-threatsresponding-to-incidentsEvery rule is a YAML document with these fields in order:
The specification requires only three fields: title, logsource, and
detection (which must contain a condition). Everything else is optional
to the spec. Do not confuse that with the SigmaHQ rule repository, which
requires far more — id, status, description, author, date, level,
and ATT&CK tags — before it will accept a contribution. Write to the stricter
SigmaHQ convention by default, because a rule without an id or a level is
unmanageable in a real pipeline, but know which constraint you are meeting when
a converter accepts a rule your reviewer rejects.
title: Short Descriptive Name # REQUIRED by spec, max ~100 chars
id: a1b2c3d4-0000-4000-8000-000000000001 # optional to spec; UUIDv4, never reuse
related: # optional, link to predecessor rules
- id: <uuid>
type: derived | obsoletes | merged | renamed | similar
status: experimental # optional; see lifecycle below
description: > # optional to spec, expected by SigmaHQ
Detects X behaviour consistent with Y technique.
references: # optional, strongly recommended
- https://attack.mitre.org/techniques/T1059/001/
author: Your Name # optional to spec
date: 2026-07-26 # optional; ISO 8601 YYYY-MM-DD
modified: 2026-07-26 # optional; same format, on update
tags: # optional to spec, expected by SigmaHQ
- attack.execution # tactic (lowercase, dotted)
- attack.t1059.001 # technique (lowercase)
logsource: # REQUIRED by spec
category: process_creation
product: windows
detection: # REQUIRED by spec
selection:
CommandLine|contains: 'some-indicator'
condition: selection # REQUIRED inside detection
falsepositives: # optional to spec
- Legitimate admin scripts using the same flag
level: medium # optional; informational|low|medium|high|critical
Date format. The spec mandates ISO 8601 with hyphens — YYYY-MM-DD. Older
rules and much online material use the legacy YYYY/MM/DD; that form is
outdated, and some tooling now rejects it.
Status lifecycle. The permitted values are experimental, test,
stable, deprecated, and unsupported. In practice: experimental =
observation only, no alerting. test = validated against emulation, ready for
limited deployment. stable = tuned in production with documented FPs.
deprecated = replaced, no longer accurate. unsupported = not usable as
written (e.g. depends on homemade fields). Never promote without the
corresponding work.
The logsource block abstracts the data source. Specify only what is needed.
Categories: process_creation, file_event, file_access,
network_connection, registry_event, dns_query, image_load,
pipe_created, process_access, driver_load, create_remote_thread.
Product: windows, linux, macos.
Service: sysmon, security, system, powershell, powershell-classic,
application, taskscheduler, windefend, firewall-as.
Use category when you care about the event type regardless of collection
method. Use product + service when targeting a specific log channel.
Do not combine category and service unless the backend requires it.
Define what to match (selection), what to exclude (filter_*), combine in
condition:
detection:
selection:
ParentImage|endswith: '\explorer.exe'
CommandLine|contains|all:
- 'powershell'
- '-enc'
filter_legitimate:
CommandLine|contains: 'company-deploy-script'
User|startswith: 'SVC_'
condition: selection and not filter_legitimate
condition: selection # simple match
condition: selection and not filter # match minus exclusions
condition: selection1 or selection2 # either pattern
condition: (sel1 and sel2) and not (fp1 or fp2)
condition: all of selection* # all blocks starting with "selection"
condition: 1 of selection* # any one block
Match against the full log event (all fields). Blunt instrument -- prefer field-specific selections for production rules:
detection:
keywords:
- 'Invoke-Mimikatz'
- 'sekurlsa::logonpasswords'
condition: keywords
Chain with |. Example: CommandLine|contains|all.
| Modifier | Effect |
|---|---|
contains | Substring match |
startswith / endswith | Prefix / suffix match |
re | Regular expression (PCRE) |
base64offset | Match base64-encoded variants at all three offsets |
all | All list values must match (default is any) |
cidr | CIDR network range match on IP fields |
windash | Match both - and / as argument prefix |
expand | Expand environment variables like %SystemRoot% |
wide / utf16le / utf16be / utf16 | Match the wide (UTF-16) encoding of the value; wide is an alias for utf16le. There is no utf8 modifier |
exists | Field present (true) or absent (false) |
detection:
selection:
CommandLine|contains|windash|all: ['bypass', 'hidden', 'noprofile']
filter_admin:
ParentImage|endswith: ['\sccm.exe', '\intune_agent.exe']
condition: selection and not filter_admin
detection:
selection:
ParentImage|endswith: '\winword.exe'
Image|endswith: ['\cmd.exe', '\powershell.exe', '\wscript.exe', '\mshta.exe']
condition: selection
detection:
selection:
TargetFilename|contains: ['\AppData\Local\Temp\', '\ProgramData\', '\Users\Public\']
TargetFilename|endswith: ['.exe', '.dll', '.scr', '.hta']
condition: selection
detection:
selection:
TargetObject|contains: ['\CurrentVersion\Run\', '\CurrentVersion\RunOnce\']
EventType: SetValue
filter_installers:
Image|startswith: 'C:\Windows\Installer\'
condition: selection and not filter_installers
detection:
selection:
PipeName: ['\MSSE-*', '\postex_*', '\msagent_*', '\status_*']
condition: selection
WMI: logsource product: windows, service: sysmon, match EventID: 21,
Operation: Created. Scheduled tasks: logsource category: process_creation,
match Image|endswith: '\schtasks.exe' with CommandLine|contains|all: ['/create', '/sc'], filter on SYSTEM + known management tools.
Exclusions go in named filter_* blocks, never inline with the selection.
Use condition: selection and not 1 of filter_* to apply all filters.
Filter on properties the attacker cannot control: full file paths of signed vendor binaries (not filenames alone), service account SIDs (not usernames), parent-child pairs from specific software workflows, verified certificate subjects. Never filter on filenames alone, attacker-controllable command-line fragments, or hostnames without justification.
| Level | Response expectation |
|---|---|
informational | Automated tagging, correlation input only |
low | Batch review, daily triage |
medium | Analyst queue, investigate within hours |
high | Prompt investigation, likely malicious |
critical | Immediate response, active compromise |
Set level based on expected TP rate and business impact, not on how dangerous
the technique sounds. A noisy critical rule causes more damage than a
precise medium one.
When a single event is too common to alert on, use Sigma correlation rules
that reference other rules by ID, group by a field (e.g., ComputerName),
and require a threshold within a time window:
title: Correlation - Multiple Suspicious Events from Same Host
type: correlation
rules:
- id: <uuid-of-rule-1>
- id: <uuid-of-rule-2>
group-by: [ComputerName]
timespan: 15m
condition:
gte: 2
level: high
pip install sigma-cli pySigma-backend-splunk pySigma-backend-elasticsearch \
pySigma-backend-kusto pySigma-backend-qradar
sigma convert -t splunk -p sysmon rules/rule.yml
sigma convert -t elasticsearch -p ecs_windows rules/rule.yml
sigma convert -t kusto -p microsoft_xdr rules/rule.yml
sigma convert -t qradar rules/rule.yml
sigma convert -t splunk -p sysmon rules/ # entire directory
sigma convert -t splunk -p sysmon -f savedsearches rules/ # output format
| Backend | Common pipelines |
|---|---|
| Splunk | sysmon, splunk_windows, splunk_cim |
| Elastic | ecs_windows, ecs_zeek, filebeat |
| Sentinel/XDR | microsoft_xdr, azure_monitor |
| CrowdStrike | crowdstrike |
| Chronicle | chronicle_default |
Always verify converted output against your actual field names. Pipeline defaults may not match custom parsing configurations.
sigma check rules/rule.yml # single rule
sigma check rules/ # entire directory
Common failures: missing or duplicate id, invalid level, malformed YAML,
undefined modifier, empty detection block.
hayabusa csv-timeline -d ./sample_evtx/ -r rules/rule.yml
chainsaw hunt ./sample_evtx/ -s rules/rule.yml --mapping mappings/sigma-mapping.yml
falsepositives field and the PR description.SigmaHQ requirements: valid UUIDv4 id; status set appropriately
(experimental for new); date/modified in YYYY/MM/DD; at least one
ATT&CK tag; non-empty falsepositives (even Unknown); level based on TP
rate; descriptive description; references linking to source intel.
YAML formatting: two-space indent, no tabs; pipe-separated modifiers
without spaces (field|contains|all); dash-space lists; single-quoted strings
with special characters; folded scalar (>) for long descriptions; one rule
per file, snake_case filename matching the title.
Field naming: use Sigma standard names (Image, ParentImage,
CommandLine, User, TargetFilename, TargetObject, DestinationIp,
DestinationPort, SourceIp, PipeName, Hashes). Backend conversion
handles translation. Writing backend-specific field names defeats portability.
Tag compliance: attack.<tactic> (lowercase, hyphenated) and
attack.t<number> (lowercase, dotted sub-technique). Add cve.YYYY.NNNNN
when applicable. Verify IDs against the current ATT&CK release -- stale IDs
from retired techniques create mapping errors downstream.
Fetch public advisories, specifications, and vendor reports as Markdown:
curl -sL "https://defuddle.md/<url>" # scheme in the path is optional
This strips page boilerplate — roughly 78% fewer tokens on a prose page — and returns the full text rather than a summary, so you can grep it and trust a negative result.
Three things it is not for. Fetch JSON and API responses raw, because readability extraction mangles structured data. Fetch authenticated or JavaScript-rendered pages directly, because it retrieves them anonymously. And never route adversary infrastructure (phishing links, C2, malware hosting), client-owned hosts, or engagement URLs through it — the request leaves your machine to a third party, and for live adversary infrastructure it also tips off the operator.
Some sites block the extractor and return an error blob rather than the page —
{"error":"Failed to fetch: 418 I'm a teapot"} from freedesktop.org, for
instance. That is the fetch being refused, not the source saying the thing
does not exist. Re-fetch the URL directly before drawing any conclusion from
it.
engineering-detections -- the full detection lifecycle including YARA, Suricata, and coverage measurementhunting-threats -- hypothesis-driven hunting that produces the findings rules are built frommapping-attack-techniques -- ATT&CK technique resolution and the purple-team loopreporting-security-findings -- writing up what the detection foundWhat SKILL.md sets; muted values are Claude Code's defaults
2 plugins ship this exact skill · first indexed Jul 31, 2026
22 skills in this plugin
/analyzing-disk-imagesPerform dead-disk forensics on an acquired disk image using The Sleuth Kit, Plaso, and bulk_extractor — verify integrity and mount read-only, map partitions, recover deleted files, build a file-system and super-timeline, carve unallocated space, mine registry hives and OS artifacts, and detect anti-forensics. Use when handed a .E01/.dd/.raw/.vmdk/.vhdx disk image or forensic acquisition to examine, recovering deleted files, building a file-system timeline, or carving artifacts from unallocated space./analyzing-linux-persistenceSystematically identify and analyze persistence mechanisms on Linux systems during DFIR investigations -- sweep systemd units, cron jobs, shell initialization, SSH config, kernel modules, LD_PRELOAD, package manager hooks, udev rules, container entrypoints, and XDG autostart entries. Use when investigating a compromised Linux host, performing forensic analysis of a Linux disk image, looking for backdoors or unauthorized access mechanisms, or determining how an attacker maintained access./analyzing-malwareAnalyze suspected malware safely — containment, static triage, sandboxed detonation, unpacking, capability and C2 extraction, IOC production, and YARA rule authoring. Use when handed a suspicious file, hash, or sample, when triaging an alert artifact, or when producing detection content from a specimen.npx claudepluginhub trilwu/secskills --plugin secskills-defenseOther plugins' skills for the same job