kql
KQL language expertise for writing correct, efficient Kusto Query Language queries.
Skill by microsoftOfficial
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/microsoft-kql
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: cloud, data, writing
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/kql
What's inside
- Skill name
kql- Description
- KQL language expertise for writing correct, efficient Kusto Query Language queries. Covers syntax gotchas, join patterns, dynamic types, datetime pitfalls, regex patterns, serialization, memory management, result-size discipline, and advanced functions (geo, vector, graph). USE THIS SKILL whenever writing, debugging, or reviewing KQL queries — even simple ones — because the gotchas section prevents the most common errors that waste tool calls and cause expensive retry cascades. Trigger on: KQL, Kusto, ADX, Azure Data Explorer, Fabric Real-Time Intelligence, EventHouse, Log Analytics, log analysis, data exploration, time series, anomaly detection, summarize, where clause, join, extend, project, let statement, parse operator, extract function, any mention of pipe-forward query syntax.
- License
- MIT
- Instructions
- 439 lines in SKILL.md · view on GitHub
Files (5)
- SKILL.md
- advanced-patterns.md · references/
- discovery-queries.md · references/
- error-recovery.md · references/
- query-templates.md · references/
SKILL.md (first lines)
# KQL Mastery > **Try it yourself**: All `✅` examples in this skill can be run against the public help cluster: > `https://help.kusto.windows.net`, database `Samples` (contains `StormEvents`, `SimpleGraph_Nodes`/`Edges`, `nyc_taxi`, and more). ## 1. KQL Basics Kusto Query Language (KQL) is a pipe-forward query language for exploring data. It is the native query language for Azure Data Explorer (ADX), Microsoft Fabric Real-Time Intelligence (EventHouse), Azure Monitor Log Analytics, Microsoft Sentinel, and other Microsoft data services. ### Pipe-forward syntax KQL queries are a chain of operators separated by `|`. Data flows left to right: ```kql StormEvents // start with a table | where State == "TEXAS" // filter rows | summarize count() by EventType // aggregate | top 5 by count_ desc // limit results ``` ### Query vs management commands KQL has two execution planes: | Plane | Starts with | Examples | |-------|-------------|----------| | **Query** | Table name, `let`, `print`, `datatable` | `StormEvents \| where State == "TEXAS"` | | **Management** | `.show`, `.create`, `.set`, `.drop`, `.alter` | `.show tables`, `.show table T schema` | Management commands can be followed by query operators (the output is tabular), but the entire request runs on the management plane. You cannot start with a query and pipe into a management command. ```kql // ✅ WORKS — management command piped to query operators .show tables | project TableName | where TableName has "Events" // ❌ WRONG — query piped into management command StormEvents | take 5 | .show tables ``` When in doubt: if the first token starts with `.`, it's a management command. For a full catalog of schema exploration commands, see `references/discovery-queries.md`. ## 2. Dynamic Type Discipline KQL's `dynamic` type is flexible but strict in certain contexts. A common mistake is using a dynamic column in `summarize by`, `order by`, or `join on` without casting. **The rule**: Any time you use a dynamic-typed column in `by`, `on`, or `order by`, wrap it in an explicit cast. ```kql // ❌ ERROR: "Summarize group key ... is of a 'dynamic' type" StormEvents | summarize count() by StormSummary.Details.Location // ✅ FIX StormEvents | summarize count() by tostring(StormSummary.Details.Location) ``` ```kql // ❌ ERROR: "order operator: key can't be of dynamic type" StormEvents | order by StormSummary.TotalDamages desc // ✅ FIX StormEvents | order by tolong(StormSummary.TotalDamages) desc ``` ```kql // ❌ ERROR in join: dynamic join key StormEvents | join kind=inner (PopulationData) on $left.StormSummary == $right.State // ✅ FIX — cast both sides StormEvents | extend State_str = tostring(StormSummary.Details.Location) | join kind=inner (PopulationData) on $left.State_str == $right.State ``` **Self-correction**: When you see "is of a 'dynamic' type" in an error, add `tostring()`, `tolong()`, or `todouble()`. ## 3. Join Patterns & Pitfalls KQL joins have constraints that differ from SQL. ### Equality only KQL join conditions support **only `==`**. No `<`, `>`, `!=`, or function calls in join predicates. ```kql // ❌ ERROR: "Only equality is allowed in this context" StormEvents | join (nyc_taxi) on geo_distance_2points(BeginLon, BeginLat, pickup_longitude, pickup_latitude) < 1000 // ✅ WORKAROUND — pre-bucket into spatial cells, then join on cell ID StormEvents | extend cell = geo_point_to_s2cell(BeginLon, BeginLat, 8) | join kind=inner (nyc_taxi | extend cell = geo_point_to_s2cell(pickup_longitude, pickup_latitude, 8)) on cell ``` For range joins, pre-bin values: `| extend bin_val = bin(Value, 100)`, then join on `bin_val`. Note: values near bin boundaries may land in adjacent bins — consider checking neighboring bins or overlapping the range for precision. ### Left/right attribute matching Both sides of a join `on` clause must reference **column entities only** — not expressions, not aggregates. ```kql // ❌ ERROR: "for each left attribute, right attribute should be selected" StormEvents | join kind=inner (PopulationData) on $left.State // ✅ FIX — specify both sides explicitly StormEvents | join kind=inner (PopulationData) on $left.State == $right.State ``` ### Cardinality check before large joins **Always** check cardinality before joining tables with >10K rows. A cross-join explosion was the source of the single `E_RUNAWAY_QUERY` error (25K × 195 = potential 4.8M rows). ```kql // Before joining, check how many rows each side contributes StormEvents | summarize dcount(State) // → 67 distinct states PopulationData | summarize dcount(State) // → 52 — safe to join ``` ## 4. Regex in KQL KQL handles regex natively — no need for Python. ### The `extract_all` gotcha
From microsoft/skills, MIT.
More from microsoft/skills
- 0.651score
skill-creator
microsoftOfficial
Guide for creating effective skills for AI coding agents working with Azure SDKs and Microsoft Foundry services.
SkillBFreshness: B★ 3.1KClaude Code +9 - 0.643score
azure-search-nav
MicrosoftOfficial
Builds an Azure portal deep link to a specific blade/menu item for supported Microsoft.ContainerService, Microsoft.Kubernetes, and Microsoft.Compute resources…
SkillAFreshness: A★ 3.1KClaude Code +9 - 0.643score
azure-compliance
MicrosoftOfficial
Run Azure compliance and security audits with azqr plus Key Vault expiration checks.
SkillAFreshness: A★ 3.1KClaude Code +9 - 0.643score
aks-known-issues
MicrosoftOfficial
Lookup documented AKS fixes only when the prompt includes an exact catalog signature and all of its qualifiers: VMCannotFitEphemeralOSDisk…
SkillAFreshness: A★ 3.1KClaude Code +9 - 0.643score
aks-gpu-inference
MicrosoftOfficial
Diagnose Day-2 AKS GPU and KAITO incidents using profile-aware, read-only evidence.
SkillAFreshness: A★ 3.1KClaude Code +9 - 0.643score
foundry-iq
MicrosoftOfficial
Foundry IQ knowledge bases.
SkillAFreshness: A★ 3.1KClaude Code +9 - 0.643score
aks-network-capture
MicrosoftOfficial
Collects bounded packet captures from AKS nodes and Azure network configuration for wire-level evidence.
SkillAFreshness: A★ 3.1KClaude Code +9 - 0.643score
azure-app-onboard
MicrosoftOfficial
End-to-end orchestrator: from a business idea, app idea, or existing app to running Azure deployment with cost estimates and pre-deploy approval.
SkillAFreshness: A★ 3.1KClaude Code +9 - 0.643score
azure-prepare
MicrosoftOfficial
Prepare azd-based Azure projects for deployment: generates azure.yaml, infrastructure (Bicep/Terraform), and Dockerfiles for the Azure Developer CLI (azd)…
SkillAFreshness: A★ 3.1KClaude Code +9 - 0.643score
azure-kubernetes
MicrosoftOfficial
Plan, create, and configure production-ready Azure Kubernetes Service (AKS) clusters.
SkillAFreshness: A★ 3.1KClaude Code +9 - 0.643score
appinsights-instrumentation
MicrosoftOfficial
Guidance for instrumenting webapps with Azure Application Insights.
SkillAFreshness: A★ 3.1KClaude Code +9 - 0.643score
aks-troubleshooting
MicrosoftOfficial
Debug live Azure Kubernetes Service (AKS) incidents with a read-only, evidence-first investigation.
SkillAFreshness: A★ 3.1KClaude Code +9
Signals
- Stars
- 3,145
- Forks
- 354
- Open issues
- 26
- Contributors
- 32
- Last commit (this folder)
- Apr 15, 2026 (6 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/microsoft/skills
- Website
- microsoft.github.io/skills/
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from microsoft
- 0.714score
skillopt-sleep
microsoftOfficial
Reference-only OpenClaw adaptation of SkillOpt-Sleep.
SkillAFreshness: A★ 18.7KClaude Code +9 - 0.707score
Playwright MCP
microsoftOfficial
Playwright Tools.
ConnectorAFreshness: ALocal★ 38.6KClaude Code +5 - 0.687score
squad
microsoftOfficial
Squad's command catalog and interactive menu.
SkillAFreshness: A★ 1.4KClaude Code +9 - 0.687score
coordinator-response-mode
microsoftOfficial
Selecting WHO handles work is the Routing table; selecting HOW they handle it (Direct, Lightweight, Standard, Full) is Response Mode.
SkillAFreshness: A★ 1.4KClaude Code +9 - 0.687score
coordinator-source-of-truth
microsoftOfficial
The complete file-by-file source-of-truth hierarchy for Squad: which files are authoritative, which are derived/append-only, who may write each one, who may…
SkillAFreshness: A★ 1.4KClaude Code +9 - 0.687score
squad-commands
microsoftOfficial
Categorized catalog of common Squad operations.
SkillAFreshness: A★ 1.4KClaude Code +9
Cite this page
kql skill. Agent Mart. https://agentmart.dev/skills/microsoft-kql (last updated 2026-10-24)