| name | file-suggestion |
| description | Set up fast file suggestions for Claude Code using ripgrep, jq, and fzf. Use this skill when users want to improve file autocomplete performance or add custom file suggestion behavior. |
File Suggestion Setup
This skill helps you configure Claude Code's file suggestion feature with a custom script that uses ripgrep, jq, and fzf for fast fuzzy file matching.
Prerequisites
Install these tools before setup:
sudo apt install ripgrep jq fzf
brew install ripgrep jq fzf
sudo pacman -S ripgrep jq fzf
Setup Steps
1. Create the Script
Create the file suggestion script at ~/.claude/file-suggestion.sh:
#!/bin/bash
QUERY=$(jq -r '.query // ""')
PROJECT_DIR="${CLAUDE_PROJECT_DIR:-.}"
cd "$PROJECT_DIR" || exit 1
{
rg --files --follow --hidden . 2>/dev/null
} | sort -u | fzf --filter "$QUERY" | head -15
2. Make It Executable
chmod +x ~/.claude/file-suggestion.sh
3. Configure Claude Code
Add this to your ~/.claude/settings.json:
{
"fileSuggestion": {
"type": "command",
"command": "~/.claude/file-suggestion.sh"
}
}
How It Works
The script:
- Receives JSON input with a
query field from Claude Code
- Uses ripgrep (
rg --files) to list files fast, respecting .gitignore
- Follows symlinks with
--follow flag
- Includes hidden files with
--hidden flag
- Fuzzy filters results using
fzf --filter
- Returns top 15 matches sorted by relevance
Customization
Include Gitignored Paths
Uncomment and customize the additional paths section:
[ -e .notes ] && rg --files --follow --hidden --no-ignore-vcs .notes 2>/dev/null
[ -e vendor ] && rg --files --follow --hidden --no-ignore-vcs vendor 2>/dev/null
Exclude Patterns
Add ripgrep glob patterns to exclude files:
rg --files --follow --hidden \
--glob '!*.min.js' \
--glob '!*.map' \
--glob '!node_modules' \
. 2>/dev/null
Change Result Limit
Modify the head -15 to return more or fewer results:
... | head -25
Troubleshooting
Script Not Found
Ensure the path in settings.json matches your script location and uses ~ or absolute path.
No Results
Check that:
- ripgrep is installed:
which rg
- fzf is installed:
which fzf
- jq is installed:
which jq
- Script is executable:
ls -la ~/.claude/file-suggestion.sh
Slow Performance
If you have a large repo:
- Ensure
.gitignore excludes node_modules, dist, etc.
- Add explicit
--glob '!pattern' exclusions for large directories
Template Script
A ready-to-use template is available at:
${CLAUDE_PLUGIN_ROOT}/skills/file-suggestion/scripts/file-suggestion.sh
Copy it to your ~/.claude/ directory and customize as needed.