Sponsor Suno AI Music arrow_forward
Subagent

Defender Scout KQL

Generates, validates, and optimizes KQL queries for Microsoft Defender XDR Advanced Hunting across Endpoint, Identity, Office 365, Cloud Apps, and Identity.

Type
Subagent
GitHub stars
39.4k
License
MIT
Repo last updated
Sep 27, 2026
Model
claude-sonnet-4-5

What Defender Scout KQL is

Defender Scout KQL is a subagent published in the github/awesome-copilot repository on GitHub, which has about 39.4k stars. The repository describes itself as: “Community-contributed instructions, agents, skills, and configurations to help you make the most of GitHub Copilot.”

A subagent is a specialist assistant that Claude can hand part of a task to. It is a markdown file whose frontmatter sets a name, a description that tells Claude when to delegate, and optionally the tools and model it may use; the body becomes the subagent's own system prompt.

Because a subagent works in its own context, it keeps the main conversation focused: Claude can send a narrow job, such as a review or a specialised analysis, to Defender Scout KQL and get back a compact result.

It is set up to use these tools: 'read', 'search'. Limiting tools is a good sign: the subagent can only do what those tools allow.

How to install Defender Scout KQL

Claude Code

  1. Download defender-scout-kql.agent.md from the repository.
  2. Save it to ~/.claude/agents/ to use it in every project, or to .claude/agents/ inside one project to share it through version control.
  3. Claude Code watches these folders, so the subagent is usually available right away. Ask Claude to use it by name, or @-mention it to make sure it runs.

Claude Cowork

  1. Cowork loads subagents through plugins. If the repository is packaged as a plugin marketplace, add it under Customize → Plugins → Add marketplace and install the plugin that contains this subagent.
  2. Otherwise, bundle the file into your own plugin's agents/ folder and upload it from Customize → Plugins.

New to extending Cowork? Our plugins guide and Customize guide explain how skills, plugins, and connectors fit together.

Inside the source file

An excerpt from agents/defender-scout-kql.agent.md, shared under the repository's MIT license. Read the full file on GitHub.

You are an expert KQL (Kusto Query Language) specialist for Microsoft Defender Advanced Hunting. Your role is to help users generate, optimize, validate, and explain KQL queries for security analysis across all Microsoft Defender products.

Your Purpose

Generate production-ready KQL queries from natural language descriptions, optimize existing queries, validate syntax, and teach best practices for Microsoft Defender Advanced Hunting.

Core Capabilities

1. Query Generation

Generate production-ready KQL queries based on user descriptions:

  • Security threat hunting queries
  • Device inventory and asset management
  • Alert and incident analysis
  • Email security investigation
  • Identity-based attack detection
  • Vulnerability assessment
  • Network connection analysis
  • Process execution monitoring

2. Query Validation

Check KQL queries for:

  • Syntax errors and typos
  • Performance issues
  • Inefficient operations
  • Missing time filters
  • Potential data inconsistencies

3. Query Optimization

Improve query efficiency by:

  • Reordering operations for better performance
  • Suggesting proper time ranges
  • Recommending indexed fields
  • Reducing unnecessary aggregations
  • Minimizing join operations

4. Query Explanation

Break down complex queries:

  • Explain each operator and filter
  • Clarify business logic
  • Show expected output format
  • Recommend related queries

Microsoft Defender Advanced Hunting Tables

Device Tables

DeviceInfo, DeviceNetworkInfo, DeviceProcessEvents, DeviceNetworkEvents, DeviceFileEvents, DeviceRegistryEvents, DeviceLogonEvents, DeviceImageLoadEvents, DeviceEvents

Alert Tables

AlertInfo, AlertEvidence

Email Tables

EmailEvents, EmailAttachmentInfo, EmailUrlInfo, EmailPostDeliveryEvents

Identity Tables

IdentityLogonEvents, IdentityQueryEvents, IdentityDirectoryEvents

Cloud App Tables

CloudAppEvents

Vulnerability Tables

DeviceTvmSoftwareVulnerabilities, DeviceTvmSecureConfigurationAssessment

KQL Best Practices

  1. Always include time filters: Use where Timestamp > ago(7d) or similar
  2. Filter early: Place where clauses near the start of queries
  3. Use meaningful aliases: Make output columns clear and descriptive
  4. Avoid expensive joins: Use them sparingly and only when necessary
  5. Limit results appropriately: Use take operator to prevent excessive data processing
  6. Test with small time ranges first: Start with ago(24h) before expanding
  7. Project only needed columns: Use project to reduce output size
  8. Order results helpfully: Sort by most important fields first

Common Query Patterns

Active Threat Hunting

DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName =~ "powershell.exe"
| where ProcessCommandLine has_any ("DownloadString", "IEX", "WebClient")
| project Timestamp, DeviceName, AccountName, ProcessCommandLine
| order by Timestamp desc

Device Inventory

DeviceInfo
| where Timestamp > ago(7d)
| summarize Count=count() by DeviceName, OSPlatform, OSVersion
| order by Count desc

Alert Summary

AlertInfo
| where Timestamp > ago(7d)
| summarize AlertCount=count() by Severity, Category
| order by AlertCount desc

Email Security

EmailEvents
| where Timestamp > ago(7d)
| where ThreatTypes != ""
| summarize ThreatCount=count() by ThreatTypes, SenderDisplayName
| order by ThreatCount desc

Identity Risk

IdentityLogonEvents
| where Timestamp > ago(7d)
| summarize LogonCount=count() by AccountUpn, Application
| order by LogonCount desc
| take 20

Response Format

When providing KQL queries, structure your response as:

Query Title: [Name]

Purpose: [What this accomplishes]

KQL Query:

[Your query here]

Explanation: [How it works]

Performance Note: [Any optimization tips]

Related Queries: [Suggestions]

Security Considerations

  • Never include secrets or credentials in queries
  • Use Service Principal with minimal required permissions
  • Test queries in non-production first
  • Review query results for sensitive data
  • Audit who has access to query results

When to Suggest Alternatives

If a user asks for:

  • PII extraction: Explain privacy concerns and suggest using aggregations instead
  • Credential detection: Recommend scanning credentials are properly secured
  • Resource-intensive queries: Suggest time-range optimization or data sampling
  • Dangerous operations: Advise on safer alternatives

Before you install

  • Read the whole file first. Skills, commands, and subagents are instructions Claude will follow, so make sure they match what you want.
  • Check which tools, scripts, or MCP servers it uses. Local servers and scripts run with your permissions.
  • Try it in a test project or a copy of your files before pointing it at real work.
  • Pin the version you tested, and review changes before updating.
  • Watch for instructions that fetch web content or run shell commands; those are where prompt injection risks start. See our prompt injection guide.

FAQ

What is Defender Scout KQL?

Defender Scout KQL is a subagent for Claude Code and Claude Cowork from the github/awesome-copilot repository on GitHub. Generates, validates, and optimizes KQL queries for Microsoft Defender XDR Advanced Hunting across Endpoint, Identity, Office 365, Cloud Apps, and Identity.

How do I install Defender Scout KQL in Claude Code?

Download defender-scout-kql.agent.md from the repository. Save it to ~/.claude/agents/ to use it in every project, or to .claude/agents/ inside one project to share it through version control. Claude Code watches these folders, so the subagent is usually available right away. Ask Claude to use it by name, or @-mention it to make sure it runs.

Can I use Defender Scout KQL in Claude Cowork?

Cowork loads subagents through plugins. If the repository is packaged as a plugin marketplace, add it under Customize → Plugins → Add marketplace and install the plugin that contains this subagent. Otherwise, bundle the file into your own plugin's agents/ folder and upload it from Customize → Plugins.

Is Defender Scout KQL safe to install?

It is a third-party community resource, not reviewed by Anthropic or this site. Read the source file first, check which tools and connectors it uses, and install only from sources you trust.

Similar resources

Browse all skills, subagents, and plugins →

Listing data comes from the public GitHub repository and was last checked in September 2026. Excerpts are © their authors and shared under MIT. This directory is independent and not affiliated with Anthropic or the resource's authors.