/initialize-rust
Manual override: initialize ast-index for Rust project
> /plugin marketplace add defendend/Claude-ast-index-search > /plugin install ast-index@ast-index-marketplace
How it fires
How this command gets triggered: by you, by Claude, or both.
- Fires itselfClaude auto-loads it when your prompt matches the work.
- You can call itInvoke it directly when you want it.
- Slash command
/initialize-rust
Context preview
What this command does when you run it.
Manual override: initialize ast-index for Rust project
Command definition
initialize-rust.mdname: initialize-rust
description: "Manual override: initialize ast-index for Rust project"
Initialize ast-index for Rust Project
This command sets up ast-index integration for Rust projects (Cargo-based).
Steps to Execute
1. Check Prerequisites
Verify ast-index is installed:
ast-index version
If not installed, inform user to run:
brew tap defendend/ast-index
brew install ast-index
2. Create/Update .claude/settings.json
First, ensure the directory exists:
mkdir -p .claude
Then create or merge into `.claude/settings.json`. If file doesn't exist, create it with this content:
{
"extraKnownMarketplaces": {
"ast-index": {
"source": {
"source": "github",
"repo": "defendend/Claude-ast-index-search"
}
}
},
"enabledPlugins": {
"ast-index@ast-index": true
},
"permissions": {
"allow": [
"Bash(ya tool ast-index *)",
"Bash(ast-index *)"
]
}
}**Important**: If `.claude/settings.json` already exists, MERGE the keys (don't replace the whole file).
3. Create .claude/rules/ast-index.md (CRITICAL)
Create the rules directory and ast-index rules file:
mkdir -p .claude/rules
Create file `.claude/rules/ast-index.md` with this content:
# ast-index Rules
## Mandatory Search Rules
1. **ALWAYS use ast-index FIRST** for any code search task
2. **NEVER duplicate results** — if ast-index found usages/implementations, that IS the complete answer
3. **DO NOT run grep "for completeness"** after ast-index returns results
4. **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
ast-index is 17-69x faster than grep (1-10ms vs 200ms-3s) and returns structured, accurate results.
## Command Reference
| Task | Command | Time |
|------|---------|------|
| Universal search | `ast-index search "query"` | ~10ms |
| Find struct/trait | `ast-index class "StructName"` | ~1ms |
| Find symbol | `ast-index symbol "SymbolName"` | ~1ms |
| Find usages | `ast-index usages "SymbolName"` | ~8ms |
| Find implementations | `ast-index implementations "Trait"` | ~5ms |
| Call hierarchy | `ast-index call-tree "function" --depth 3` | ~1s |
| Find callers | `ast-index callers "functionName"` | ~1s |
| Module deps | `ast-index deps "module-name"` | ~10ms |
| File outline | `ast-index outline "lib.rs"` | ~1ms |
## Rust-Specific Commands
| Task | Command |
|------|---------|
| Find structs | `ast-index class "User"` |
| Find traits | `ast-index class "Repository"` |
| Find impl blocks | `ast-index search "impl"` |
| Find macros | `ast-index search "macro_rules"` |
| Find derives | `ast-index search "#[derive"` |
| Find tests | `ast-index search "#[test]"` |
## Index Management
- `ast-index rebuild` — Full reindex (run once after clone)
- `ast-index update` — After git pull/merge
- `ast-index stats` — Show index statistics
4. Build the Index
Run initial indexing:
ast-index rebuild
Show progress and report statistics when done.
5. Verify Setup
Run a quick search to verify everything works:
ast-index stats
ast-index search "fn"
Output
After completion, inform user:
- settings.json has been configured with ast-index permissions
- Rules file created at .claude/rules/ast-index.md
- Index has been built with X files and Y symbols
- Ready to use ast-index for code search
Cargo Workspace Support
For Cargo workspaces with multiple crates:
# Index entire workspace from root
cd /path/to/workspace
ast-index rebuild
# Or index specific crate
cd /path/to/workspace/crate-name
ast-index rebuild
The indexer will automatically detect and index all `.rs` files in the project.
Read more
name: initialize-rust description: "Manual override: initialize ast-index for Rust project"
Initialize ast-index for Rust Project
This command sets up ast-index integration for Rust projects (Cargo-based).
Steps to Execute
1. Check Prerequisites
Verify ast-index is installed:
ast-index version
If not installed, inform user to run:
brew tap defendend/ast-index brew install ast-index
2. Create/Update .claude/settings.json
First, ensure the directory exists:
mkdir -p .claude
Then create or merge into `.claude/settings.json`. If file doesn't exist, create it with this content:
{
"extraKnownMarketplaces": {
"ast-index": {
"source": {
"source": "github",
"repo": "defendend/Claude-ast-index-search"
}
}
},
"enabledPlugins": {
"ast-index@ast-index": true
},
"permissions": {
"allow": [
"Bash(ya tool ast-index *)",
"Bash(ast-index *)"
]
}
}**Important**: If `.claude/settings.json` already exists, MERGE the keys (don't replace the whole file).
3. Create .claude/rules/ast-index.md (CRITICAL)
Create the rules directory and ast-index rules file:
mkdir -p .claude/rules
Create file `.claude/rules/ast-index.md` with this content:
# ast-index Rules ## Mandatory Search Rules 1. **ALWAYS use ast-index FIRST** for any code search task 2. **NEVER duplicate results** — if ast-index found usages/implementations, that IS the complete answer 3. **DO NOT run grep "for completeness"** after ast-index returns results 4. **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 ast-index is 17-69x faster than grep (1-10ms vs 200ms-3s) and returns structured, accurate results. ## Command Reference | Task | Command | Time | |------|---------|------| | Universal search | `ast-index search "query"` | ~10ms | | Find struct/trait | `ast-index class "StructName"` | ~1ms | | Find symbol | `ast-index symbol "SymbolName"` | ~1ms | | Find usages | `ast-index usages "SymbolName"` | ~8ms | | Find implementations | `ast-index implementations "Trait"` | ~5ms | | Call hierarchy | `ast-index call-tree "function" --depth 3` | ~1s | | Find callers | `ast-index callers "functionName"` | ~1s | | Module deps | `ast-index deps "module-name"` | ~10ms | | File outline | `ast-index outline "lib.rs"` | ~1ms | ## Rust-Specific Commands | Task | Command | |------|---------| | Find structs | `ast-index class "User"` | | Find traits | `ast-index class "Repository"` | | Find impl blocks | `ast-index search "impl"` | | Find macros | `ast-index search "macro_rules"` | | Find derives | `ast-index search "#[derive"` | | Find tests | `ast-index search "#[test]"` | ## Index Management - `ast-index rebuild` — Full reindex (run once after clone) - `ast-index update` — After git pull/merge - `ast-index stats` — Show index statistics
4. Build the Index
Run initial indexing:
ast-index rebuild
Show progress and report statistics when done.
5. Verify Setup
Run a quick search to verify everything works:
ast-index stats ast-index search "fn"
Output
After completion, inform user:
- settings.json has been configured with ast-index permissions
- Rules file created at .claude/rules/ast-index.md
- Index has been built with X files and Y symbols
- Ready to use ast-index for code search
Cargo Workspace Support
For Cargo workspaces with multiple crates:
# Index entire workspace from root cd /path/to/workspace ast-index rebuild # Or index specific crate cd /path/to/workspace/crate-name ast-index rebuild
The indexer will automatically detect and index all `.rs` files in the project.
Structural, AST-aware code navigation CLI for large, multi-language repositories.
Repo: defendend/Claude-ast-index-search
Other commands on ast-index.
- /initialize-android
Manual override: initialize ast-index for Android/Kotlin/Java project
Open command - /initialize-csharp
Manual override: initialize ast-index for C#/.NET project
Open command - /initialize-ios
Manual override: initialize ast-index for iOS/Swift/ObjC project
Open command - /initialize-ruby
Manual override: initialize ast-index for Ruby/Rails project
Open command - /initialize-web
Manual override: initialize ast-index for TypeScript/JavaScript web project
Open command - /initialize
Auto-detect project stack(s) and initialize ast-index for single-stack, KMP, and polyglot repos
Open command

