Created
January 8, 2026 15:03
-
-
Save olinguyen/f7dadc644b9f47012d2a7f79beef553a to your computer and use it in GitHub Desktop.
Custom Claude Code File Suggestion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # { | |
| # "fileSuggestion": { | |
| # "type": "command", | |
| # "command": ".claude/file-suggestion.sh" | |
| # } | |
| # } | |
| query=$(cat | jq -r '.query') | |
| cd "$CLAUDE_PROJECT_DIR" && fd -t f -p "$query" . | sed 's|^\./||' | head -15 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Stumbled upon this earlier this evening, wanted to give you a heads up that you can simplify this script a ton using fd's built-in options.
You can replace:
cd "$CLAUDE_PROJECT_DIR"with the-C|--base-directory <path>optionsed 's|^\./||'with the fd option--strip-cwd-prefix=alwayshead -15with the fd option--max-results=15Putting it all together:
It is worth mentioning that with these changes,
fdis no longer being piped into another command, so still outputs with color/decorations. Depending on how Claude Code calls this bash script, that could cause issues (but it's unlikely). If it does though, they can be disabled with options as well (--color=never,--hyperlink=never).