Skip to content

[Agent Builder] Add detection engineering prebuilt skill with tools#258362

Closed
patrykkopycinski wants to merge 2 commits intoelastic:mainfrom
patrykkopycinski:feature/detection-engineering-skill
Closed

[Agent Builder] Add detection engineering prebuilt skill with tools#258362
patrykkopycinski wants to merge 2 commits intoelastic:mainfrom
patrykkopycinski:feature/detection-engineering-skill

Conversation

@patrykkopycinski
Copy link
Copy Markdown
Contributor

@patrykkopycinski patrykkopycinski commented Mar 18, 2026

Summary

Adds a comprehensive detection engineering prebuilt skill for Agent Builder that covers the full detection lifecycle from threat analysis to production deployment and ongoing monitoring.

New registry tools (6)

  • security.find_rules — Search and filter detection rules by name, type, tags, enabled status, prebuilt/custom
  • security.manage_rules — Bulk enable, disable, or duplicate rules
  • security.preview_rule — Test rule queries (ES|QL, EQL, KQL, threshold) against live data without creating a rule
  • security.manage_exceptions — Find existing exceptions, detect overlapping conditions, prepare new exception definitions
  • security.coverage_overview — Analyze MITRE ATT&CK coverage across all rules, identify gaps and unmapped rules
  • security.rule_monitoring — Check rule execution health: errors, performance metrics, alert generation rates

Skill content

  • End-to-end detection engineering guide with 6 named workflows (A–F)
  • 9 e2e scenario examples covering: new data source onboarding, threat report response, SIEM migration, weekly/daily reports, incident response tuning, prebuilt rules lifecycle, SOC analyst bulk FP fixes
  • Rule type selection guide (KQL vs EQL vs ES|QL vs Threshold vs ML)
  • Referenced content: detection best practices, MITRE ATT&CK mapping guide
  • Integrates with existing tools: security.alerts, security.create_detection_rule, security.security_labs_search, platform.core.cases, platform.core.execute_esql, platform.core.generate_esql

All tools gated behind aiRuleCreationEnabled experimental feature flag.

Files changed

Area Files
Skill definition skills/detection_engineering/index.ts, content.ts
New tools find_rules_tool.ts, manage_rules_tool.ts, preview_rule_tool.ts, manage_exceptions_tool.ts, coverage_overview_tool.ts, rule_monitoring_tool.ts
Registration register_skills.ts, register_tools.ts, tools/index.ts
Tests 7 test files, 145 unit tests total

Test plan

  • 145 unit tests covering schema validation, tool properties, availability (feature flag on/off), and handler logic for all 6 tools + skill definition
  • TypeScript type check passes (yarn test:type_check --project)
  • ESLint passes on all changed files
  • Manual verification against a local cluster with detection rules data

Made with Cursor

Production-Readiness Checklist — Agent Skills Ecosystem

Generated against [Epic] Creation of the Agent Skills Ecosystem for Elastic Security.

Narrative role: Detection Engineering skill. Target of the vision's feedback loop ("Triage → DE: FP patterns identified, rules tuned, exceptions created, new detections authored").

Must-do before this can ship

  • Fix the 1 failing CI check
  • Add @kbn/evals suites for each of the 9 e2e scenarios — 145 unit tests alone don't satisfy the vision's measurement requirement
  • Implement the feedback loop in-bound: add a security.apply_triage_feedback tool (or equivalent) so the AI Triage skill's FP output can automatically land here as exceptions / rule tuning suggestions (with HITL approval)
  • security.preview_rule runs real ES queries — add a server-side time window + row cap guard to avoid runaway preview cost
  • coverage_overview must return a structured MITRE matrix payload (not prose), so it can be consumed by the MITRE Auto-Mapper skill (#258978)
  • Coordinate required_fields and related_integrations semantics with #260159 Data Source Catalog — today informational only, the DS catalog makes them validatable
  • Keep aiRuleCreationEnabled gating; add a kill switch path on the six new tools

Follow-ups (post-merge)

  • Land the "weekly SOC report" e2e flow as a Workflow template instead of an ad-hoc scenario
  • Publish the skill against the Skill Authoring Standard (mirroring #264378)

Adds a comprehensive detection engineering skill for Agent Builder that
covers the full detection lifecycle: threat analysis, rule creation,
MITRE ATT&CK coverage assessment, rule testing, tuning, monitoring,
prebuilt rule onboarding, and exception management.

New registry tools:
- security.find_rules — search and filter detection rules
- security.manage_rules — bulk enable/disable/duplicate rules
- security.preview_rule — test rule queries against live data
- security.manage_exceptions — find, prepare, and overlap-check exceptions
- security.coverage_overview — analyze MITRE ATT&CK coverage
- security.rule_monitoring — check rule execution health

The skill includes 9 end-to-end workflow definitions covering scenarios
from new data source onboarding to SOC analyst bulk false positive fixes,
plus reference content for rule type selection and MITRE ATT&CK mapping.

All tools are gated behind the aiRuleCreationEnabled experimental flag.
145 unit tests covering schema validation, availability, and handlers.
@patrykkopycinski
Copy link
Copy Markdown
Contributor Author

/ci

@elasticmachine
Copy link
Copy Markdown
Contributor

🤖 Jobs for this PR can be triggered through checkboxes. 🚧

ℹ️ To trigger the CI, please tick the checkbox below 👇

  • Click to trigger kibana-pull-request for this PR!
  • Click to trigger kibana-deploy-project-from-pr for this PR!
  • Click to trigger kibana-deploy-cloud-from-pr for this PR!
  • Click to trigger kibana-entity-store-performance-from-pr for this PR!
  • Click to trigger kibana-storybooks-from-pr for this PR!

…add eval suite

- Refactor 6 detection engineering tools from globally-registered BuiltinToolDefinition
  to skill-scoped BuiltinSkillBoundedTool (inline tools), preventing global tool library
  pollution when the skill is not active
- Update skill definition to accept core/logger dependencies and expose tools via
  getInlineTools instead of getRegistryTools
- Create @kbn/evals-suite-security-detection-engineering evaluation suite with:
  - Skill selection dataset (6 examples across all tool types)
  - Tool invocation dataset (5 examples validating parameter accuracy)
  - Workflow quality dataset (4 multi-step e2e scenarios)
  - Criteria + ToolCalls + Correctness + Groundedness evaluators
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants