name: file-analysis description: Analyze files in a codebase to understand structure, find patterns, extract metadata, and generate summaries. Use when exploring unfamiliar codebases, documenting project structure, or when users ask about file contents, organization, or relationships. license: MIT metadata: author: context-library version: "1.0.0"
File Analysis Skill
This skill helps AI agents analyze and understand files in a codebase effectively.
When to Use
- Exploring unfamiliar codebases or directories
- Understanding project structure and organization
- Finding files by pattern, type, or content
- Extracting metadata from files
- Generating summaries of codebase structure
- Answering questions about file locations, relationships, or contents
Core Capabilities
File Discovery
- Search for files by name pattern using glob patterns
- Filter files by extension or type
- Find files in specific directories or subdirectories
- List directory contents with appropriate filtering
File Reading and Analysis
- Read file contents efficiently
- Analyze file structure (imports, exports, dependencies)
- Extract metadata from frontmatter or headers
- Identify file relationships and dependencies
Pattern Recognition
- Find files matching specific patterns (e.g., all test files, config files)
- Group related files together
- Identify common file organization patterns
Best Practices
- Start Broad, Then Narrow: Begin with directory listings to understand structure before diving into specific files
- Use Appropriate Tools: Prefer semantic search tools for finding code patterns, and file search tools for exact matches
- Respect File Size: For very large files, read specific sections or use tools that handle large files efficiently
- Consider Context: Take into account the project's file structure conventions when searching
- Document Findings: When exploring, note important files and their purposes for future reference
Common Workflows
Exploring a New Codebase
- List the root directory to understand top-level structure
- Identify key directories (src/, components/, config/, etc.)
- Look for README or documentation files
- Examine package.json or similar dependency files
- Explore main entry points and configuration files
Finding Specific Files
- Use glob patterns to search by name (e.g.,
*.test.ts,*config*.json) - Filter results by location if needed
- Read relevant files to understand their purpose
- Check related files if dependencies are found
Analyzing File Structure
- Read the target file
- Extract imports/exports to understand dependencies
- Note key functions, classes, or patterns
- Reference related files mentioned in the code
- Document findings for the user
Examples
Finding Configuration Files
Search for: *.config.*
Common locations: root, config/, .config/
Common formats: .js, .ts, .json, .yml, .yaml
Finding Test Files
Pattern: *.test.* or *.spec.*
Typical locations: __tests__/, tests/, or next to source files
Finding Component Files
In React/Next.js: Look for .tsx, .jsx files in components/
In Astro: Look for .astro files
Framework conventions vary, check project structure first
Edge Cases to Handle
- Large Files: Some files (e.g., minified JS, large JSON dumps) may be too large to read entirely. Consider reading specific sections or using specialized analysis tools.
- Binary Files: Image, video, or compiled binary files require different approaches than text files.
-
Hidden Files: Don't forget files starting with
.when exploring directory structures. - Symlinks: Be aware that some files may be symlinks pointing to other locations.
-
Git Ignored Files: Some relevant files may be in
.gitignoreand not visible in standard searches.
Related Skills
- Code Search: For finding code patterns and implementations
- Documentation Generation: For creating summaries of file structures
- Dependency Analysis: For understanding file relationships
chat Comments (0)
Sign in to join the discussion and leave a comment.
Skill Details
GitHub Stars
0
GitHub Forks
0
Created
Jan 2026
Last Updated
4个月前
tools
tools automation tools
Related Skills
Build your own?
Join 12,000+ developers contributing to the Claude ecosystem.
No comments yet. Be the first to share your thoughts!