Skip to content

Instantly share code, notes, and snippets.

@kvirani
Last active March 16, 2026 22:08
Show Gist options
  • Select an option

  • Save kvirani/bf36d4e4236e57d617c6240096a0fc7d to your computer and use it in GitHub Desktop.

Select an option

Save kvirani/bf36d4e4236e57d617c6240096a0fc7d to your computer and use it in GitHub Desktop.
claude autocomplete fix for @ command for those not using git

Copy and paste the following (prompt.md contents) into a Claude Code session at the root of your UE5 project

Why This Matters

UE5 projects have massive generated directories:

  • Content/ - thousands of .uasset and .umap binary files that Claude can't read anyway
  • Intermediate/ - generated C++ files, build artifacts, object files
  • Binaries/ - compiled executables and DLLs
  • DerivedDataCache/ - shader cache, cooked assets
  • Saved/ - autosaves, logs, crash reports

Without these exclusions, every @ autocomplete keystroke and every code search crawls through all of these, causing multi-second delays on large projects.

What Each Piece Does

File Tool it controls Purpose
.fdignore fd Autocomplete file discovery (@ menu)
.ignore rg (ripgrep) Code content searches (Grep tool)
.claudeignore Claude Code What Claude can read/access
file-suggestion.sh Claude Code Replaces default file walker with fd
settings.json Claude Code Tells Claude to use the custom script
#!/bin/bash
# Claude Code fileSuggestion script
# Uses fd (fast file finder) + fzf (fuzzy scorer) for smart @ autocomplete.
# Respects .fdignore per-project for excluding directories.
#
# Dependencies: fd, fzf, jq
# Windows: winget install sharkdp.fd junegunn.fzf jqlang.jq
# macOS: brew install fd fzf jq
# Linux: sudo apt install fd-find fzf jq
#
# Claude Code's bash (git bash / MSYS2) doesn't always inherit the full
# Windows PATH. WinGet shims live in %LOCALAPPDATA%\Microsoft\WinGet\Links
# which pwsh sees but git bash often doesn't. We append common tool dirs
# so fd, fzf, and jq are discoverable on any machine.
export PATH="$PATH:$(cygpath "$LOCALAPPDATA")/Microsoft/WinGet/Links:/usr/local/bin:/opt/homebrew/bin"
query=$(cat | jq -r '.query')
if [ -z "$query" ]; then
# Empty query: show recently modified files (last 7 days) sorted newest-first.
# cd into the project so fd outputs relative paths, then bulk-sort via ls -t.
cd "$CLAUDE_PROJECT_DIR" 2>/dev/null &&
fd --type f --hidden --follow --color never \
--changed-within 7d 2>/dev/null \
| xargs ls -t 2>/dev/null \
| head -30
else
# Pipe all project files through fzf for proper fuzzy matching with scoring.
# fzf scores by match compactness, consecutiveness, and position (prefers
# filename matches over deep path matches), similar to Sublime's Ctrl+P.
fd --type f --hidden --follow --color never \
--base-directory "$CLAUDE_PROJECT_DIR" 2>/dev/null \
| fzf --filter="$query" 2>/dev/null \
| head -30
fi

I need you to fix the @ file autocomplete in Claude Code for this UE5 project. It's slow because it traverses large engine-generated directories like Content/, Intermediate/, Binaries/, DerivedDataCache/, and Saved/.

Here's what needs to happen and why:

Background (so you don't waste time on dead ends)

  • .claudeignore does NOT affect @ autocomplete. It only controls what Claude can read.
  • .gitignore works for autocomplete, but ONLY if the project is a git repo. Many UE5 projects use Perforce, Plastic SCM, Diversion, or no VCS at all, so this often doesn't help.
  • The correct solution is the fileSuggestion setting with fd (fast file finder), fzf (fuzzy scorer), and jq (JSON parser).

What to install

Install fd, fzf, and jq using winget (Windows), brew (macOS), or apt (Linux):

  • Windows: winget install sharkdp.fd junegunn.fzf jqlang.jq --accept-package-agreements
  • macOS: brew install fd fzf jq
  • Linux: sudo apt install fd-find fzf jq (fd binary may be named fdfind - create an alias or symlink to fd)

Files to create

  1. .fdignore in the project root (controls what fd skips - same syntax as .gitignore):
# UE5 generated directories
Content/
Intermediate/
Binaries/
DerivedDataCache/
Saved/
Build/

# Vendored / generated
.venv/
ExternalDeps/

# VCS (add whichever you use)
.git/
.diversion/
.plastic/
.p4/

# IDE / editor
.vs/
.idea/

# OS junk
Thumbs.db
Desktop.ini
.DS_Store
  1. .ignore in the project root (same content as .fdignore - this controls what rg/ripgrep skips, which is what powers Claude Code's internal Grep tool for searching file contents):

Same content as .fdignore above.

  1. ~/.claude/file-suggestion.sh (the custom autocomplete script):
#!/bin/bash
# Claude Code fileSuggestion script for UE5 projects
# Uses fd (fast file finder) + fzf (fuzzy scorer) for smart @ autocomplete.
# Respects .fdignore per-project for excluding directories.
#
# Dependencies: fd, fzf, jq
#   Windows: winget install sharkdp.fd junegunn.fzf jqlang.jq
#   macOS:   brew install fd fzf jq
#   Linux:   sudo apt install fd-find fzf jq
#
# Claude Code's bash (git bash / MSYS2) doesn't always inherit the full
# Windows PATH. WinGet shims live in %LOCALAPPDATA%\Microsoft\WinGet\Links
# which pwsh sees but git bash often doesn't. We append common tool dirs
# so fd, fzf, and jq are discoverable on any machine.
export PATH="$PATH:$(cygpath "$LOCALAPPDATA")/Microsoft/WinGet/Links:/usr/local/bin:/opt/homebrew/bin"

query=$(cat | jq -r '.query')

if [ -z "$query" ]; then
  # Empty query: show recently modified files (last 7 days) sorted newest-first.
  # cd into the project so fd outputs relative paths, then bulk-sort via ls -t.
  cd "$CLAUDE_PROJECT_DIR" 2>/dev/null &&
  fd --type f --hidden --follow --color never \
    --changed-within 7d 2>/dev/null \
    | xargs ls -t 2>/dev/null \
    | head -30
else
  # Pipe all project files through fzf for proper fuzzy matching with scoring.
  # fzf scores by match compactness, consecutiveness, and position (prefers
  # filename matches over deep path matches), similar to Sublime's Ctrl+P.
  fd --type f --hidden --follow --color never \
    --base-directory "$CLAUDE_PROJECT_DIR" 2>/dev/null \
    | fzf --filter="$query" 2>/dev/null \
    | head -30
fi
  1. Add fileSuggestion to ~/.claude/settings.json (create the file if it doesn't exist):
{
  "fileSuggestion": {
    "type": "command",
    "command": "~/.claude/file-suggestion.sh"
  }
}

If the file already exists with other settings, just merge the fileSuggestion key in.

After creating everything

  1. Restart Claude Code (the fileSuggestion setting requires a restart to pick up).
  2. Test @ autocomplete with a known filename from your Source/ directory.
  3. Test fuzzy search: @fdatcomp.h should match files like FDLookAtComponent.h.
  4. Test directory search: @Docs should show files inside your Docs/ directory.
  5. Run a Grep search (e.g. search for UE_LOG) and verify no results come from Content/ or Intermediate/.

Important notes

  • --base-directory is critical in the fd command. Without it, autocomplete shows full absolute paths instead of project-relative paths.
  • The script is bash, but this works on Windows too because Claude Code uses git bash internally regardless of your default terminal.
  • On Windows, Claude Code's git bash does NOT inherit the full Windows PATH. The WinGet shims directory (%LOCALAPPDATA%\Microsoft\WinGet\Links) where fd/fzf/jq live is often missing. The script handles this by appending it via $LOCALAPPDATA (no hardcoded usernames). The macOS/Linux fallback paths (/usr/local/bin, /opt/homebrew/bin) are included for cross-platform portability.
  • The ~/.claude/file-suggestion.sh script is project-agnostic. It uses $CLAUDE_PROJECT_DIR (set automatically by Claude Code) and reads whatever .fdignore exists in that project. So you only set up the script and settings once globally, then drop .fdignore and .ignore files into each project.
  • .fdignore controls fd (file finding / autocomplete). .ignore controls rg (content searching / Grep tool). Both are needed for full coverage. Same syntax, same content, different consumers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment