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
- Repository
- github/awesome-copilot
- GitHub stars
- 39.4k
- License
- MIT
- Repo last updated
- Sep 27, 2026
- Source file
- agents/defender-scout-kql.agent.md
- 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
- 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.
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.
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
- Always include time filters: Use where Timestamp > ago(7d) or similar
- Filter early: Place where clauses near the start of queries
- Use meaningful aliases: Make output columns clear and descriptive
- Avoid expensive joins: Use them sparingly and only when necessary
- Limit results appropriately: Use take operator to prevent excessive data processing
- Test with small time ranges first: Start with ago(24h) before expanding
- Project only needed columns: Use project to reduce output size
- 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 descDevice Inventory
DeviceInfo
| where Timestamp > ago(7d)
| summarize Count=count() by DeviceName, OSPlatform, OSVersion
| order by Count descAlert Summary
AlertInfo
| where Timestamp > ago(7d)
| summarize AlertCount=count() by Severity, Category
| order by AlertCount descEmail Security
EmailEvents
| where Timestamp > ago(7d)
| where ThreatTypes != ""
| summarize ThreatCount=count() by ThreatTypes, SenderDisplayName
| order by ThreatCount descIdentity Risk
IdentityLogonEvents
| where Timestamp > ago(7d)
| summarize LogonCount=count() by AccountUpn, Application
| order by LogonCount desc
| take 20Response 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
- Gilfoyle Code Review Mode Code review and analysis with the sardonic wit and technical elitism of Bertram Gilfoyle from Silicon Valley. Prepare for brutal honesty about your code. Subagent · github/awesome-copilot
- GitHub Actions Expert GitHub Actions specialist focused on secure CI/CD workflows, action pinning, OIDC authentication, permissions least privilege, and supply-chain security Subagent · github/awesome-copilot
- Go Mcp Development Complete toolkit for building Model Context Protocol (MCP) servers in Go using the official github.com/modelcontextprotocol/go-sdk.… Plugin · github/awesome-copilot
- GPT 5 Beast Mode Beast Mode 2.0: A powerful autonomous agent tuned specifically for GPT-5 that can solve complex problems by using tools, conducting… Subagent · github/awesome-copilot
- Demonstrate Understanding mode instructions Validate user understanding of code, design patterns, and implementation details through guided questioning. Subagent · github/awesome-copilot
- Debug Mode Instructions Debug your application to find and fix a bug Subagent · github/awesome-copilot
- Devils Advocate I play the devil's advocate to challenge and stress-test your ideas by finding flaws, risks, and edge cases Subagent · github/awesome-copilot
- Debian Linux Expert Debian Linux specialist focused on stable system administration, apt-based package management, and Debian policy-aligned practices. Subagent · github/awesome-copilot