xref

Indexes symbol definitions and references in a local SQLite cache for fast repo-wide lookups.

Updated Jul 28, 2026
One-click install
npx skills add https://github.com/vinzenz/workflows --skill xref-vinzenz
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: xref
Source: https://github.com/vinzenz/workflows/tree/main/.agents/skills/xref
Command: npx skills add https://github.com/vinzenz/workflows --skill xref-vinzenz

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Answering "where is this symbol defined" and "who calls this function" normally requires a fresh full-tree grep on every question, which is slow and token-expensive in large repositories. xref builds a per-repo SQLite index once and refreshes it incrementally, so repeated lookups during a session are nearly free. ## Core Features & Use Cases - Definition lookup: xref def <symbol> returns definition sites with path, line, kind, language, and signature for TypeScript/JavaScript, Python, Go, Rust, and shell. - Reference search: xref refs <symbol> finds word-boundary reference sites with bounded output, totals, and per-file rollups, with an option to exclude definitions. - File outline: xref file <path> lists every symbol defined in a single file as a table of contents. - Incremental caching: the index refreshes automatically by file mtime/size before every read, handles corrupt caches by rebuilding, and never walks non-git directories without an explicit xref index. - Use Case: Before a multi-file refactor, run xref refs runCli to cheaply map which files are in play, then hand off to an LSP or ast-grep for the precise rename. ## Quick Start Ask the agent to find where a function is defined and who calls it in the current repository using xref.

Frequently Asked Questions about xref

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find where a function is defined in a repo?▼

Run `xref def <symbol>` to get definition sites with path, line, kind, language, and signature. The index is built automatically on first use inside a git repository and refreshed incrementally before every read.

How do I find all callers of a function without grep?▼

Run `xref refs <symbol>` to list reference sites with a total count and per-file rollup. Use `--limit N` to bound output and `--exclude-defs` to show only call sites rather than declarations.

Which languages does xref index for definitions?▼

Definitions are extracted via regex patterns for TypeScript/JavaScript, Python, Go, Rust, and shell. Files in other languages are indexed for references only, so text matches still appear in `xref refs` results.

When should I use an LSP instead of xref?▼

Use an LSP or ast-grep when correctness matters more than speed, such as verifying a rename is safe. xref matches are lexical, so overloaded, re-exported, or shadowed names can produce missed or spurious hits.

Why does xref refuse to run outside a git repository?▼

Without a .gitignore to bound the walk, indexing a directory like $HOME could read tens of thousands of unrelated private files. Run `xref index` explicitly in that directory to opt in, after which queries work normally.

How does xref keep its index up to date?▼

Refresh is incremental: only files whose mtime or size changed are re-parsed, and rows for deleted files are dropped. Run `xref index --force` to ignore fingerprints and re-parse everything from scratch.