defendend/claude-ast-index-search/ast-index
Claude Code and agent skill by defendend/claude-ast-index-search
- community
Checking that the SKILL.md file is still in the repository.
This skill should be used when the user asks to "find a class", "search for symbol", "find usages", "find implementations", "search codebase", "find file", "class hierarchy", "find callers", "module dependencies", "unused dependencies", "project map", "project conventions", "project structure", "what frameworks", "what architecture", "find Perl subs", "Perl exports", "find Python class", "Go struct", "Go interface", "find React component", "find TypeScript interface", "find Rust struct", "find Ruby class", "find C# controller", "find Dart class", "find Flutter widget", "find mixin", "find Scala trait", "find case class", "find object", "find PHP class", "find Laravel model", "find PHP trait", or needs fast code search in Android/Kotlin/Java, iOS/Swift/ObjC, Dart/Flutter, TypeScript/JavaScript, Rust, Ruby, C#, Scala, PHP, Perl, Python, Go, C++, or Protocol Buffers projects. Also triggered by mentions of "ast-index" CLI tool.
Install
npx vskill@latest install defendend/claude-ast-index-search/ast-indexSKILL.md
ast-index - Code Search for Multi-Platform Projects
Fast native Rust CLI for structural code search in Android/Kotlin/Java, iOS/Swift/ObjC, Dart/Flutter, TypeScript/JavaScript, Rust, Ruby, C#, Scala, PHP, Perl, Python, Go, C++, and Proto projects using SQLite + FTS5 index.
Critical Rules
ALWAYS use ast-index FIRST for any code search task. These rules are mandatory:
- ast-index is the PRIMARY search tool — use it before grep, ripgrep, or Search tool
- Pick the command by what you know:
- You have an intent or a description ("how is auth handled", "processing update admin") →
ast-index explore "<query>". It ranks by relevance and prints the source. - You have an exact identifier (
UserService,parseConfig) →ast-index search/symbol/class. Add--with-contenttosymbolwhen you need its definition body, or tosearchwhen the exact qualified name or kind is uncertain. searchitself falls back toexploreranking when a multi-word query has no literal match, so a wrong pick is not fatal — butexploreis the right first call for questions.
- DO NOT duplicate results — if ast-index found usages/implementations, that IS the complete answer
- DO NOT run grep "for completeness" after ast-index returns results
- DO NOT re-read bodies returned by `--with-content` — a successful result replaces the usual
sed/awk/grep/rgor file-read step. Use those tools only when the body is truncated or unavailable, or when you need text outside the returned definition. - Use grep/Search ONLY when:
- ast-index returns empty results
- Searching for regex patterns (ast-index uses literal match)
- Searching for string literals inside code (
"some text") —usagesand
refs skip names inside strings and comments
- Searching in comments content
Why: ast-index is 17-69x faster than grep (1-10ms vs 200ms-3s) and returns structured, accurate results.
Prerequisites
Install the CLI before use:
Initialize index in project root:
The index is stored at ~/Library/Caches/ast-index/<project-hash>/index.db (macOS) or ~/.cache/ast-index/<project-hash>/index.db (Linux). Rebuild builds a fresh index and swaps it in; named subtrees and the collected Git history (hotspots --collect) are carried over.
Supported Projects
| Platform | Languages | Module System | |
|---|---|---|---|
| Android/Java | Kotlin, Java | Gradle (build.gradle.kts), Maven (pom.xml) | |
| iOS | Swift, Objective-C | SPM (Package.swift) | |
| Web | TypeScript, JavaScript, React, Vue, Svelte | package.json | |
| Rust | Rust | Cargo.toml | |
| Ruby | Ruby, Rails, RSpec | Gemfile | |
| .NET | C#, ASP.NET, Unity | *.csproj | |
| Dart/Flutter | Dart | pubspec.yaml | |
| Scala | Scala | Bazel (WORKSPACE, BUILD) | |
| PHP | PHP | composer.json | |
| Perl | Perl | Makefile.PL, Build.PL | |
| Python | Python | None (*.py files) | |
| Go | Go | None (*.go files) | |
| Proto | Protocol Buffers (proto2/proto3) | None (*.proto files) | |
| WSDL | WSDL, XSD | None (.wsdl, .xsd files) | |
| C/C++ | C, C++ (JNI, uservices) | None (.cpp, .h, *.hpp files) | |
| Godot | GDScript | project.godot | |
| Mixed | All above | All |
Project type is auto-detected by marker files (build.gradle.kts, Package.swift, Makefile.PL, etc.). Python, Go, Proto, WSDL, and C++ files are indexed alongside main project type.
Minified JavaScript/CSS is never indexed or searched: .js/.mjs/.cjs/.css files named *.min.* or *-min.*, or whose first 64 KiB is minifier output (lines averaging 1000+ bytes of code, not one long string). Grep-based commands skip them too, and outline/imports on such a file print Skipped: minified file instead of parsing it. AST_INDEX_SKIP_MINIFIED=0 turns the filter off.
Core Commands
Explore (one-shot context)
`explore` - Rank the symbols most relevant to a query, show the best files — an outline with line ranges for a type or module (the definitions inside it, the chosen one marked →), the source (read fresh from disk) for a function — list graph neighbours (callers/subclasses), and locate tests by path convention — in a single call. Prefer this over a search + read loop when you want to understand an area; read the slice an outline row points at next. Language-agnostic and vendor-aware (node_modules .d.ts and cross-stack matches are down-ranked, never deleted).
- Default (Stage A) ranks by lexical match + multi-term corroboration. The
words of a question are also read run together (pdf to html service finds PdfToHtmlService) and against file paths, so a CamelCase class is found from its words; the type a file is named after ranks above helpers, and statements (has_many :x, scope, include) and namespace-only modules rank below definitions. Question words (how, does, work) are ignored.
--rwr(Stage B) builds a call/inheritance graph in memory and re-ranks by
personalized PageRank, surfacing callers/subclasses in a "Graph neighbours" section. Slightly slower; best when you care about who-calls-what.
Universal Search
`search` - Perform universal search across files, symbols, and modules simultaneously.
Symbols come in tiers: exact name, then a name whose last :: or . segment is the query (Billing::Invoice for Invoice, the schema column users.email for email), then partial matches. Inside each tier definitions come before imports and project code before node_modules; among partial matches test symbols (test files, test_*, TestX) come last.
`search --rank <preset>` - Re-rank the Files and Symbols sections by the file's Git history and the symbol's place in the dependency graph, with a dossier next to every result explaining its position. Use it when the question is not "where is X" but "which of these X":
| Preset | Score | Needs | |
|---|---|---|---|
proven | mean(1 − hotspot score, maturity, used 1/0) × substance (0.5 for stubs) × lineage (0.5 when the base is no longer extended) | hotspots --collect + graph build | |
hotspots | file hotspot score (commits, churn, bugfix ratio pct) | hotspots --collect | |
risky | dependents pct × hotspot score | both | |
central | PageRank pct | graph build |
- Relevance stays in charge: the pool is the top 100 project symbols of the
plain order, exact-name matches stay above partial ones, and inside a tier the key is 0.9 × score + 0.1 × 1/(1 + position/20). File path matches use where the match sits (stem, name, directory) as the relevance term.
- History is per file — every symbol in a file shares it ("file history"
in the output). Graph numbers are per symbol; a file result borrows them from its strongest symbol.
- Missing data is never ranked as zeros: the preset is not applied, results
keep plain order, and the output names the command to run (rank.missing[].command in JSON). A stale graph ranks with a warning.
- Third-party code (
node_modules,.d.ts) is never scored and is listed
after all project results.
- Formulas were picked by backtesting next-year bugfixes on a 40k-file
monorepo, proven also by hand-judged "which one to copy" queries; the numbers are in USER_GUIDE.md ("Ranking search results"). Safe by the numbers is not the same as a good example: proven cannot tell which of two living styles the team prefers.
File Search
`file` - Find files by name pattern.
Symbol Search
`symbol` - Find symbols (classes, interfaces, functions, properties) by name.
A namespaced class is found by its short or its full name: LedgerImporter and Billing::LedgerImporter both find class Billing::LedgerImporter (also in class, refs, hierarchy, implementations). An exact short name wins over namespaced ones. usages Billing::LedgerImporter lists references to LedgerImporter on lines that spell out the full name; usages LedgerImporter lists all of them.
Class Search
`class` - Find class, interface, or protocol definitions.
Usage Search
`usages` - Find all places where a symbol is used. Critical for refactoring.
Usages (here and in refs) list production files first and test files after them, each group by path and line; in JSON a test reference carries "test": true.
Indexed usages are capitalized names and calls written name(, snake_case and _private names included. Reserved words (sizeof (x), #if defined(X), Go's func (r *T), Python's None) are never recorded.
Performance: ~8ms for indexed symbols.
Cross-References
`refs` - Show cross-references for a symbol: definitions, imports, and usages in one view.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingplugin/skills/ast-index/SKILL.md
Popularity
- Repository stars
- 532
- Repository forks
- 36
- 7-day trend score
- 31
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/defendend/claude-ast-index-search/ast-index)