kql-query-authoring

Generate validated KQL queries for Microsoft Sentinel, Defender XDR, and Azure Data Explorer.

231|64|Updated Dec 16, 2025
One-click install
npx skills add https://github.com/SCStelz/security-investigator --skill kql-query-authoring
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kql-query-authoring
Source: https://github.com/SCStelz/security-investigator/tree/main/.github/skills/kql-query-authoring
Command: npx skills add https://github.com/SCStelz/security-investigator --skill kql-query-authoring

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps analysts and developers generate validated, production-ready KQL queries for Microsoft Sentinel, Defender XDR, and Azure Data Explorer, reducing guesswork and speeding investigations.

Core Features & Use Cases

  • Schema-driven query generation: Ensure correct table names and column types through MCP-based schema validation.
  • Official patterns & community examples: Leverage Microsoft Learn code samples and real-world queries to produce robust results.
  • Multi-platform readiness: Generate queries compatible with Sentinel and Defender XDR, with guidance for platform-specific differences.
  • Use Case: Create a query to detect failed sign-ins within the last 24 hours across a chosen table and adapt to your environment.

Quick Start

Use the kql-query-authoring skill to rapidly generate a ready-to-run KQL query for your target table and platform.

Frequently Asked Questions about kql-query-authoring

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate production-ready KQL queries for Microsoft Sentinel?

Generating production-ready KQL queries for Microsoft Sentinel involves using schema validation and official Microsoft Learn patterns to ensure correct table names, validate column types, and return ready-to-run queries with testing guidance.

How does schema validation work for KQL queries in Defender XDR?

Schema validation for KQL queries in Defender XDR works by leveraging MCP servers to check table names and column types, ensuring the generated query is structurally sound and compatible before execution.

Do I need MCP servers to validate Azure Data Explorer KQL queries?

Yes, you need MCP servers to validate Azure Data Explorer KQL queries, as the skill enforces MCP-based schema checks as a prerequisite to ensure correct table names and column types before returning the final query.

Can I use the same KQL query across Microsoft Sentinel and Defender XDR?

You can generate queries compatible with both Sentinel and Defender XDR, but the skill provides specific guidance to adapt for platform-specific differences to ensure the KQL runs correctly in each environment.

What is the best way to write a KQL query to detect failed sign-ins in the last 24 hours?

The best way to write a KQL query for failed sign-ins in the last 24 hours is to use schema-driven generation that applies official Microsoft Learn code samples and community examples to target your specific environment table.