Efficient code navigation plugin for Claude Code CLI using the codenav tool. Save up to 92% on token usage by navigating codebases intelligently instead of blindly reading files.
Code Navigator teaches Claude Code to use the codenav CLI tool for efficient codebase exploration. Instead of reading dozens of files blindly, codenav builds indexed call graphs that allow:
- Finding functions and symbols instantly
- Tracing dependencies (what does this call?)
- Finding callers (who calls this?)
- Understanding call paths between functions
- Analyzing architecture and code relationships
Result: 87-92% token savings and faster code understanding.
# Add the marketplace (if not already added)
/plugin marketplace add https://github.com/shaharia-lab/claude-code-plugins.git
# Install the plugin
/plugin install code-navigator@shaharia-lab# Clone into Claude plugins directory
git clone https://github.com/shaharia-lab/claude-code-plugins.git ~/.claude/plugins/code-navigator
# Or clone anywhere and symlink
git clone https://github.com/shaharia-lab/claude-code-plugins.git ~/Projects/code-navigator
ln -s ~/Projects/code-navigator/plugins/code-navigator ~/.claude/plugins/code-navigatorRestart Claude Code CLI or restart your terminal.
This plugin requires the codenav CLI tool to be installed and available in your PATH.
# Check if codenav is installed
codenav --version
# If not installed, install codenav
# (Installation instructions depend on your codenav distribution)Codenav works with pre-indexed codebases:
# Index your codebase
codenav index /path/to/your/project --output /tmp/project.bin
# Verify the index
codenav query --graph /tmp/project.bin --countTip: Add indexing to your project setup or CI pipeline to keep it updated.
Claude automatically uses this skill when you ask navigation-related questions:
"How does authentication work in this codebase?"
"Find where the user data comes from"
"Trace the error handling flow"
"Understand the API endpoint structure"
Claude will use codenav to navigate efficiently instead of reading files blindly.
/codenav-navigation functionNamePurpose: Teach Claude to navigate code efficiently using codenav.
Features:
- Token efficiency rules (codenav → grep → read)
- Complete codenav command reference
- Common navigation patterns
- Real-world examples
- Integration strategies
Files:
SKILL.md- Main skill instructionsreference.md- Complete command referenceexamples.md- Real-world usage examples
# ❌ Wastes ~40,000 tokens
grep -r "pattern" . | head -100
read file1.ts # 5000 tokens
read file2.ts # 5000 tokens
read file3.ts # 5000 tokens
# ... repeat 10+ times# ✅ Uses ~3,000 tokens
codenav query --name "*pattern*" # 100 tokens
codenav callers functionName # 100 tokens
codenav trace --from "function" --depth 2 # 200 tokens
read identified_file.ts # 5000 tokens
# Result: 92% token savings!codenav query --graph /tmp/project.bin --name "*auth*" --output tablecodenav callers --graph /tmp/project.bin authenticate --show-linescodenav trace --graph /tmp/project.bin --from "handleRequest" --depth 2codenav path --graph /tmp/project.bin --from "login" --to "database"codenav analyze --graph /tmp/project.bin complexity --limit 20
codenav analyze --graph /tmp/project.bin circular
codenav analyze --graph /tmp/project.bin hotspots --limit 10Without Code Navigator (~40,000 tokens):
- Read 20+ files blindly
- Search through multiple directories
- Manual tracing of dependencies
With Code Navigator (~3,000 tokens):
- Query for data-related functions
- Trace backwards to find source
- Read only identified files
Result: 92% token savings
Task: How does login work?
# Find auth functions
codenav query --graph INDEX --name "*auth*"
# Find who uses it
codenav callers authenticate --show-lines
# Trace the flow
codenav trace --from "authenticate" --depth 2
# Find path from UI to database
codenav path --from "LoginPage" --to "database"Result: Complete understanding in 4 commands instead of reading 15+ files.
See examples.md for 8 complete real-world examples.
| Metric | Before | After | Improvement |
|---|---|---|---|
| Files Read | 15-20 | 2-3 | 85% fewer |
| Token Usage | 40,000+ | 3,000-5,000 | 87-92% savings |
| Time to Understanding | Slow | Fast | Much faster |
| Accuracy | Hit-or-miss | Precise | Higher quality |
| Tool | Use For | Token Cost |
|---|---|---|
| codenav | Navigation, call graphs, dependencies | Low (~100) |
| grep | Finding text, strings, constants | Medium (~500-1000) |
| read | Reading specific file content | High (~5000-10000) |
Golden Rule: Navigate with codenav first, search with grep second, read last.
The skill uses /tmp/codebase.bin by default. You can:
-
Set per-project: Create a
.codenavfile in your project root:/path/to/your/project.bin -
Use environment variable:
export CODENAV_INDEX=/path/to/index.bin -
Specify in commands: Always provide
--graphparameter
Keep your index updated:
# Manual update
codenav index /path/to/project --output /tmp/project.bin
# Or add to git hooks (.git/hooks/post-merge)
#!/bin/bash
codenav index . --output /tmp/project.bin
# Or add to CI/CD pipelineCodenav cannot determine:
- GraphQL query documents
- API endpoint URLs
- CMS queries (Contentful, Strapi, etc.)
- Hardcoded constants
- Configuration values
- Comments and documentation
For these cases: Use grep to find files, then read to inspect.
- ✅ Always start with codenav for navigation
- ✅ Use callers and trace to understand relationships
- ✅ Limit depth on trace to avoid overwhelming output
- ✅ Use --show-lines to get precise locations
- ✅ Export JSON for programmatic processing
- ✅ Read files last after identifying exactly what you need
- ❌ Don't skip codenav and jump straight to grep/read
- ❌ Don't trace too deep without limits
- ❌ Don't query all functions without filtering
# Check if codenav is installed
which codenav
# Install codenav if needed
# (Installation method depends on your distribution)# Check if index exists
ls -lh /tmp/codebase.bin
# Try broader pattern
codenav query --graph /tmp/codebase.bin --name "*pattern*"
# Verify case sensitivity# Re-index your codebase
codenav index /path/to/project --output /tmp/project.binCodenav typically supports:
- JavaScript/TypeScript
- Python
- Go
- Java
- Ruby
- PHP
- C/C++
- Rust
Check your codenav documentation for specific language support.
- Tool: codenav CLI
- Claude Code CLI: v1.0.33+
- License: MIT
Contributions welcome! Please:
- Add new examples to
examples.md - Document new codenav features in
reference.md - Update workflows in
SKILL.md
- Issues: GitHub Issues
- Documentation: See skill files in
skills/codenav-navigation/
MIT License - see LICENSE
https://github.com/shaharia-lab/claude-code-plugins
Remember: Navigate with codenav, search with grep, read last! 🚀
Token Savings: Up to 92% reduction in token usage for code exploration tasks.