kql-query-authoring
БесплатноБез исполняемых скриптовНе проверенUse this skill when asked to write, create, or help with KQL (Kusto Query Language) queries for Microsoft Sentinel, Defender XDR, or Azure Data Explorer…
Об этом скилле
KQL Query Authoring - Instructions
Purpose
Generate validated, production-ready KQL queries by combining schema validation (331+ indexed tables), Microsoft Learn documentation, community examples, and performance best practices.
Prerequisites
Required MCP Servers:
KQL Search MCP Server — Schema validation, query examples, table discovery
- Install:
npm install -g kql-search-mcp(npm)
- Install:
Microsoft Docs MCP Server — Official Microsoft Learn documentation and code samples
- GitHub: MicrosoftDocs/mcp
Verification: Tools should be available as mcp_kql-search_* and mcp_microsoft-lea_*.
⚠️ Known Issues
search_favorite_repos Bug (v1.0.5)
❌ Broken — ERROR_TYPE_QUERY_PARSING_FATAL. Use mcp_kql-search_search_github_examples_fallback instead.
⚠️ CRITICAL WORKFLOW RULES - READ FIRST ⚠️
Validate table schema FIRST —
mcp_kql-search_get_table_schemato verify table exists, column names, and data types.Check platform schema — Sentinel uses
TimeGenerated; Defender XDR usesTimestamp. Microsoft Learn examples default to XDR syntax — always convert before testing on Sentinel.Check local query library FIRST — Use the discovery manifest (
.github/manifests/discovery-manifest.yaml) for domain/MITRE lookups andgrep_searchfor table-name/keyword lookups. See the KQL Pre-Flight Checklist incopilot-instructions.mdfor the full priority order.Query file structure: NO placeholder TOC — When creating a new query file, do NOT add a
## Quick Reference — Query Indexheading or placeholder.scripts/generate_tocs.pycreates the heading and table itself. Pre-creating it confuses the strip-and-reinsert logic and produces duplicated content. See## Creating Query Filesbelow for full file structure rules.Use multiple sources — Schema (authoritative column names) + Microsoft Learn (official patterns) + community queries (real-world examples).
Test using the correct execution tool — Follow the Tool Selection Rule in
copilot-instructions.md:- Sentinel-native tables → Data Lake or AH
- XDR tables ≤ 30d → Advanced Hunting (free); > 30d → Data Lake
- XDR-only tables (DeviceTvm*, Exposure*) → Advanced Hunting only
- Adapt timestamp column when switching tools
Test queries before presenting to user — Run with
| take 5via live execution. Usemcp_kql-search_validate_kql_queryas fallback if live testing unavailable.Provide context — Explain what the query does, expected results, and any limitations.
Read the complete workflow below before starting.
📋 Inherited rules: This skill inherits the KQL Pre-Flight Checklist, Tool Selection Rule (Data Lake vs Advanced Hunting), and Known Table Pitfalls from
copilot-instructions.md. Those rules are authoritative — do not contradict them here.
Query Authoring Workflow
Step 1: Understand User Requirements
Extract key information:
- Table(s) needed: Which data source? (e.g.,
EntraIdSignInEvents,EmailEvents,SecurityAlert) - Time range: How far back? (e.g., last 7 days, specific date range)
- Filters: What specific conditions? (e.g., user, IP, threat type)
- Output: Statistics, detailed records, time series, aggregations?
- Platform: Sentinel or Defender XDR? (affects column names)
- Deployment target: Custom detection rule? (see below)
Custom Detection Intent Detection:
If the user mentions "custom detection", "detection rule", "deploy as detection", "CD rule", "author detections for", or "deploy to Defender":
- Read the detection-authoring skill (
.github/skills/detection-authoring/SKILL.md) — Critical Rules and CD Metadata Contract sections - Design queries with CD constraints — row-level output, mandatory columns (
TimeGenerated,DeviceName,ReportId), no baresummarize - Include
cd-metadatablocks in the output file (see Step 8) - Still write queries in Sentinel format (with
letvariables, 7d lookback) — adaptation to CD format happens at deployment time via the detection-authoring skill
Step 2: Check Local Query Library
Search for existing verified queries before writing from scratch. Use two complementary methods:
- Manifest lookup (domain/MITRE): Read
.github/manifests/discovery-manifest.yamland match by domain tag (e.g.,identity,endpoint,email) or MITRE technique ID (e.g.,T1078,T1566). Best when you know the security domain or ATT&CK technique. - Targeted
grep_search(table/keyword):grep_searchfor the specific table name (e.g.,CloudAppEvents,OfficeActivity) or operation keyword (e.g.,New-InboxRule,SecretGet) scoped toqueries/**and.github/skills/**. The manifest lacks table-name and keyword field
Установить kql-query-authoring в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл kql-query-authoring?
Use this skill when asked to write, create, or help with KQL (Kusto Query Language) queries for Microsoft Sentinel, Defender XDR, or Azure Data Explorer. Triggers on keywords like "write KQL", "create KQL query", "help with KQL", "query [table]", "KQL for [scenario]", or when a user requests queries for specific data analysis scenarios. This skill uses schema validation, Microsoft Learn documentation, and community examples to generate production-ready KQL queries.
Как установить скилл kql-query-authoring?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл kql-query-authoring запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic