Examples
Practical sqry queries organized by common developer workflows. All queries using relation fields (callers:, callees:, imports:) require a pre-built index (sqry index .).
Code Review
Before merging a change to a shared function, find every caller to assess the blast radius.
# Find all callers of a function you are about to change
sqry query "callers:process_order"
# Find all usages of a symbol (combines callers and imports)
sqry query "callers:shared_utility"
sqry query "imports:shared_utility"
# Check impact depth — how many symbols transitively depend on this one
sqry impact "shared_utility" --depth 3 --show-files
Refactoring
Understand what breaks if you rename or remove a function before making the change.
# Find everything that calls the function you want to rename
sqry query "callers:legacy_function"
# Trace call paths from entry points to the function
sqry graph trace-path "main" "legacy_function"
# After the change, diff the symbol graph to verify what changed
sqry diff main HEAD
Onboarding
Navigate an unfamiliar codebase by mapping its structure and finding entry points.
# Get an overview of the codebase's size and structure
sqry graph stats
# Find the main entry point(s)
sqry query "name:main AND kind:function"
# List the top-level modules
sqry query "kind:module" --limit 20
# Find all authentication-related functions
sqry query "kind:function AND path:src/auth/**"
# List the public API surface
sqry query "kind:function AND visibility:public" --limit 20
# Understand a specific module's structure
sqry query "kind:function AND path:src/api/**"
Dead Code
Find symbols that are defined but never called or imported anywhere.
# All unused symbols
sqry unused
# Unused public/exported symbols (the most impactful to remove)
sqry unused --scope public
# Unused Rust functions specifically
sqry unused --scope function --lang rust
# Preview what would be removed without acting on it
sqry unused --scope public --json | jq 'map(.name)'
Architecture Analysis
Analyze dependency structure and detect problematic patterns like circular dependencies.
# Show the full dependency tree for a module
sqry graph dependency-tree "auth_module"
# Find the call depth (complexity indicator) for a function
sqry graph call-chain-depth "process_request"
# Detect all call cycles in the codebase
sqry cycles
# Detect import cycles only
sqry cycles --type imports
# Check whether a specific symbol is part of a cycle
sqry graph is-in-cycle "build_graph"
# Export a visual dependency diagram (Mermaid format, renders in GitHub/GitLab)
sqry visualize "imports:*" --format mermaid --output-file deps.mmd
Testing
Find test functions, measure coverage gaps, and locate public functions that lack tests.
# Find all test functions
sqry query "name~=/^test_/"
# Find test functions in a specific module
sqry query "name~=/^test_/ AND path:tests/**"
# Find public functions that are never called by test code
# (step 1: get all public functions)
sqry query "kind:function AND visibility:public" --json > public_fns.json
# (step 2: find test callers — absence of test callers indicates missing coverage)
sqry query "callers:process_order AND path:tests/**"
# Find all functions whose name contains "test"
sqry query "kind:function AND name~=/test/"
Semantic Diff
Compare structural changes between git refs — see what symbols were added, removed, modified, or renamed, not just text diffs.
# Diff between main and current HEAD
sqry diff main HEAD
# Only show added and removed symbols
sqry diff main HEAD --change-type added,removed
# Filter to functions only
sqry diff main HEAD --kind function
# Scope to a specific directory
sqry diff main feature-branch --path src/api/
# JSON output for scripting
sqry diff main HEAD --json --limit 200
Semantic diff understands renames — if you move process_order to handle_order and the body is similar, sqry reports it as a rename rather than a deletion plus an addition.
Explain a Symbol
Get a complete summary of a symbol: its signature, documentation, callers, callees, and containing scope — all in one command.
# Explain a function with full context
sqry explain src/auth/middleware.rs validate_token
# Without code context (just relations)
sqry explain src/auth/middleware.rs validate_token --no-context
# Without relations (just signature and docs)
sqry explain src/auth/middleware.rs validate_token --no-relations
The output includes:
- Symbol name, kind, visibility, and language
- File location (path, line, column)
- Signature and documentation (if available)
- Direct callers and callees
- Containing scope (parent class/module)
Find Similar Symbols
Find symbols with similar names or signatures to a reference symbol, useful for discovering related implementations or inconsistent naming.
# Find symbols similar to "authenticate"
sqry similar src/auth/service.ts authenticate
# Adjust similarity threshold (0.0–1.0, default 0.75)
sqry similar src/auth/service.ts authenticate --threshold 0.6
# Limit results
sqry similar src/auth/service.ts authenticate --limit 20
Impact Analysis
Assess the blast radius of changing a symbol — find everything that transitively depends on it.
# Direct dependents only
sqry impact process_order --direct-only
# Transitive dependents up to depth 3
sqry impact process_order --depth 3
# Include file-level grouping
sqry impact process_order --depth 3 --show-files
# Limit output
sqry impact process_order --depth 4 --limit 50
Cross-Language
Detect calls across language boundaries, including FFI links, HTTP calls, and SQL table access.
# List all detected cross-language relationships
sqry graph cross-language
# Rust FFI calls to C/C++ functions
sqry graph cross-language --from-lang rust --edge-type ffi
# JavaScript/TypeScript HTTP calls to Python/Go/Java route handlers
sqry graph cross-language --edge-type http
# SQL table reads and writes
sqry graph cross-language --from-lang sql --edge-type table
# Dart MethodChannel invocations (Flutter platform channels)
sqry graph cross-language --from-lang dart --edge-type channel_invoke
# Export as JSON for scripting
sqry graph --format json cross-language