file-search について
file-searchは、fd、rg、fzfを使ってファイルや内容を検索する開発者向けスキルです。対話的な選択やプレビューに加え、発展的なワークフローの参考資料も扱います。
主な機能
- 01名前、拡張子、種類で検索
- 02パターンによるファイル内容の検索
- 03fzfによる対話的な選択
- 04一致ファイルのプレビューと表示
- 05発展的なワークフロー資料
活用シーン
- 01種類を指定してソースファイルを探す
- 02コード内のTODOやエラーを探す
- 03検索結果を選んでファイルを開く
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ 0xdarkmatter/ claude-mods --skill file-searchインストール後、Claude Code で/file-searchを入力して読み込まれたか確認します。
同梱ファイル
SKILL.md と一緒にインストールされる参考資料やスクリプト。
assets/.gitkeepreferences/advanced-workflows.mdscripts/.gitkeep詳細
ファイル検索
最新のファイルおよびコンテンツ検索です。
fd - ファイルを検索
# Find by name
fd config # Files containing "config"
fd -e py # Python files
# By type
fd -t f config # Files only
fd -t d src # Directories only
# Exclude
fd -E node_modules # Exclude directory
fd -E "*.min.js" # Exclude pattern
# Execute command
fd -e py -x wc -l # Line count per file
rg - コンテンツを検索
# Simple search
rg "TODO" # Find TODO
rg -i "error" # Case-insensitive
# By file type
rg -t py "import" # Python files only
rg -t js -t ts "async" # JS and TS
# Context
rg -C 3 "function" # 3 lines before/after
# Output modes
rg -l "TODO" # File names only
rg -c "TODO" # Count per file
fzf - インタラクティブに選択
# Find and select
fd | fzf
# With preview
fd | fzf --preview 'bat --color=always {}'
# Multi-select
fd -e ts | fzf -m | xargs code
複合パターン
# Find files, search content
fd -e py -x rg "async def" {}
# Search, select, open
rg -l "pattern" | fzf --preview 'rg -C 3 "pattern" {}' | xargs vim
クイックリファレンス
| タスク | コマンド |
|---|---|
| TS ファイルを検索 | fd -e ts |
| src 内を検索 | fd -e ts src/ |
| パターンを検索 | rg "pattern" |
| 指定した種類のファイル内を検索 | rg -t py "import" |
| 一致するファイル | rg -l "pattern" |
| 一致数をカウント | rg -c "pattern" |
| インタラクティブに選択 | fd | fzf |
| プレビュー付き | fd | fzf --preview 'bat {}' |
パフォーマンスのヒント
| ヒント | 理由 |
|---|---|
どちらも .gitignore を尊重します | node_modules、dist を自動的にスキップします |
-g より -t を使用します | 種類指定フラグのほうが高速です |
| パスを絞り込みます | rg pattern src/ のほうが高速です |
リテラルには -F を使用します | 正規表現のオーバーヘッドを回避できます |
追加リソース
詳しいパターンについては、次を読み込んでください:
./references/advanced-workflows.md- Git 統合、シェル関数、高度なワークフロー
コメント
Markdown 対応