skills/security-detection-engineering/SKILL.md
Guide for authoring custom detection rules — from threat hypothesis through rule creation, testing, and tuning with KQL, EQL, ES|QL, and threshold rules.
npx skillsauth add patrykkopycinski/elastic-cursor-plugin security-detection-engineeringInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Guide the user through creating custom detection rules tailored to their environment.
Use when the user asks to:
Also activates on keywords: "detection rule", "custom rule", "EQL sequence", "threshold rule", "MITRE detection", "rule authoring"
Do NOT use when:
security-full-setup)security-alert-triage)Call get_cluster_context to get cached cluster awareness — version, health, installed features, and detection engine capabilities. This determines which rule types are supported and what data sources are available.
Ask the user what they want to detect:
Call discover_security_data with relevant data_sources filter to confirm the required data exists.
Present:
Based on the use case, recommend the appropriate rule type:
Explain the trade-offs and let the user confirm.
Help the user write the detection query:
For KQL:
Test with esql_query using a translated query, or use elasticsearch_api to run the KQL against the target index.
For EQL:
sequence by host.name with maxspan=5m
[process where event.action == "start" and process.name == "powershell.exe"]
[network where destination.port == 443]
For ES|QL:
Test with esql_query:
FROM logs-endpoint* | WHERE event.action == "start" AND process.name == "powershell.exe" | STATS count = COUNT(*) BY host.name | WHERE count > 10
For Threshold: Define the field to aggregate, the threshold value, and the group-by fields.
Run the query against real data using elasticsearch_api or esql_query:
Present results and iterate if needed.
Ask the user to confirm or adjust:
Call manage_detection_rules with operation: "create" and the full rule configuration.
After creation, monitor for initial alerts:
triage_alerts to check for new alerts from this ruleIf tuning is needed:
kibana_api with POST /api/detection_engine/rules/<id>/exceptionsPresent:
get_cluster_context — cached cluster awareness (version, health, capabilities)discover_security_data — verify data source availabilitymanage_detection_rules — create and manage detection rulestriage_alerts — check for alerts from the new ruleelasticsearch_api — test KQL/EQL queries against real dataesql_query — test ES|QL detection querieskibana_api — advanced rule management and exception creationelastic://docs/api/kibana — Detection Engine API for rules, exceptionselastic://docs/api/security — Security API referenceES_URL and ES_API_KEY configuredKIBANA_URL configured for rule managementInteractive Dashboard: When using Claude Desktop or other ext-apps hosts,
manage_detection_rulesrenders an interactive detection rules dashboard with rule status, severity filters, and bulk actions. Usemitre_coverage_heatmapfor visual ATT&CK coverage analysis. In Cursor/CLI, both return markdown.
security-full-setup — complete security setup including bulk rule enablementsecurity-threat-hunting — proactive hunting that may lead to new detection rulestesting
Interactive threat hunting workflow using ES|QL and Elasticsearch queries — from hypothesis formulation through data exploration, IOC search, and finding documentation.
testing
Start your security session with a personalized briefing — attacks, alerts, cases, rules, threat intel. Use as the first thing when starting security work.
testing
Interactive guide for complete Elastic Security setup — discovers data sources, assesses detection coverage, configures rules, and creates security dashboards.
testing
Guide for creating and managing security investigation cases — from case creation through alert attachment, investigation tracking, and resolution.