file-analysis
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.
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
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
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-01-20
- 索引更新时间
- 2026-01-26
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!