Claude KQL Detections Skill
rudraverma/Claude-KQL-Skills
Expert KQL detection engineer para Sentinel & Defender XDR com MITRE mapping
Ver no GitHubSkill para Claude Code que transforma o assistente em engenheiro especializado em detecção KQL para Microsoft Sentinel e Defender XDR. Escreve regras prontas para produção com schemas verificados, mapeamento MITRE ATT&CK e 26 padrões de detecção pré-validados, incluindo identidade, endpoint, email e cloud.
Instalação
npx convez-ai rudraverma/Claude-KQL-Skills1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.
Métricas
Casos de uso
- Criar regras de detecção agendadas e NRT para Microsoft Sentinel
- Escrever detecções customizadas para Defender XDR com Advanced Hunting
- Gerar queries KQL com schemas verificados e mapeamento de entidades
- Cobrir cenários de segurança: identidade, privilege escalation, persistência, ransomware
Veredito

Skill robusto e production-ready para times de SOC e threat intelligence. Reduz significativamente o tempo de autoria de detecções verificadas em Sentinel/Defender, mas exige expertise em KQL e ecosistema Microsoft para máximo proveito.
README
A tradução para o português deste README ainda está na fila.
Overview
Claude KQL Detections Skill turns Claude Code into an expert KQL detection engineer for Microsoft Sentinel and Microsoft Defender XDR. It writes production-ready detection rules with verified table schemas, correct column names, MITRE ATT&CK mappings, entity mappings, and full YAML analytic rule output — ready to deploy to your SIEM.
Built by Rudra Verma | Senior Cyber Security Architect | CyberHawk Consultancy Authorized security research only. Unauthorized use is illegal.
What This Skill Does
- Writes KQL queries for Sentinel scheduled analytic rules, NRT rules, and Defender XDR custom detections
- Verifies table schemas before writing — never guesses column names
- Maps every detection to MITRE ATT&CK tactics and techniques
- Outputs both bare KQL (for testing) and full YAML (for deployment)
- Includes entity mappings required for Sentinel incident creation
- Provides tuning notes and recommended SOC response actions
- Covers 20+ pre-validated detection patterns across identity, endpoint, email, and cloud
Coverage
Detection Scenarios
| Category | Examples |
|---|---|
| Identity | Anonymous sign-in, brute force, password spray, impossible travel, MFA fatigue |
| Privilege | Role assignment, admin consent grant, PIM activation outside hours |
| Persistence | OAuth app granted high-privilege scope, service principal creation |
| Endpoint | Suspicious PowerShell, living-off-the-land binaries, lateral movement |
| Phishing delivery, forwarding rule creation, inbox rule abuse | |
| Cloud | Mass download from SharePoint, Azure resource deletion, new tenant federation |
| Network | Tor exit node sign-in, unfamiliar country access, impossible ASN jump |
| Ransomware | Mass file encryption signals, shadow copy deletion, VSS abuse |
Platforms
| Platform | Tables | Rule Type |
|---|---|---|
| Microsoft Sentinel | SigninLogs, AuditLogs, OfficeActivity, AzureActivity, SecurityEvent, Syslog, and 30+ more | Scheduled, NRT |
| Defender XDR | DeviceEvents, IdentityLogonEvents, EmailEvents, CloudAppEvents, AlertEvidence, and 15+ more | Custom Detection, Advanced Hunting |
| Unified Portal | Cross-platform queries combining Sentinel + Defender tables | Scheduled + Custom Detection |
Installation
Into Claude Code (global, all projects)
# Copy to your skills directory
cp -r . ~/.claude/skills/kql-detections/
Into a specific project
mkdir -p .claude/skills/kql-detections/references
cp SKILL.md .claude/skills/kql-detections/
cp references/*.md .claude/skills/kql-detections/references/
Usage
The skill auto-triggers when your conversation mentions:
KQL · Sentinel · Defender XDR · analytic rule · custom detection · advanced hunting
brute force · impossible travel · anonymous sign-in · lateral movement · persistence
password spray · MFA fatigue · OAuth abuse · ransomware detection · SIEM rule
"write a KQL" · "build a detection" · "create an analytic rule" · "detect X in Sentinel"
Or reference it explicitly:
Use the kql-detections skill to write a Sentinel rule for impossible travel
Example Use Cases
1. Identity detection:
Write a Sentinel scheduled analytic rule to detect impossible travel —
a user signing in from two countries within 1 hour. Include YAML output.
2. Endpoint detection:
Write a Defender XDR advanced hunting query to detect PowerShell
downloading a file from the internet using WebClient or Invoke-WebRequest.
Map to MITRE T1059.001.
3. Persistence detection:
Detect when an OAuth application is granted the Mail.ReadWrite scope
in Microsoft 365. I need a Sentinel analytic rule with entity mappings.
4. Ransomware detection:
Build a KQL detection for mass file rename events on Windows endpoints
that could indicate ransomware encryption. Defender XDR, high severity.
Skill Structure
kql-detections/
├── SKILL.md ← Main skill + workflow + output formats
├── README.md ← This file
├── LICENSE ← MIT
└── references/
├── sentinel-tables.md ← All major Sentinel/Log Analytics table schemas
├── defender-tables.md ← All Defender XDR advanced hunting table schemas
├── kql-syntax.md ← KQL operators, functions, performance rules
├── detection-patterns.md ← 20+ pre-validated detection recipes
└── analytic-rule-yaml.md ← Full YAML schema, ARM templates, entity mappings
How It Works
Every detection follows a 6-step workflow:
1. Clarify intent — what behaviour, which platform, what output format
2. Identify data sources — which tables hold the required telemetry
3. Verify schema — check reference files, fetch Microsoft Learn docs if needed
4. Build KQL — apply performance rules, use detection patterns where available
5. Wrap in YAML — for Sentinel rules: add MITRE, entity mappings, severity, frequency
6. Document — detection logic, false positives, tuning, recommended SOC response
Performance Rules (Enforced on Every Query)
The skill enforces 10 KQL performance rules on every detection it writes:
TimeGeneratedfilter always firstprojectearly to reduce data volumehasovercontainsfor indexed word search- No leading wildcards
- Filter before
summarizeorjoin - Specific tables — never
search *orunion * inover chainedor- No
tostring()inwherepredicates materialize()for reused subqueries- Stable schema after
bag_unpack()