detection-authoring
БесплатноЗапускает вложенные скриптыНе проверенCreate, deploy, update, and manage custom detection rules in Microsoft Defender XDR via the Graph API (/beta/security/rules/detectionRules), or hand the…
от SCStelz★ 256 звёзд на GitHubОб этом скилле
Custom Detection Authoring — Instructions
Purpose
This skill deploys custom detection rules to Microsoft Defender XDR via the Microsoft Graph API (/beta/security/rules/detectionRules). It handles:
- Query adaptation — Converting Sentinel KQL queries into custom detection format
- Wizard-link hand-off — Turning a validated manifest rule into a prefilled Detection Wizard link the analyst reviews and Saves (no Graph consent, no tenant change by the agent)
- Single-rule deployment — Creating one rule via Graph API
- Batch deployment — Deploying multiple rules from a JSON manifest
- Lifecycle management — Listing, updating, enabling/disabling, and deleting rules
- Validation — Dry-run queries in Advanced Hunting before deployment
Entity Type: Custom detection rules (Defender XDR)
Starting from threat intelligence? A Microsoft Perception threat-intelligence report (via
perception-extract-threat-intel) lists TTPs with Detection opportunity and Telemetry; use a TTP row as the seed forkql-query-authoring, then author the rule here (manifest + wizard link).
Writing new detection queries from scratch? This skill focuses on deploying and managing detection rules — not query creation. If you need to write detection KQL from scratch (schema validation, community examples, performance optimization), use the kql-query-authoring skill first with CD intent markers (say "create custom detection queries for [scenario]"). It will produce Sentinel-format queries with
cd-metadatablocks ready for this skill to adapt and deploy.
📑 TABLE OF CONTENTS
- Prerequisites — Auth, scopes, PowerShell modules
- Critical Rules — Mandatory constraints (includes query adaptation checklist)
- Naming Convention — Standardized
displayNameformat (no prefixes, no MITRE IDs, colon separators) - API Reference — Graph API schema and field values
- Frequency & Lookback — Schedule periods, lookback windows, NRT constraints
- Deployment Paths — Graph API script vs prefilled Detection Wizard link
- Deployment Workflow — Step-by-step process
- Batch Deployment — Manifest-driven multi-rule deployment
- Lifecycle Management — CRUD operations
- Existing Rule Discovery — Search Analytic Rules & Custom Detections by table, EventID, or keyword
- Known Pitfalls — Lessons learned (20 pitfalls documented)
- CD Metadata Contract — Schema for query file ↔ detection skill coordination
Prerequisites
Required PowerShell Module
# Microsoft.Graph.Authentication — provides Invoke-MgGraphRequest
Install-Module Microsoft.Graph.Authentication -Scope CurrentUser
Required Graph API Scopes
| Operation | Scope | Type |
|---|---|---|
| List / Get rules | CustomDetection.Read.All |
Delegated |
| Create / Update / Delete | CustomDetection.ReadWrite.All |
Delegated |
Authentication
# Read-only
Connect-MgGraph -Scopes "CustomDetection.Read.All" -NoWelcome
# Full CRUD
Connect-MgGraph -Scopes "CustomDetection.ReadWrite.All" -NoWelcome
Why
Invoke-MgGraphRequest? The Graph MCP server andaz restboth return 403 for custom detection endpoints — they lack theCustomDetection.*scopes.Invoke-MgGraphRequestuses interactive delegated auth with consent, which works.
Companion Script
Deploy-CustomDetections.ps1 — PowerShell script for manifest-driven batch deployment. See Batch Deployment.
wizard_link.py — Python helper (stdlib only, no Graph scopes) that validates a manifest rule and builds a prefilled Detection Wizard link. See Deployment Paths.
⚠️ CRITICAL RULES — READ FIRST ⚠️
Mandatory Query Requirements
Custom detection queries have strict requirements that differ from Sentinel analytic rules:
| Requirement | Detail |
|---|---|
| 🔴 Author-only by default | The default behavior is to author, validate, and write the manifest only — do NOT call the Graph API to deploy rules unless the user explicitly says "deploy", "create the rule", "push to Defender", or similar deployment-intent language. If deployment intent is ambiguous, ask before calling the API. Generating a Detection Wizard link (see Deployment Paths) changes no tenant state and is allowed in author mode. |
| Timestamp column must be projected as-is | The query MUST project the timestamp c |
Установить detection-authoring в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл detection-authoring?
Create, deploy, update, and manage custom detection rules in Microsoft Defender XDR via the Graph API (/beta/security/rules/detectionRules), or hand the analyst a prefilled Detection Wizard link to review and Save. Covers query adaptation from Sentinel KQL to custom detection format, deployment via PowerShell (Invoke-MgGraphRequest), manifest-driven batch deployment, wizard-link generation/validation (wizard_link.py), and lifecycle management (list, enable/disable, delete). Companion scripts: Deploy-CustomDetections.ps1, wizard_link.py.
Как установить скилл detection-authoring?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл detection-authoring запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic