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/"

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