repository-analyzer
ClaudeSkillz: For when you need skills, but lazier
npx skills add https://github.com/jackspace/claudeskillz --skill repository-analyzerSKILL.md
Repository Analyzer
Purpose
Quickly understand unfamiliar codebases by automatically scanning structure, detecting technologies, mapping dependencies, and generating comprehensive documentation.
For SDAM users: Creates external documentation of codebase structure you can reference later. For ADHD users: Instant overview without manual exploration - saves hours of context-switching. For all users: Onboard to new projects in minutes instead of days.
Activation Triggers
- User says: "analyze repository", "understand codebase", "document project"
- Requests for: "what's in this repo", "how does this work", "codebase overview"
- New project onboarding scenarios
- Technical debt assessment requests
Core Workflow
1. Scan Repository Structure
Step 1: Get directory structure
# Use filesystem tools to map structure
tree -L 3 -I 'node_modules|.git|dist|build'
Step 2: Count files by type
# Identify languages used
find . -type f -name "*.js" | wc -l
find . -type f -name "*.py" | wc -l
find . -type f -name "*.go" | wc -l
# etc...
Step 3: Measure codebase size
# Count lines of code
cloc . --exclude-dir=node_modules,.git,dist,build
2. Detect Technologies
Languages: JavaScript, TypeScript, Python, Go, Rust, Java, etc.
Frameworks:
- Frontend: React, Vue, Angular, Svelte
- Backend: Express, FastAPI, Django, Rails
- Mobile: React Native, Flutter
- Desktop: Electron, Tauri
Detection methods:
const detectFramework = async () => {
// Check package.json
const packageJson = await readFile('package.json');
const dependencies = packageJson.dependencies || {};
if ('react' in dependencies) return 'React';
if ('vue' in dependencies) return 'Vue';
if ('express' in dependencies) return 'Express';
// Check requirements.txt
const requirements = await readFile('requirements.txt');
if (requirements.includes('fastapi')) return 'FastAPI';
if (requirements.includes('django')) return 'Django';
// Check go.mod
const goMod = await readFile('go.mod');
if (goMod.includes('gin-gonic')) return 'Gin';
return 'Unknown';
};
3. Map Dependencies
For Node.js:
# Read package.json
cat package.json | jq '.dependencies'
cat package.json | jq '.devDependencies'
# Check for outdated packages
npm outdated
For Python:
# Read requirements.txt or pyproject.toml
cat requirements.txt
# Check for outdated packages
pip list --outdated
For Go:
# Read go.mod
cat go.mod
# Check for outdated modules
go list -u -m all
4. Identify Architecture Patterns
Common patterns to detect:
- MVC (Model-View-Controller):
models/,views/,controllers/ - Layered:
api/,services/,repositories/ - Feature-based:
features/auth/,features/users/ - Domain-driven:
domain/,application/,infrastructure/ - Microservices: Multiple services in
services/directory - Monorepo: Workspaces or packages structure
Detection logic:
const detectArchitecture = (structure) => {
if (structure.includes('models') && structure.includes('views') && structure.includes('controllers')) {
return 'MVC Pattern';
}
if (structure.includes('features')) {
return 'Feature-based Architecture';
}
if (structure.includes('domain') && structure.includes('application')) {
return 'Domain-Driven Design';
}
if (structure.includes('services') && structure.includes('api-gateway')) {
return 'Microservices Architecture';
}
return 'Custom Architecture';
};
5. Extract Technical Debt
Search for indicators:
# Find TODOs
grep -r "TODO" --include="*.js" --include="*.py" --include="*.go"
# Find FIXMEs
grep -r "FIXME" --include="*.js" --include="*.py" --include="*.go"
# Find HACKs
grep -r "HACK" --include="*.js" --include="*.py" --include="*.go"
# Find deprecated code
grep -r "@deprecated" --include="*.js" --include="*.ts"
Complexity analysis:
// Identify long functions (potential refactor targets)
const analyzeFunctions = () => {
// Functions > 50 lines = high complexity
// Functions > 100 lines = very high complexity
// Cyclomatic complexity > 10 = needs refactoring
};
6. Generate Documentation
Output format:
# {Project Name} - Repository Analysis
**Generated:** {timestamp}
**Analyzed by:** Claude Code Repository Analyzer
---
## š Overview
**Primary Language:** {language}
**Framework:** {framework}
**Architecture:** {architecture pattern}
**Total Files:** {count}
**Lines of Code:** {LOC}
**Last Updated:** {git log date}
---
## š Directory Structure
project/ āāā src/ ā āāā components/ ā āāā services/ ā āāā utils/ āāā tests/ āāā docs/
---
## š Technologies
### Frontend
- React 18.2.0
- TypeScript 5.0
- Tailwind CSS 3.3
### Backend
- Node.js 18
- Express 4.18
- PostgreSQL 15
### DevOps
- Docker
- GitHub Act
...