File Navigation Skill
This skill encompasses tools and strategies for navigating directory structures, understanding project layouts, and locating files.
Tools
1. tree
- •Description: Displays directories and files as a recursive tree.
- •Usage: Good for a quick overview of project structure.
- •Flags:
- •
-L <level>: Limit recursion depth. - •
-I <pattern>: Ignore files matching pattern. - •
-d: List directories only.
- •
2. fd a.k.a fd-find
- •Description: A faster alternative to
find. - •Usage: Quickly locate files by name.
- •Flags:
- •
-H: Include hidden files. - •
-I: Ignore.gitignore. - •
-e <ext>: Filter by file extension.
- •
3. ls (standard)
- •Description: List directory contents.
- •Usage: Basic navigation.
- •Flags:
- •
-R: Recursive list. - •
-a: Show hidden files. - •
-l: Long format (permissions, size, etc.).
- •
Agentic Workflow
- •Assess Structure: Use
tree -L 2to understand the high-level layout. - •Explore Details: Use
ls -lto inspect specific directories. - •Locate: Use
fd(orfind) to locate specific files or patterns (e.g., config files). - •Map: Build a mental map of where components (src, tests, docs) reside.
Best Practices
- •Limit Depth: Always use depth limits (
-Lor-maxdepth) when exploring large repos to avoid overwhelming output. - •Ignore Noise: Use
-Ior.gitignoreto skipnode_modules,venv, etc. - •Combine: Use
fdto find files, thenxargsto process them (e.g.,fd -e py | xargs wc -l).