mirror of
https://github.com/centminmod/my-claude-code-setup.git
synced 2025-12-17 07:26:23 +00:00
2.8 KiB
2.8 KiB
ALWAYS START WITH THESE COMMANDS FOR COMMON TASKS
Task: "List/summarize all files and directories"
fd . -t f # Lists ALL files recursively (FASTEST)
# OR
rg --files # Lists files (respects .gitignore)
Task: "Search for content in files"
rg "search_term" # Search everywhere (FASTEST)
Task: "Find files by name"
fd "filename" # Find by name pattern (FASTEST)
Directory/File Exploration
# FIRST CHOICE - List all files/dirs recursively:
fd . -t f # All files (fastest)
fd . -t d # All directories
rg --files # All files (respects .gitignore)
# For current directory only:
ls -la # OK for single directory view
BANNED - Never Use These Slow Tools
- ❌
tree- NOT INSTALLED, usefdinstead - ❌
find- usefdorrg --files - ❌
greporgrep -r- userginstead - ❌
ls -R- userg --filesorfd - ❌
cat file | grep- userg pattern file
Use These Faster Tools Instead
# ripgrep (rg) - content search
rg "search_term" # Search in all files
rg -i "case_insensitive" # Case-insensitive
rg "pattern" -t py # Only Python files
rg "pattern" -g "*.md" # Only Markdown
rg -1 "pattern" # Filenames with matches
rg -c "pattern" # Count matches per file
rg -n "pattern" # Show line numbers
rg -A 3 -B 3 "error" # Context lines
rg " (TODO| FIXME | HACK)" # Multiple patterns
# ripgrep (rg) - file listing
rg --files # List files (respects •gitignore)
rg --files | rg "pattern" # Find files by name
rg --files -t md # Only Markdown files
# fd - file finding
fd -e js # All •js files (fast find)
fd -x command {} # Exec per-file
fd -e md -x ls -la {} # Example with ls
# jq - JSON processing
jq. data.json # Pretty-print
jq -r .name file.json # Extract field
jq '.id = 0' x.json # Modify field
Search Strategy
- Start broad, then narrow:
rg "partial" | rg "specific" - Filter by type early:
rg -t python "def function_name" - Batch patterns:
rg "(pattern1|pattern2|pattern3)" - Limit scope:
rg "pattern" src/
INSTANT DECISION TREE
User asks to "list/show/summarize/explore files"?
→ USE: fd . -t f (fastest, shows all files)
→ OR: rg --files (respects .gitignore)
User asks to "search/grep/find text content"?
→ USE: rg "pattern" (NOT grep!)
User asks to "find file/directory by name"?
→ USE: fd "name" (NOT find!)
User asks for "directory structure/tree"?
→ USE: fd . -t d (directories) + fd . -t f (files)
→ NEVER: tree (not installed!)
Need just current directory?
→ USE: ls -la (OK for single dir)