$npx -y skills add Toowiredd/claude-skills-automation --skill repository-analyzerAnalyzes codebases to generate comprehensive documentation including structure, languages, frameworks, dependencies, design patterns, and technical debt. Use when user says "analyze repository", "understand codebase", "document project", or when exploring unfamiliar code.
| 1 | # Repository Analyzer |
| 2 | |
| 3 | ## Purpose |
| 4 | |
| 5 | Quickly understand unfamiliar codebases by automatically scanning structure, detecting technologies, mapping dependencies, and generating comprehensive documentation. |
| 6 | |
| 7 | **For SDAM users**: Creates external documentation of codebase structure you can reference later. |
| 8 | **For ADHD users**: Instant overview without manual exploration - saves hours of context-switching. |
| 9 | **For all users**: Onboard to new projects in minutes instead of days. |
| 10 | |
| 11 | ## Activation Triggers |
| 12 | |
| 13 | - User says: "analyze repository", "understand codebase", "document project" |
| 14 | - Requests for: "what's in this repo", "how does this work", "codebase overview" |
| 15 | - New project onboarding scenarios |
| 16 | - Technical debt assessment requests |
| 17 | |
| 18 | ## Core Workflow |
| 19 | |
| 20 | ### 1. Scan Repository Structure |
| 21 | |
| 22 | **Step 1: Get directory structure** |
| 23 | ```bash |
| 24 | # Use filesystem tools to map structure |
| 25 | tree -L 3 -I 'node_modules|.git|dist|build' |
| 26 | ``` |
| 27 | |
| 28 | **Step 2: Count files by type** |
| 29 | ```bash |
| 30 | # Identify languages used |
| 31 | find . -type f -name "*.js" | wc -l |
| 32 | find . -type f -name "*.py" | wc -l |
| 33 | find . -type f -name "*.go" | wc -l |
| 34 | # etc... |
| 35 | ``` |
| 36 | |
| 37 | **Step 3: Measure codebase size** |
| 38 | ```bash |
| 39 | # Count lines of code |
| 40 | cloc . --exclude-dir=node_modules,.git,dist,build |
| 41 | ``` |
| 42 | |
| 43 | ### 2. Detect Technologies |
| 44 | |
| 45 | **Languages**: JavaScript, TypeScript, Python, Go, Rust, Java, etc. |
| 46 | |
| 47 | **Frameworks**: |
| 48 | - **Frontend**: React, Vue, Angular, Svelte |
| 49 | - **Backend**: Express, FastAPI, Django, Rails |
| 50 | - **Mobile**: React Native, Flutter |
| 51 | - **Desktop**: Electron, Tauri |
| 52 | |
| 53 | **Detection methods**: |
| 54 | ```javascript |
| 55 | const detectFramework = async () => { |
| 56 | // Check package.json |
| 57 | const packageJson = await readFile('package.json'); |
| 58 | const dependencies = packageJson.dependencies || {}; |
| 59 | |
| 60 | if ('react' in dependencies) return 'React'; |
| 61 | if ('vue' in dependencies) return 'Vue'; |
| 62 | if ('express' in dependencies) return 'Express'; |
| 63 | |
| 64 | // Check requirements.txt |
| 65 | const requirements = await readFile('requirements.txt'); |
| 66 | if (requirements.includes('fastapi')) return 'FastAPI'; |
| 67 | if (requirements.includes('django')) return 'Django'; |
| 68 | |
| 69 | // Check go.mod |
| 70 | const goMod = await readFile('go.mod'); |
| 71 | if (goMod.includes('gin-gonic')) return 'Gin'; |
| 72 | |
| 73 | return 'Unknown'; |
| 74 | }; |
| 75 | ``` |
| 76 | |
| 77 | ### 3. Map Dependencies |
| 78 | |
| 79 | **For Node.js**: |
| 80 | ```bash |
| 81 | # Read package.json |
| 82 | cat package.json | jq '.dependencies' |
| 83 | cat package.json | jq '.devDependencies' |
| 84 | |
| 85 | # Check for outdated packages |
| 86 | npm outdated |
| 87 | ``` |
| 88 | |
| 89 | **For Python**: |
| 90 | ```bash |
| 91 | # Read requirements.txt or pyproject.toml |
| 92 | cat requirements.txt |
| 93 | |
| 94 | # Check for outdated packages |
| 95 | pip list --outdated |
| 96 | ``` |
| 97 | |
| 98 | **For Go**: |
| 99 | ```bash |
| 100 | # Read go.mod |
| 101 | cat go.mod |
| 102 | |
| 103 | # Check for outdated modules |
| 104 | go list -u -m all |
| 105 | ``` |
| 106 | |
| 107 | ### 4. Identify Architecture Patterns |
| 108 | |
| 109 | **Common patterns to detect**: |
| 110 | |
| 111 | - **MVC** (Model-View-Controller): `models/`, `views/`, `controllers/` |
| 112 | - **Layered**: `api/`, `services/`, `repositories/` |
| 113 | - **Feature-based**: `features/auth/`, `features/users/` |
| 114 | - **Domain-driven**: `domain/`, `application/`, `infrastructure/` |
| 115 | - **Microservices**: Multiple services in `services/` directory |
| 116 | - **Monorepo**: Workspaces or packages structure |
| 117 | |
| 118 | **Detection logic**: |
| 119 | ```javascript |
| 120 | const detectArchitecture = (structure) => { |
| 121 | if (structure.includes('models') && structure.includes('views') && structure.includes('controllers')) { |
| 122 | return 'MVC Pattern'; |
| 123 | } |
| 124 | if (structure.includes('features')) { |
| 125 | return 'Feature-based Architecture'; |
| 126 | } |
| 127 | if (structure.includes('domain') && structure.includes('application')) { |
| 128 | return 'Domain-Driven Design'; |
| 129 | } |
| 130 | if (structure.includes('services') && structure.includes('api-gateway')) { |
| 131 | return 'Microservices Architecture'; |
| 132 | } |
| 133 | return 'Custom Architecture'; |
| 134 | }; |
| 135 | ``` |
| 136 | |
| 137 | ### 5. Extract Technical Debt |
| 138 | |
| 139 | **Search for indicators**: |
| 140 | ```bash |
| 141 | # Find TODOs |
| 142 | grep -r "TODO" --include="*.js" --include="*.py" --include="*.go" |
| 143 | |
| 144 | # Find FIXMEs |
| 145 | grep -r "FIXME" --include="*.js" --include="*.py" --include="*.go" |
| 146 | |
| 147 | # Find HACKs |
| 148 | grep -r "HACK" --include="*.js" --include="*.py" --include="*.go" |
| 149 | |
| 150 | # Find deprecated code |
| 151 | grep -r "@deprecated" --include="*.js" --include="*.ts" |
| 152 | ``` |
| 153 | |
| 154 | **Complexity analysis**: |
| 155 | ```javascript |
| 156 | // Identify long functions (potential refactor targets) |
| 157 | const analyzeFunctions = () => { |
| 158 | // Functions > 50 lines = high complexity |
| 159 | // Functions |