file-analysis
npx machina-cli add skill athola/claude-night-market/file-analysis --openclawFile Analysis
When To Use
- Before architecture reviews to understand module boundaries and file organization.
- When exploring unfamiliar codebases to map structure before making changes.
- As input to scope estimation for refactoring or migration work.
When NOT To Use
- General code exploration - use the Explore agent
- Searching for specific patterns - use Grep directly
Required TodoWrite Items
file-analysis:root-identifiedfile-analysis:structure-mappedfile-analysis:patterns-detectedfile-analysis:hotspots-noted
Mark each item as complete as you finish the corresponding step.
Step 1: Identify Root (file-analysis:root-identified)
- Confirm the analysis root directory with
pwd. - Note any monorepo boundaries, workspace roots, or subproject paths.
- Capture the project type (language, framework) from manifest files (
package.json,Cargo.toml,pyproject.toml, etc.).
Step 2: Map Structure (file-analysis:structure-mapped)
- Run
tree -L 2 -dorfind . -type d -maxdepth 2to capture the top-level directory layout. - Identify standard directories:
src/,lib/,tests/,docs/,scripts/,configs/. - Note any non-standard organization patterns that may affect downstream analysis.
Step 3: Detect Patterns (file-analysis:patterns-detected)
- Use
find . -name "*.ext" | wc -lto count files by extension. - Identify dominant languages and their file distributions.
- Note configuration files, generated files, and vendored dependencies.
- Run
wc -l $(find . -name "*.py" -o -name "*.rs" | head -20)to sample file sizes.
Step 4: Note Hotspots (file-analysis:hotspots-noted)
- Identify large files (potential "god objects"):
find . -type f -exec wc -l {} + | sort -rn | head -10. - Flag deeply nested directories that may indicate complexity.
- Note files with unusual naming conventions or placement.
Exit Criteria
TodoWriteitems are completed with concrete observations.- Downstream workflows (architecture review, refactoring) have structural context.
- File counts, directory layout, and hotspots are documented for reference.
Troubleshooting
Common Issues
Command not found Ensure all dependencies are installed and in PATH
Permission errors Check file permissions and run with appropriate privileges
Unexpected behavior
Enable verbose logging with --verbose flag
Source
git clone https://github.com/athola/claude-night-market/blob/master/plugins/sanctum/skills/file-analysis/SKILL.mdView on GitHub Overview
File Analysis provides structural context to support downstream review and refactoring workflows. Use it before architecture reviews to understand module boundaries and file organization, and when exploring unfamiliar codebases to map structure and estimate scope for refactoring or migration. It should not be used for general code exploration or for searching patterns—use the Explore agent or Grep directly.
How This Skill Works
It begins by identifying the analysis root (pwd and project type from manifest files). It then maps the top-level structure using commands like tree -L 2 -d or find . -type d -maxdepth 2 to capture layout and standard dirs (src/, lib/, tests/, docs/, configs). Finally it detects patterns by counting files by extension with wc -l, sampling file sizes, noting config, generated, and vendored files, and recording hotspots with TodoWrite items.
When to Use It
- Before architecture reviews to understand module boundaries and file organization.
- When exploring unfamiliar codebases to map structure before making changes.
- As input to scope estimation for refactoring or migration work.
- During onboarding of new team members to quickly surface the project structure.
- When auditing monorepos to identify boundaries and dependencies.
Quick Start
- Step 1: Identify the analysis root with pwd and capture project type from manifest files.
- Step 2: Map the top-level structure with tree -L 2 -d or find to capture layout and standard dirs.
- Step 3: Detect patterns and hotspots by counting files by extension, sampling sizes, and noting configs/generated/vendored files; document results with TodoWrite.
Best Practices
- Run root discovery with pwd and capture monorepo boundaries and project type from manifest files.
- Map the structure with tree -L 2 -d or find to capture top-level directories.
- Identify standard dirs (src/, lib/, tests/, docs/, configs/) and note non-standard patterns that affect analysis.
- Count files by extension and sample file sizes to identify dominant languages and hotspots.
- Document findings as TodoWrite items (root-identified, structure-mapped, patterns-detected, hotspots-noted).
Example Use Cases
- Analyzing a new Node.js monorepo to map packages and boundaries before an architecture review.
- Refactoring a Python project with multiple modules to estimate scope and migration needs.
- Auditing a legacy codebase to locate god objects and data-heavy hotspots.
- Preparing for a migration from a monorepo to microservices by outlining folder structure.
- Onboarding a new team to a Rust project by outlining module layout and boundaries.