xiaohongshu
xiaohongshu
dr-rule-builder
Use this skill when the user needs help creating, testing, validating, or troubleshooting Detection & Response (D&R) rules in LimaCharlie.
Full skill instructions
This skill helps you create, test, and validate Detection & Response (D&R) rules in LimaCharlie. Use this when users ask for help with rule creation, rule debugging, or understanding D&R rule syntax.
Detection & Response (D&R) rules are serverless functions that run in the LimaCharlie cloud, applied in real-time to sensor data. They allow you to detect behaviors, automatically respond, create alerts, trigger remediation, and chain detections.
Rules are evaluated per-event. When a rule's detection component matches, the response component executes.
detect:
event: NEW_PROCESS
op: ends with
path: event/FILE_PATH
value: calc.exe
case sensitive: false
respond:
- action: report
name: Calculator Launched
Key Components:
detect: What to look forrespond: What to do when matcheddetect:
event: EVENT_TYPE # Event to monitor
op: OPERATOR # Matching logic
# ... criteria
respond:
- action: ACTION_TYPE
# ... parameters
Required:
detect: Must have event (or target) and oprespond: Array of actions (minimum one)is - Exact equality
op: is
path: event/PROCESS_ID
value: 9999
exists - Element presence (optional truthy: true for non-null/non-empty)
op: exists
path: event/PARENT
contains - Substring match (optional count: N)
op: contains
path: event/COMMAND_LINE
value: powershell
starts with / ends with - Prefix/suffix match
op: ends with
path: event/FILE_PATH
value: .exe
case sensitive: false
matches - Regular expression (Go syntax)
op: matches
path: event/FILE_PATH
re: .*\\system32\\.*\.scr
case sensitive: false
is greater than / is lower than - Numeric comparison (optional length of: true)
op: is greater than
path: event/NETWORK_ACTIVITY/BYTES_SENT
value: 1048576
and / or - Combine rules
op: and
rules:
- op: ends with
path: event/FILE_PATH
value: /sshd
- op: is public address
path: event/NETWORK_ACTIVITY/SOURCE/IP_ADDRESS
not - Invert result (add not: true to any operator)
op: is
not: true
path: event/PROCESS_ID
value: 9999
is platform - Platform detection
op: is platform
name: windows # windows, linux, macos, ios, android, chrome, etc.
is windows / is 32 bit / is 64 bit / is arm - Architecture shortcuts
op: is windows
is tagged - Tag presence
op: is tagged
tag: vip
is public address / is private address - RFC 1918 checks
op: is public address
path: event/NETWORK_ACTIVITY/SOURCE/IP_ADDRESS
cidr - Network mask matching
op: cidr
path: event/NETWORK_ACTIVITY/SOURCE/IP_ADDRESS
cidr: 10.16.1.0/24
lookup - Threat feed/resource lookup
op: lookup
path: event/DOMAIN_NAME
resource: hive://lookup/malwaredomains
case sensitive: false
scope - Limit to sub-path (crucial for arrays)
op: scope
path: event/NETWORK_ACTIVITY/
rule:
op: and
rules:
- op: starts with
path: event/SOURCE/IP_ADDRESS
value: '10.'
- op: is
path: event/DESTINATION/PORT
value: 445
string distance - Levenshtein distance for typosquatting
op: string distance
path: event/DOMAIN_NAME
value: example.com
max: 2
For complete operator reference, see REFERENCE.md.
Event Data (use event/ prefix):
path: event/FILE_PATH
path: event/COMMAND_LINE
path: event/PROCESS_ID
path: event/DOMAIN_NAME
Routing Metadata (use routing/ prefix):
path: routing/sid # Sensor ID
path: routing/hostname # Host name
path: routing/event_type # Event type
path: routing/event_time # Timestamp
Array Navigation (use ? wildcard):
path: event/NETWORK_ACTIVITY/?/IP_ADDRESS # any element
path: event/NETWORK_ACTIVITY/0/IP_ADDRESS # first element
report - Create detection/alert
- action: report
name: my-detection-name
priority: 3 # 1-5 severity
metadata: # optional context
author: security-team
mitre: T1059.001
detect_data: # optional structured extraction
domain: "{{ .event.DOMAIN_NAME }}"
Template support: "{{ .event.FILE_PATH }}"
Internal only (D&R chaining): prefix name with __
task - Send sensor command
- action: task
command: history_dump
investigation: inv-id
Common commands: history_dump, deny_tree <<routing/this>>, segregate_network, yara_scan hive://yara/rule --pid "{{ .event.PROCESS_ID }}"
add tag / remove tag - Tag management
- action: add tag
tag: vip
ttl: 30 # optional expiration
isolate network / rejoin network - Network isolation (persists across reboots)
- action: isolate network
For complete action reference, see REFERENCE.md.
Track relationships between events over time.
with child - Direct children only
event: NEW_PROCESS
op: ends with
path: event/FILE_PATH
value: cmd.exe
with child:
op: ends with
event: NEW_PROCESS
path: event/FILE_PATH
value: calc.exe
Detects: cmd.exe -> calc.exe (NOT cmd.exe -> firefox.exe -> calc.exe)
with descendant - Any descendant
with descendant:
# same syntax as with child
Detects: cmd.exe -> calc.exe AND cmd.exe -> firefox.exe -> calc.exe
with events - Event repetition
event: WEL
op: is windows
with events:
event: WEL
op: is
path: event/EVENT/System/EventID
value: '4625' # failed login
count: 5 # occurrences
within: 60 # seconds
Counting: Add count and within parameters to stateful rules
Report Control: Add report latest event: true to report child instead of parent
Stateless Mode: Add is stateless: true inside stateful context to require all conditions match same event
Example Patterns:
For 25+ complete rule examples with full code, see EXAMPLES.md.
Control action execution frequency.
Limit Frequency
- action: report
name: my-detection
suppression:
max_count: 1 # execute max once
period: 1h # per hour
is_global: true # across org (false = per sensor)
keys:
- '{{ .event.FILE_PATH }}'
Threshold Activation
suppression:
min_count: 3 # must match 3 times
max_count: 3 # then execute once
period: 24h
Practical: Prevent Duplicate Sensor Commands
- action: task
command: yara_scan hive://yara/rule --pid "{{ .event.PROCESS_ID }}"
suppression:
is_global: false
keys:
- '{{ .event.PROCESS_ID }}'
max_count: 1
period: 1m
Time formats: ns, us, ms, s, m, h
# Validate syntax
limacharlie replay --validate --rule-content my-rule.yaml
# Test with events
limacharlie replay --rule-content my-rule.yaml --events test-event.json
# Test historical (single sensor)
limacharlie replay --sid SENSOR_ID --last-seconds 3600 --rule-content my-rule.yaml
# Test historical (org-wide)
limacharlie replay --entire-org --last-seconds 604800 --rule-content my-rule.yaml
Add unit tests in rule file under tests: section with match: and non_match: arrays.
For complete testing guide including trace mode and debugging, see TROUBLESHOOTING.md.
Performance
False Positive Management
case sensitive: false for paths/domainsnot: true to exclude known good pathsRule Organization
detect_data to extract key fieldsCommon Event Types: NEW_PROCESS, NETWORK_CONNECTIONS, DNS_REQUEST, FILE_TYPE_ACCESSED, CODE_IDENTITY, WEL
Operator Categories:
is, exists, contains, starts with, ends with, matchesand, or, notis greater than, is lower thanis public address, is private address, cidris platform, is windows, is taggedwith child, with descendant, with eventsAction Types: report, task, add tag, remove tag, isolate network, rejoin network, output
Template Variables: {{ .event.* }}, {{ .routing.* }}, {{ .detect.* }} (in reports)
limacharlie dr list # List rules
limacharlie dr add --rule-name NAME --rule-file FILE # Add rule
limacharlie dr delete --rule-name NAME # Delete rule
limacharlie replay --validate --rule-content FILE # Validate
limacharlie replay --rule-content FILE --events FILE # Test
This skill provides comprehensive guidance for creating effective D&R rules. Always encourage testing and validation before production deployment.
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience