Skip to content

Instantly share code, notes, and snippets.

@simianhacker
Last active October 7, 2025 00:36
Show Gist options
  • Select an option

  • Save simianhacker/60b95ad8c2b5065fb10d8005863d3609 to your computer and use it in GitHub Desktop.

Select an option

Save simianhacker/60b95ad8c2b5065fb10d8005863d3609 to your computer and use it in GitHub Desktop.

KQL Quick Reference

Fields

  • content: - Text in files (quoted: content: "auth")
  • filePath: - Paths with wildcards (NO quotes: filePath: *test*)
  • kind: - Symbol type (quoted: kind: "function_declaration")
  • language: - Language (no quotes: language: python)

Syntax Rules

Wildcards - NO QUOTES:

  • filePath: *test*
  • filePath: "*test*"

Boolean - lowercase:

  • language: python and kind: "function_declaration"
  • language: python AND kind: "function_declaration"
  • Use: and, or, not, (parentheses)

Common Kinds: function_declaration, class_declaration, interface_declaration, method_definition, call_expression

Common Patterns

By file type:

language: typescript
filePath: *.sql

By directory:

filePath: *services*
filePath: *test* and language: javascript

By symbol:

kind: "function_declaration"
kind: "class_declaration" and language: python

By content:

content: "authenticate"
"UserService" and language: typescript

Combined:

kind: "function_declaration" and content: "async" and filePath: *api*
language: python and not filePath: *test*

Strategy

  1. Start simple, add filters incrementally
  2. Use semantic search for concepts, KQL for structure
  3. If no results: remove filters, simplify query

Common Mistakes

  1. ❌ Quoting wildcards: filePath: "*test*" → ✅ filePath: *test*
  2. ❌ Uppercase operators: AND → ✅ and
  3. ❌ Missing quotes on kind: kind: function → ✅ kind: "function_declaration"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment