Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

d-and-r-rules

БесплатноБез исполняемых скриптовНе проверен

Working with Detection & Response rules in LimaCharlie — AI-assisted generation, validation, unit testing, historical replay, deployment, FP rules, stateful…

refractionPOINTот refractionPOINT★ 32 звезды на GitHub

Об этом скилле

D&R Rules

How to work with Detection & Response rules in LimaCharlie. This covers rule generation, validation, testing, deployment, stateful rules, behavioral detection patterns, suppression, alternate targets, and response actions.

Critical Rule: NEVER Write D&R Rules Manually

D&R rule syntax is validated against organization-specific schemas. Manual YAML will fail validation. Always use AI generation commands.

Rule Generation

Generate Detection Component

limacharlie ai generate-detection --description "Detect NEW_PROCESS events where the command line contains '-enc' and the process is powershell.exe" --oid <oid> --output yaml

Generate Response Component

limacharlie ai generate-response --description "Report the detection with priority 8, add tag 'encoded-powershell' with 7 day TTL" --oid <oid> --output yaml

Common Response Actions

Action Description
report Create a detection (alert)
tag Add/remove sensor tags
task Send command to sensor
isolate network Persistent network isolation (survives reboot)
rejoin network Remove network isolation
seal / unseal Tamper-resistance for the EDR
add var / del var Set/remove sensor variables
extension request Call an extension asynchronously
start ai agent Spawn AI session
output Forward event to a specific output
wait Delay before next action (max 1 minute)

Validation

Always validate before deploying. Write YAML to temp files, then validate:

cat > /tmp/detect.yaml << 'EOF'
<detection_yaml>
EOF
cat > /tmp/respond.yaml << 'EOF'
<response_yaml>
EOF
limacharlie dr validate --detect /tmp/detect.yaml --respond /tmp/respond.yaml --oid <oid>

Unit Testing

Test rules against crafted sample events:

# Write combined rule file
cat > /tmp/rule.yaml << 'EOF'
detect:
  <detection>
respond:
  <response>
EOF

# Write test events
cat > /tmp/events.json << 'EOF'
[
  {
    "routing": {"event_type": "NEW_PROCESS"},
    "event": {
      "COMMAND_LINE": "powershell.exe -enc SGVsbG8=",
      "FILE_PATH": "C:\\Windows\\System32\\powershell.exe"
    }
  }
]
EOF

limacharlie dr test --input-file /tmp/rule.yaml --events /tmp/events.json --trace --oid <oid> --output yaml

Create both positive tests (MUST match) and negative tests (MUST NOT match).

Historical Replay

Test rules against real historical data. Save the rule first under a temporary name, disabled so it never runs live:

# Save as a disabled temporary rule
limacharlie dr set --key temp-test-rule --input-file /tmp/rule.yaml --disabled --oid <oid>

# Calculate time range
start=$(date -d '1 hour ago' +%s) && end=$(date +%s)

# Estimate volume first (dry run)
limacharlie dr replay --name temp-test-rule --start $start --end $end --selector '"prod" in tags' --dry-run --oid <oid> --output yaml

# Run replay, scoped to the sensors the rule targets (always pass --selector or --sid)
limacharlie dr replay --name temp-test-rule --start $start --end $end --selector '"prod" in tags' --oid <oid> --output yaml

# Clean up temporary rule
limacharlie dr delete --key temp-test-rule --confirm --oid <oid>

Use the same scope as the rule: an org-wide replay tests a different rule, and a large one can stop at the server's deadline. Before reading results, check the replay was complete: stats.results_partial: true, a stats.stop_reason other than empty or none, a non-empty stats.skipped_events or an error mean the results cover only part of the window. A partial replay with 0 matches is inconclusive; narrow the scope or the window and re-run.

Deployment

Create/Update a Rule

cat > /tmp/rule.yaml << 'EOF'
detect:
  <validated_detection>
respond:
  <validated_response>
EOF
limacharlie dr set --key <rule-name> --input-file /tmp/rule.yaml --oid <oid>

Enable a new rule in stages rather than on its whole scope at once: first on one canary sensor (an is tagged condition on a canary tag) with only the report action, then the full target scope still with report only, then the other response actions. Check the volume with limacharlie detection list --cat <detection-name> --start <ts> --end <ts> --oid <oid> after each stage. The detection-engineering skill (Phase 5) has the full procedure.

List Rules

limacharlie dr list --oid <oid> --output yaml

Get a Rule

limacharlie dr get --key <rule-name> --oid <oid> --output yaml

Delete a Rule

limacharlie dr delete --key <rule-name> --confirm --oid <oid>

Rule Hive Namespaces

D&R rules are stored across three hives:

Hive Description How Added
dr-general Custom rules you create limacharlie dr set
dr-managed Managed rules from subscribed rulesets Automatic from subscriptions
dr-services Service-provided rules From extensions/service
Полный SKILL.md на GitHub

Установить d-and-r-rules в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Bash
Read

FAQ

Что делает скилл d-and-r-rules?

Working with Detection & Response rules in LimaCharlie — AI-assisted generation, validation, unit testing, historical replay, deployment, FP rules, stateful rules, behavioral detection patterns, suppression, alternate detection targets, and response actions. Use when creating, testing, modifying, or managing D&R rules, false positive rules, or understanding detection patterns.

Как установить скилл d-and-r-rules?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл d-and-r-rules запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить d-and-r-rules с