| name | description |
|---|---|
ast-index |
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", "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", or needs fast code search in Android/Kotlin/Java, iOS/Swift/ObjC, TypeScript/JavaScript, Rust, Ruby, C#, Perl, Python, Go, C++, or Protocol Buffers projects. Also triggered by mentions of "ast-index" CLI tool. |
Fast native Rust CLI for structural code search in Android/Kotlin/Java, iOS/Swift/ObjC, TypeScript/JavaScript, Rust, Ruby, C#, Perl, Python, Go, C++, and Proto projects using SQLite + FTS5 index.
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
- 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
- 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") - Searching in comments content
Why: ast-index is 17-69x faster than grep (1-10ms vs 200ms-3s) and returns structured, accurate results.
Install the CLI before use:
brew tap defendend/ast-index
brew install ast-indexInitialize index in project root:
cd /path/to/project
ast-index rebuildThe index is stored at ~/.cache/ast-index/<project-hash>/index.db and needs rebuilding when project structure changes significantly.
| Platform | Languages | Module System |
|---|---|---|
| Android | Kotlin, Java | Gradle (build.gradle.kts) |
| 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 |
| 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) |
| 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.
search - Perform universal search across files, symbols, and modules simultaneously.
ast-index search "Payment" # Finds files, classes, functions matching "Payment"
ast-index search "ViewModel" # Returns files, symbols, modules in ranked orderfile - Find files by name pattern.
ast-index file "Fragment.kt" # Find files ending with Fragment.kt
ast-index file "ViewController" # Find iOS view controllerssymbol - Find symbols (classes, interfaces, functions, properties) by name.
ast-index symbol "PaymentInteractor" # Find exact symbol
ast-index symbol "Presenter" # Find all presentersclass - Find class, interface, or protocol definitions.
ast-index class "BaseFragment" # Find Android base fragment
ast-index class "UIViewController" # Find iOS view controller subclassusages - Find all places where a symbol is used. Critical for refactoring.
ast-index usages "PaymentRepository" # Find all usages of repository
ast-index usages "onClick" # Find all click handler usagesPerformance: ~8ms for indexed symbols.
implementations - Find all classes that extend or implement a given class/interface/protocol.
ast-index implementations "BasePresenter" # Find all presenter implementations
ast-index implementations "Repository" # Find repository implementationshierarchy - Display complete class hierarchy tree.
ast-index hierarchy "BaseFragment" # Show fragment inheritance treecallers - Find all places that call a specific function.
ast-index callers "onClick" # Find all onClick calls
ast-index callers "fetchUser" # Find API call sitescall-tree - Show complete call hierarchy going UP (who calls the callers).
ast-index call-tree "processPayment" --depth 3 --limit 10imports - List all imports in a specific file.
ast-index imports "path/to/File.kt" # Show Kotlin file importsoutline - Show all symbols defined in a file.
ast-index outline "PaymentFragment.kt" # Show fragment structuretodo - Find TODO/FIXME/HACK comments in code.
ast-index todo # Find all TODO comments
ast-index todo --limit 10 # Limit resultsdeprecated - Find @Deprecated annotations.
ast-index deprecated # Find deprecated itemschanged - Show symbols changed in git diff.
ast-index changed # Changes vs HEAD
ast-index changed --base main # Changes vs main branchapi - Show public API of a module.
ast-index api "core" # Public classes/functions in moduleast-index init # Initialize index for current projectast-index rebuild # Full rebuild with dependencies
ast-index rebuild --no-deps # Skip module dependency indexing
ast-index rebuild --no-ignore # Include gitignored files
ast-index update # Incremental update
ast-index stats # Show index statisticsast-index version # Show CLI version
ast-index help # Show help message
ast-index help <command> # Show help for specific command
ast-index install-claude-plugin # Install Claude Code plugin to ~/.claude/plugins/| Command | Time | Notes |
|---|---|---|
| search | ~10ms | Indexed FTS5 search |
| class | ~1ms | Direct index lookup |
| usages | ~8ms | Indexed reference search |
| imports | ~0.3ms | File-based lookup |
| callers | ~1s | Grep-based search |
| rebuild | ~25s | Full project indexing |
Consult: references/android-commands.md
- DI Commands:
provides,inject,annotations - Compose Commands:
composables,previews - Coroutines Commands:
suspend,flows - XML Commands:
xml-usages,resource-usages - Code Quality:
deprecated,suppress,todo - Extensions:
extensions - Navigation:
deeplinks
Consult: references/ios-commands.md
- Storyboard & XIB:
storyboard-usages - Assets:
asset-usages - SwiftUI:
swiftui - Swift Concurrency:
async-funcs,main-actor - Combine:
publishers
Consult: references/typescript-commands.md
- Index:
class,interface,type,function,const, decorators - Supports: React (hooks, components), Vue SFC, Svelte, NestJS, Angular
outlineandimportswork with TS/JS files
Consult: references/rust-commands.md
- Index:
struct,enum,trait,impl,fn,macro_rules!,mod - Supports: Derives, attributes (
#[test],#[derive]) outlineandimportswork with Rust files
Consult: references/ruby-commands.md
- Index:
class,module,def, Rails DSL - Supports: RSpec (
describe,it,let), Rails (associations, validations) outlineandimportswork with Ruby files
Consult: references/csharp-commands.md
- Index:
class,interface,struct,record,enum, methods, properties - Supports: ASP.NET attributes, Unity (
MonoBehaviour,SerializeField) outlineandimportswork with C# files
Consult: references/python-commands.md
- Index:
class,def,async def, decorators outlineandimportswork with Python files
Consult: references/go-commands.md
- Index:
package,type struct,type interface,func outlineandimportswork with Go files
Consult: references/perl-commands.md
- Exports:
perl-exports - Subroutines:
perl-subs - POD:
perl-pod - Imports:
perl-imports - Tests:
perl-tests
Consult: references/module-commands.md
- Module Search:
module - Dependencies:
deps,dependents - Unused Dependencies:
unused-deps - Public API:
api
- Run
ast-index rebuildonce in project root to build the index - Use
ast-index searchfor quick universal search when exploring - Use
ast-index classfor precise class/interface lookup - Use
ast-index usagesto find all references before refactoring - Use
ast-index implementationsto understand inheritance - Use
ast-index changed --base mainbefore code review - Run
ast-index updateperiodically to keep index fresh
For detailed platform-specific commands, consult:
references/android-commands.md- DI, Compose, Coroutines, XMLreferences/ios-commands.md- Storyboard, SwiftUI, Combinereferences/typescript-commands.md- React, Vue, Svelte, NestJS, Angularreferences/rust-commands.md- Structs, traits, impl blocks, macrosreferences/ruby-commands.md- Rails, RSpec, classes, modulesreferences/csharp-commands.md- ASP.NET, Unity, controllers, interfacesreferences/perl-commands.md- Perl exports, subs, PODreferences/python-commands.md- Python classes, functionsreferences/go-commands.md- Go structs, interfacesreferences/cpp-commands.md- C/C++ classes, JNI functionsreferences/proto-commands.md- Protocol Buffers messages, servicesreferences/wsdl-commands.md- WSDL services, XSD typesreferences/module-commands.md- Module dependencies