References (archive): SCAFFOLD_SKILLS_ARCHIVE_MAP.md — ProjectAnalyzer monorepo/service detection from Auto-Claude-develop analysis/analyzers.
Step 1: Identify Project Root
Locate project root by finding manifest files:
Search for package manager files:
package.json (Node.js/JavaScript/TypeScript)
requirements.txt, pyproject.toml, setup.py (Python)
go.mod (Go)
Cargo.toml (Rust)
pom.xml, build.gradle (Java/Maven/Gradle)
composer.json (PHP)
Identify project root:
- Directory containing primary package manager file
- Handle monorepos (multiple package.json files)
- Detect workspace configuration
Validate project root:
- Check for
.git directory
- Verify source code directories exist
- Ensure manifest files are parsable
Step 2: Detect Project Type
Classify project based on manifest files and directory structure:
Frontend Projects:
- Indicators: React, Vue, Angular, Svelte dependencies
- Directory:
src/components/, public/, assets/
- Frameworks: Next.js, Nuxt.js, Gatsby, Vite
Backend Projects:
- Indicators: Express, FastAPI, Django, Flask, Gin dependencies
- Directory:
routes/, controllers/, models/, api/
- Frameworks: Next.js API routes, FastAPI, Express
Fullstack Projects:
- Indicators: Both frontend and backend frameworks
- Directory: Combined frontend + backend structure
- Frameworks: Next.js, Remix, SvelteKit, Nuxt.js
Library/Package Projects:
- Indicators: No application-specific directories
- Files:
index.ts, lib/, dist/, build/
- Manifests:
library field in package.json
CLI Projects:
- Indicators:
bin field in package.json
- Files: CLI entry points, command parsers
- Dependencies: Commander, Yargs, Inquirer
Mobile Projects:
- Indicators: React Native, Flutter, Ionic dependencies
- Files:
android/, ios/, mobile/
- Frameworks: React Native, Expo, Flutter
Monorepo Projects:
- Indicators:
workspaces in package.json, pnpm-workspace.yaml
- Structure: Multiple packages in subdirectories
- Tools: Turborepo, Nx, Lerna
Microservices Projects:
- Indicators: Multiple service directories
- Files:
docker-compose.yml, service configs
- Structure: Service-based organization
Step 3: Framework Detection
Identify frameworks from manifest files and imports:
Read package.json dependencies (Node.js):
- Parse
dependencies and devDependencies
- Detect framework versions
- Categorize by type (framework, ui-library, testing, etc.)
Read requirements.txt (Python):
- Parse Python dependencies
- Detect FastAPI, Django, Flask
- Identify version constraints
Analyze imports (optional deep scan):
- Scan source files for import statements
- Detect used vs declared dependencies
- Identify framework-specific patterns
Framework Categories:
- Framework: React, Next.js, FastAPI, Express
- UI Library: Material-UI, Ant Design, Chakra UI
- State Management: Redux, Zustand, Pinia
- Testing: Jest, Vitest, Cypress, Playwright
- Build Tool: Vite, Webpack, Rollup, esbuild
- Database: Prisma, TypeORM, SQLAlchemy
- ORM: Prisma, Sequelize, Mongoose
- API: tRPC, GraphQL, REST
- Auth: NextAuth, Auth0, Clerk
- Logging: Winston, Pino, Bunyan
- Monitoring: Sentry, Datadog, New Relic
Confidence Scoring:
- 1.0: Framework listed in dependencies
- 0.8: Framework detected from imports
- 0.6: Framework inferred from structure
Step 4: File Statistics
Generate quantitative project statistics:
Count files by type:
- Use glob patterns for common extensions
- Exclude:
node_modules/, .git/, dist/, build/
- Group by language/file type
Count lines of code:
- Read source files and count lines
- Exclude empty lines and comments (optional)
- Calculate total LOC per language
Identify largest files:
- Track file sizes (line count)
- Report top 10 largest files
- Flag files > 1000 lines (violates micro-service principle)
Calculate averages:
- Average file size (lines)
- Average directory depth
- Files per directory
Language Detection:
- Map extensions to languages:
.ts, .tsx → TypeScript
.js, .jsx → JavaScript
.py → Python
.go → Go
.rs → Rust
.java → Java
.md → Markdown
.json → JSON
.yaml, .yml → YAML
Step 5: Structure Analysis
Analyze project structure and architecture:
Identify root directories:
- Classify directories by purpose:
- source:
src/, app/, lib/
- tests:
test/, __tests__/, cypress/
- config:
config/, .config/
- docs:
docs/, documentation/
- build:
dist/, build/, out/
- scripts:
scripts/, bin/
- assets:
assets/, static/, public/
Detect entry points:
- Main entry:
index.ts, main.py, app.py
- App entry:
app.ts, server.ts, app/page.tsx
- Handler:
handler.ts, lambda.ts
- CLI:
cli.ts, bin/
Detect architecture pattern:
- MVC:
models/, views/, controllers/
- Layered:
presentation/, business/, data/
- Hexagonal:
domain/, application/, infrastructure/
- Microservices: Multiple service directories
- Modular: Feature-based organization
- Flat: All files in src/
Detect module system:
- Check
package.json for "type": "module" (ESM)
- Scan for
import/export (ESM) vs require (CommonJS)
- Identify mixed module systems
Step 6: Dependency Analysis
Analyze dependency health:
Count dependencies:
- Production dependencies
- Development dependencies
- Total dependency count
Check for outdated packages (optional):
- Run
npm outdated or equivalent
- Parse output for outdated packages
- Identify major version updates (breaking changes)
Security scan (optional):
- Run
npm audit or equivalent
- Identify vulnerabilities by severity
- Flag critical security issues
Step 7: Code Quality Indicators
Detect code quality tooling:
Linting Configuration:
- Detect:
.eslintrc.json, eslint.config.js, ruff.toml
- Tool: ESLint, Ruff, Flake8, Pylint
- Run linter if configured (optional)
Formatting Configuration:
- Detect:
.prettierrc, pyproject.toml (Black/Ruff)
- Tool: Prettier, Black, Ruff
Testing Framework:
- Detect: Jest, Vitest, Pytest, Cypress
- Count test files
- Check for coverage configuration
Type Safety:
- Detect TypeScript:
tsconfig.json
- Check strict mode:
"strict": true
- Detect Python typing: mypy, pyright
Step 8: Pattern Detection
Identify common patterns and anti-patterns:
Good Practices:
- Modular component structure
- Comprehensive test coverage
- TypeScript strict mode enabled
- CI/CD configuration present
Anti-Patterns:
- Large files (> 1000 lines)
- Missing tests
- Outdated dependencies
- No linting configuration
Neutral Patterns:
- Specific architecture choices
- Framework-specific patterns
Step 9: Technical Debt Analysis
Calculate technical debt score:
Debt Indicators:
- Outdated Dependencies: Count outdated packages
- Missing Tests: Low test file ratio
- Dead Code: Unused imports/exports (optional)
- Complexity: Large files, deep nesting
- Documentation: Missing README, docs
- Security: Known vulnerabilities
- Performance: Bundle size, load time
Debt Score (0-100):
- 0-20: Excellent health
- 21-40: Good health, minor issues
- 41-60: Moderate debt, needs attention
- 61-80: High debt, refactoring recommended
- 81-100: Critical debt, major overhaul needed
Remediation Effort:
- Trivial: < 1 hour
- Minor: 1-4 hours
- Moderate: 1-3 days
- Major: 1-2 weeks
- Massive: > 2 weeks
Step 10: Generate Recommendations
Create prioritized improvement recommendations:
Categorize Recommendations:
- Security: Critical vulnerabilities, outdated auth
- Performance: Bundle optimization, lazy loading
- Maintainability: Refactor large files, add tests
- Testing: Increase coverage, add E2E tests
- Documentation: Add README, API docs
- Architecture: Improve modularity, separation of concerns
- Dependencies: Update packages, remove unused
Prioritize by Impact:
- P0: Critical security, blocking production
- P1: High impact, affects reliability
- P2: Medium impact, improves quality
- P3: Low impact, nice-to-have
Estimate Effort and Impact:
- Effort: trivial, minor, moderate, major, massive
- Impact: low, medium, high, critical
Step 11: Validate Output
Validate analysis output against schema:
Schema Validation:
- Validate against
project-analysis.schema.json
- Ensure all required fields present
- Check data types and formats
Output Metadata:
- Analyzer version
- Analysis duration (ms)
- Files analyzed count
- Files skipped count
- Errors encountered
- Target: < 30 seconds for typical projects (< 10k files)
- Optimization:
- Skip large directories:
node_modules/, .git/, dist/
- Use parallel file processing
- Cache results for incremental analysis
- Limit deep scans to essential files
- Use streaming for large file counts
Integration with Other Skills:
- rule-selector: Auto-select rules based on detected frameworks
- repo-rag: Semantic search for architectural patterns
- dependency-analyzer: Deep dependency analysis
- Progressive Disclosure: Start with manifest analysis, add deep scans if needed
- Performance First: Skip expensive operations for large projects
- Fail Gracefully: Handle missing files, parse errors
- Validate Output: Always validate against schema
- Cache Results: Store analysis output for reuse
- Incremental Updates: Re-analyze only changed files
# Analyze current project
node .claude/tools/analysis/project-analyzer/analyzer.mjs
# Analyze specific directory
node .claude/tools/analysis/project-analyzer/analyzer.mjs /path/to/project
# Output to file
node .claude/tools/analysis/project-analyzer/analyzer.mjs --output .claude/context/artifacts/project-analysis.json
Agent Invocation:
# Analyze current project
Analyze this project
# Generate comprehensive analysis
Perform full project analysis and save to artifacts
# Quick analysis (manifest only)
Quick project type detection
{
"analysis_id": "analysis-llm-rules-20250115",
"project_type": "fullstack",
"analyzed_at": "2025-01-15T10:30:00.000Z",
"project_root": "C:\\dev\\projects\\LLM-RULES",
"stats": {
"total_files": 1243,
"total_lines": 125430,
"languages": {
"JavaScript": 45230,
"TypeScript": 38120,
"Markdown": 25680,
"JSON": 12400,
"YAML": 4000
},
"file_types": {
".js": 234,
".mjs": 156,
".ts": 89,
".md": 312,
".json": 145
},
"directories": 87,
"avg_file_size_lines": 101,
"largest_files": [
{
"path": ".claude/tools/enforcement-gate.mjs",
"lines": 1520
}
]
},
"frameworks": [
{
"name": "nextjs",
"version": "14.0.0",
"category": "framework",
"confidence": 1.0,
"source": "package.json"
},
{
"name": "react",
"version": "18.2.0",
"category": "framework",
"confidence": 1.0,
"source": "package.json"
}
],
"structure": {
"root_directories": [
{
"name": ".claude",
"purpose": "config",
"file_count": 543
},
{
"name": "conductor-main",
"purpose": "source",
"file_count": 234
}
],
"entry_points": [
{
"path": "conductor-main/src/index.ts",
"type": "main"
}
],
"architecture_pattern": "modular",
"module_system": "esm"
},
"dependencies": {
"production": 45,
"development": 23
},
"code_quality": {
"linting": {
"configured": true,
"tool": "eslint"
},
"formatting": {
"configured": true,
"tool": "prettier"
},
"testing": {
"framework": "vitest",
"test_files": 89,
"coverage_configured": true
},
"type_safety": {
"typescript": true,
"strict_mode": true
}
},
"tech_debt": {
"score": 35,
"indicators": [
{
"category": "complexity",
"severity": "medium",
"description": "3 files exceed 1000 lines",
"remediation_effort": "moderate"
}
]
},
"recommendations": [
{
"priority": "P1",
"category": "maintainability",
"title": "Refactor large files",
"description": "Break down files > 1000 lines into smaller modules",
"effort": "moderate",
"impact": "high"
}
],
"metadata": {
"analyzer_version": "1.0.0",
"analysis_duration_ms": 2340,
"files_analyzed": 1243,
"files_skipped": 3420,
"errors": []
}
}
Smart Categorization Scoring (Inspired by Skill_Seekers smart_categorize)
When classifying files, directories, or components into categories, use weighted keyword scoring instead of simple string matching to prevent false positives:
| Signal Source |
Score Weight |
Example |
| File path/URL |
3 points |
/api/routes/ matches "API" category |
| File/class name |
2 points |
AuthService.ts matches "Authentication" |
| File content/imports |
1 point |
import express matches "Backend" |
Threshold: Require 2+ total points before assigning a category. Falls back to "other" if no category scores above threshold. This prevents weak single-signal matches from misclassifying components.
Category keywords (extend per project type):
- API: route, endpoint, controller, handler, middleware, api, rest, graphql
- Auth: auth, login, session, jwt, oauth, token, credential, permission
- Database: model, schema, migration, seed, repository, entity, query
- Testing: test, spec, fixture, mock, stub, e2e, integration
- Config: config, env, setting, constant, option, feature-flag
- UI: component, view, page, layout, template, style, theme
Three-Stream Analysis (Inspired by Skill_Seekers unified_codebase_analyzer)
For comprehensive project understanding, analyze three parallel streams:
Stream 1 — Code Analysis: AST patterns, framework detection, dependency graph, architecture classification. This is the existing core workflow (Steps 1-11).
Stream 2 — Documentation: README quality, API docs existence, inline doc coverage, changelog maintenance, contribution guides. Score: docFiles / totalFiles weighted by type.
Stream 3 — Community/Operations: Git activity (commit frequency, contributor count), CI/CD configuration, issue templates, PR templates, release workflow, Docker/container setup.
Combine all three streams into the output JSON under analysis.streams:
{
"streams": {
"code": { "score": 0.85, "findings": [...] },
"documentation": { "score": 0.60, "findings": [...] },
"operations": { "score": 0.75, "findings": [...] }
},
"compositeHealth": 0.73
}
Design Pattern Recognition (Inspired by Skill_Seekers C3.1 PatternRecognizer)
Detect common design patterns with confidence scoring:
| Pattern |
Detection Signal |
Confidence Threshold |
| Singleton |
Private constructor + static instance |
0.80 |
| Factory |
create* methods returning interface types |
0.70 |
| Observer |
subscribe/on/emit/addEventListener |
0.70 |
| Strategy |
Interface + multiple implementations |
0.60 |
| Decorator |
Wrapper classes with same interface |
0.60 |
| Repository |
Data access layer abstraction |
0.70 |
| Middleware |
Chain-of-responsibility in request pipeline |
0.70 |
Output detected patterns in the analysis JSON with location, confidence, and evidence:
{
"patterns": [
{
"type": "Factory",
"category": "Creational",
"confidence": 0.85,
"location": "src/services/UserFactory.ts",
"evidence": ["createUser method", "returns IUser interface"]
}
]
}
References
For additional detection patterns extracted from the Auto-Claude analysis framework, see:
references/auto-claude-patterns.md - Monorepo indicators, SERVICE_INDICATORS, SERVICE_ROOT_FILES, infrastructure detection, convention detection
references/service-patterns.md - Service type detection (frontend, backend, library), framework-specific patterns, entry point detection
references/database-patterns.md - Database configuration file patterns, ORM detection (Prisma, SQLAlchemy, TypeORM, Drizzle, Mongoose), connection string patterns
references/route-patterns.md - Express, FastAPI, Flask, Django, Next.js, Go, Rust API route detection patterns
These references provide comprehensive regex patterns and detection logic for brownfield codebase analysis.
Memory Protocol (MANDATORY)
Before starting:
Read .claude/context/memory/learnings.md
After completing:
- New pattern ->
.claude/context/memory/learnings.md
- Issue found ->
.claude/context/memory/issues.md
- Decision made ->
.claude/context/memory/decisions.md
ASSUME INTERRUPTION: If it's not in memory, it didn't happen.
1---2name: project-analyzer3description: Automated brownfield codebase analysis with weighted keyword scoring, three-stream analysis, and design pattern recognition. Detects project type, frameworks, dependencies, architecture patterns, and generates comprehensive project profile.4---56**References (archive):** [SCAFFOLD_SKILLS_ARCHIVE_MAP.md](../../docs/SCAFFOLD_SKILLS_ARCHIVE_MAP.md) — ProjectAnalyzer monorepo/service detection from Auto-Claude-develop analysis/analyzers.78<identity>9Project Analyzer - Automated brownfield codebase analysis for rapid project onboarding and understanding.10</identity>1112<capabilities>13- Detecting project type (frontend, backend, fullstack, library, cli, mobile, monorepo)14- Identifying frameworks and libraries from manifests and structure15- Generating file statistics and language breakdown16- Mapping component relationships and module structure17- Detecting architecture patterns (MVC, layered, microservices, etc.)18- Analyzing dependency health and outdated packages19- Identifying code quality indicators (linting, testing, type safety)20- Detecting technical debt and anti-patterns21- Generating prioritized improvement recommendations22</capabilities>2324<instructions>25<execution_process>2627### Step 1: Identify Project Root2829Locate project root by finding manifest files:30311. **Search for package manager files**:32 - `package.json` (Node.js/JavaScript/TypeScript)33 - `requirements.txt`, `pyproject.toml`, `setup.py` (Python)34 - `go.mod` (Go)35 - `Cargo.toml` (Rust)36 - `pom.xml`, `build.gradle` (Java/Maven/Gradle)37 - `composer.json` (PHP)38392. **Identify project root**:40 - Directory containing primary package manager file41 - Handle monorepos (multiple package.json files)42 - Detect workspace configuration43443. **Validate project root**:45 - Check for `.git` directory46 - Verify source code directories exist47 - Ensure manifest files are parsable4849### Step 2: Detect Project Type5051Classify project based on manifest files and directory structure:52531. **Frontend Projects**:54 - Indicators: React, Vue, Angular, Svelte dependencies55 - Directory: `src/components/`, `public/`, `assets/`56 - Frameworks: Next.js, Nuxt.js, Gatsby, Vite57582. **Backend Projects**:59 - Indicators: Express, FastAPI, Django, Flask, Gin dependencies60 - Directory: `routes/`, `controllers/`, `models/`, `api/`61 - Frameworks: Next.js API routes, FastAPI, Express62633. **Fullstack Projects**:64 - Indicators: Both frontend and backend frameworks65 - Directory: Combined frontend + backend structure66 - Frameworks: Next.js, Remix, SvelteKit, Nuxt.js67684. **Library/Package Projects**:69 - Indicators: No application-specific directories70 - Files: `index.ts`, `lib/`, `dist/`, `build/`71 - Manifests: `library` field in package.json72735. **CLI Projects**:74 - Indicators: `bin` field in package.json75 - Files: CLI entry points, command parsers76 - Dependencies: Commander, Yargs, Inquirer77786. **Mobile Projects**:79 - Indicators: React Native, Flutter, Ionic dependencies80 - Files: `android/`, `ios/`, `mobile/`81 - Frameworks: React Native, Expo, Flutter82837. **Monorepo Projects**:84 - Indicators: `workspaces` in package.json, `pnpm-workspace.yaml`85 - Structure: Multiple packages in subdirectories86 - Tools: Turborepo, Nx, Lerna87888. **Microservices Projects**:89 - Indicators: Multiple service directories90 - Files: `docker-compose.yml`, service configs91 - Structure: Service-based organization9293### Step 3: Framework Detection9495Identify frameworks from manifest files and imports:96971. **Read package.json dependencies** (Node.js):98 - Parse `dependencies` and `devDependencies`99 - Detect framework versions100 - Categorize by type (framework, ui-library, testing, etc.)1011022. **Read requirements.txt** (Python):103 - Parse Python dependencies104 - Detect FastAPI, Django, Flask105 - Identify version constraints1061073. **Analyze imports** (optional deep scan):108 - Scan source files for import statements109 - Detect used vs declared dependencies110 - Identify framework-specific patterns1111124. **Framework Categories**:113 - **Framework**: React, Next.js, FastAPI, Express114 - **UI Library**: Material-UI, Ant Design, Chakra UI115 - **State Management**: Redux, Zustand, Pinia116 - **Testing**: Jest, Vitest, Cypress, Playwright117 - **Build Tool**: Vite, Webpack, Rollup, esbuild118 - **Database**: Prisma, TypeORM, SQLAlchemy119 - **ORM**: Prisma, Sequelize, Mongoose120 - **API**: tRPC, GraphQL, REST121 - **Auth**: NextAuth, Auth0, Clerk122 - **Logging**: Winston, Pino, Bunyan123 - **Monitoring**: Sentry, Datadog, New Relic1241255. **Confidence Scoring**:126 - **1.0**: Framework listed in dependencies127 - **0.8**: Framework detected from imports128 - **0.6**: Framework inferred from structure129130### Step 4: File Statistics131132Generate quantitative project statistics:1331341. **Count files by type**:135 - Use glob patterns for common extensions136 - Exclude: `node_modules/`, `.git/`, `dist/`, `build/`137 - Group by language/file type1381392. **Count lines of code**:140 - Read source files and count lines141 - Exclude empty lines and comments (optional)142 - Calculate total LOC per language1431443. **Identify largest files**:145 - Track file sizes (line count)146 - Report top 10 largest files147 - Flag files > 1000 lines (violates micro-service principle)1481494. **Calculate averages**:150 - Average file size (lines)151 - Average directory depth152 - Files per directory1531545. **Language Detection**:155 - Map extensions to languages:156 - `.ts`, `.tsx` → TypeScript157 - `.js`, `.jsx` → JavaScript158 - `.py` → Python159 - `.go` → Go160 - `.rs` → Rust161 - `.java` → Java162 - `.md` → Markdown163 - `.json` → JSON164 - `.yaml`, `.yml` → YAML165166### Step 5: Structure Analysis167168Analyze project structure and architecture:1691701. **Identify root directories**:171 - Classify directories by purpose:172 - **source**: `src/`, `app/`, `lib/`173 - **tests**: `test/`, `__tests__/`, `cypress/`174 - **config**: `config/`, `.config/`175 - **docs**: `docs/`, `documentation/`176 - **build**: `dist/`, `build/`, `out/`177 - **scripts**: `scripts/`, `bin/`178 - **assets**: `assets/`, `static/`, `public/`1791802. **Detect entry points**:181 - Main entry: `index.ts`, `main.py`, `app.py`182 - App entry: `app.ts`, `server.ts`, `app/page.tsx`183 - Handler: `handler.ts`, `lambda.ts`184 - CLI: `cli.ts`, `bin/`1851863. **Detect architecture pattern**:187 - **MVC**: `models/`, `views/`, `controllers/`188 - **Layered**: `presentation/`, `business/`, `data/`189 - **Hexagonal**: `domain/`, `application/`, `infrastructure/`190 - **Microservices**: Multiple service directories191 - **Modular**: Feature-based organization192 - **Flat**: All files in src/1931944. **Detect module system**:195 - Check `package.json` for `"type": "module"` (ESM)196 - Scan for `import`/`export` (ESM) vs `require` (CommonJS)197 - Identify mixed module systems198199### Step 6: Dependency Analysis200201Analyze dependency health:2022031. **Count dependencies**:204 - Production dependencies205 - Development dependencies206 - Total dependency count2072082. **Check for outdated packages** (optional):209 - Run `npm outdated` or equivalent210 - Parse output for outdated packages211 - Identify major version updates (breaking changes)2122133. **Security scan** (optional):214 - Run `npm audit` or equivalent215 - Identify vulnerabilities by severity216 - Flag critical security issues217218### Step 7: Code Quality Indicators219220Detect code quality tooling:2212221. **Linting Configuration**:223 - Detect: `.eslintrc.json`, `eslint.config.js`, `ruff.toml`224 - Tool: ESLint, Ruff, Flake8, Pylint225 - Run linter if configured (optional)2262272. **Formatting Configuration**:228 - Detect: `.prettierrc`, `pyproject.toml` (Black/Ruff)229 - Tool: Prettier, Black, Ruff2302313. **Testing Framework**:232 - Detect: Jest, Vitest, Pytest, Cypress233 - Count test files234 - Check for coverage configuration2352364. **Type Safety**:237 - Detect TypeScript: `tsconfig.json`238 - Check strict mode: `"strict": true`239 - Detect Python typing: mypy, pyright240241### Step 8: Pattern Detection242243Identify common patterns and anti-patterns:2442451. **Good Practices**:246 - Modular component structure247 - Comprehensive test coverage248 - TypeScript strict mode enabled249 - CI/CD configuration present2502512. **Anti-Patterns**:252 - Large files (> 1000 lines)253 - Missing tests254 - Outdated dependencies255 - No linting configuration2562573. **Neutral Patterns**:258 - Specific architecture choices259 - Framework-specific patterns260261### Step 9: Technical Debt Analysis262263Calculate technical debt score:2642651. **Debt Indicators**:266 - **Outdated Dependencies**: Count outdated packages267 - **Missing Tests**: Low test file ratio268 - **Dead Code**: Unused imports/exports (optional)269 - **Complexity**: Large files, deep nesting270 - **Documentation**: Missing README, docs271 - **Security**: Known vulnerabilities272 - **Performance**: Bundle size, load time2732742. **Debt Score** (0-100):275 - 0-20: Excellent health276 - 21-40: Good health, minor issues277 - 41-60: Moderate debt, needs attention278 - 61-80: High debt, refactoring recommended279 - 81-100: Critical debt, major overhaul needed2802813. **Remediation Effort**:282 - **Trivial**: < 1 hour283 - **Minor**: 1-4 hours284 - **Moderate**: 1-3 days285 - **Major**: 1-2 weeks286 - **Massive**: > 2 weeks287288### Step 10: Generate Recommendations289290Create prioritized improvement recommendations:2912921. **Categorize Recommendations**:293 - **Security**: Critical vulnerabilities, outdated auth294 - **Performance**: Bundle optimization, lazy loading295 - **Maintainability**: Refactor large files, add tests296 - **Testing**: Increase coverage, add E2E tests297 - **Documentation**: Add README, API docs298 - **Architecture**: Improve modularity, separation of concerns299 - **Dependencies**: Update packages, remove unused3003012. **Prioritize by Impact**:302 - **P0**: Critical security, blocking production303 - **P1**: High impact, affects reliability304 - **P2**: Medium impact, improves quality305 - **P3**: Low impact, nice-to-have3063073. **Estimate Effort and Impact**:308 - Effort: trivial, minor, moderate, major, massive309 - Impact: low, medium, high, critical310311### Step 11: Validate Output312313Validate analysis output against schema:3143151. **Schema Validation**:316 - Validate against `project-analysis.schema.json`317 - Ensure all required fields present318 - Check data types and formats3193202. **Output Metadata**:321 - Analyzer version322 - Analysis duration (ms)323 - Files analyzed count324 - Files skipped count325 - Errors encountered326327</execution_process>328329<performance>330**Performance Requirements**:331332- **Target**: < 30 seconds for typical projects (< 10k files)333- **Optimization**:334 - Skip large directories: `node_modules/`, `.git/`, `dist/`335 - Use parallel file processing336 - Cache results for incremental analysis337 - Limit deep scans to essential files338 - Use streaming for large file counts339 </performance>340341<integration>342**Integration with Conductor**:343- Provides automated project discovery344- Eliminates manual context gathering345- Enables 80% faster brownfield onboarding346- Feeds project context to chat interface347348**Integration with Other Skills**:349350- **rule-selector**: Auto-select rules based on detected frameworks351- **repo-rag**: Semantic search for architectural patterns352- **dependency-analyzer**: Deep dependency analysis353 </integration>354355<best_practices>3563571. **Progressive Disclosure**: Start with manifest analysis, add deep scans if needed3582. **Performance First**: Skip expensive operations for large projects3593. **Fail Gracefully**: Handle missing files, parse errors3604. **Validate Output**: Always validate against schema3615. **Cache Results**: Store analysis output for reuse3626. **Incremental Updates**: Re-analyze only changed files363 </best_practices>364 </instructions>365366<examples>367<usage_example>368**Programmatic Usage**:369370```bash371# Analyze current project372node .claude/tools/analysis/project-analyzer/analyzer.mjs373374# Analyze specific directory375node .claude/tools/analysis/project-analyzer/analyzer.mjs /path/to/project376377# Output to file378node .claude/tools/analysis/project-analyzer/analyzer.mjs --output .claude/context/artifacts/project-analysis.json379```380381**Agent Invocation**:382383```384# Analyze current project385Analyze this project386387# Generate comprehensive analysis388Perform full project analysis and save to artifacts389390# Quick analysis (manifest only)391Quick project type detection392```393394</usage_example>395396<formatting_example>397**Sample Output** (`.claude/context/artifacts/project-analysis.json`):398399```json400{401 "analysis_id": "analysis-llm-rules-20250115",402 "project_type": "fullstack",403 "analyzed_at": "2025-01-15T10:30:00.000Z",404 "project_root": "C:\\dev\\projects\\LLM-RULES",405 "stats": {406 "total_files": 1243,407 "total_lines": 125430,408 "languages": {409 "JavaScript": 45230,410 "TypeScript": 38120,411 "Markdown": 25680,412 "JSON": 12400,413 "YAML": 4000414 },415 "file_types": {416 ".js": 234,417 ".mjs": 156,418 ".ts": 89,419 ".md": 312,420 ".json": 145421 },422 "directories": 87,423 "avg_file_size_lines": 101,424 "largest_files": [425 {426 "path": ".claude/tools/enforcement-gate.mjs",427 "lines": 1520428 }429 ]430 },431 "frameworks": [432 {433 "name": "nextjs",434 "version": "14.0.0",435 "category": "framework",436 "confidence": 1.0,437 "source": "package.json"438 },439 {440 "name": "react",441 "version": "18.2.0",442 "category": "framework",443 "confidence": 1.0,444 "source": "package.json"445 }446 ],447 "structure": {448 "root_directories": [449 {450 "name": ".claude",451 "purpose": "config",452 "file_count": 543453 },454 {455 "name": "conductor-main",456 "purpose": "source",457 "file_count": 234458 }459 ],460 "entry_points": [461 {462 "path": "conductor-main/src/index.ts",463 "type": "main"464 }465 ],466 "architecture_pattern": "modular",467 "module_system": "esm"468 },469 "dependencies": {470 "production": 45,471 "development": 23472 },473 "code_quality": {474 "linting": {475 "configured": true,476 "tool": "eslint"477 },478 "formatting": {479 "configured": true,480 "tool": "prettier"481 },482 "testing": {483 "framework": "vitest",484 "test_files": 89,485 "coverage_configured": true486 },487 "type_safety": {488 "typescript": true,489 "strict_mode": true490 }491 },492 "tech_debt": {493 "score": 35,494 "indicators": [495 {496 "category": "complexity",497 "severity": "medium",498 "description": "3 files exceed 1000 lines",499 "remediation_effort": "moderate"500 }501 ]502 },503 "recommendations": [504 {505 "priority": "P1",506 "category": "maintainability",507 "title": "Refactor large files",508 "description": "Break down files > 1000 lines into smaller modules",509 "effort": "moderate",510 "impact": "high"511 }512 ],513 "metadata": {514 "analyzer_version": "1.0.0",515 "analysis_duration_ms": 2340,516 "files_analyzed": 1243,517 "files_skipped": 3420,518 "errors": []519 }520}521```522523</formatting_example>524</examples>525526## Smart Categorization Scoring (Inspired by Skill_Seekers smart_categorize)527528When classifying files, directories, or components into categories, use weighted keyword scoring instead of simple string matching to prevent false positives:529530| Signal Source | Score Weight | Example |531| -------------------- | ------------ | ----------------------------------------- |532| File path/URL | 3 points | `/api/routes/` matches "API" category |533| File/class name | 2 points | `AuthService.ts` matches "Authentication" |534| File content/imports | 1 point | `import express` matches "Backend" |535536**Threshold**: Require 2+ total points before assigning a category. Falls back to "other" if no category scores above threshold. This prevents weak single-signal matches from misclassifying components.537538**Category keywords** (extend per project type):539540- **API**: route, endpoint, controller, handler, middleware, api, rest, graphql541- **Auth**: auth, login, session, jwt, oauth, token, credential, permission542- **Database**: model, schema, migration, seed, repository, entity, query543- **Testing**: test, spec, fixture, mock, stub, e2e, integration544- **Config**: config, env, setting, constant, option, feature-flag545- **UI**: component, view, page, layout, template, style, theme546547## Three-Stream Analysis (Inspired by Skill_Seekers unified_codebase_analyzer)548549For comprehensive project understanding, analyze three parallel streams:550551**Stream 1 — Code Analysis**: AST patterns, framework detection, dependency graph, architecture classification. This is the existing core workflow (Steps 1-11).552553**Stream 2 — Documentation**: README quality, API docs existence, inline doc coverage, changelog maintenance, contribution guides. Score: `docFiles / totalFiles` weighted by type.554555**Stream 3 — Community/Operations**: Git activity (commit frequency, contributor count), CI/CD configuration, issue templates, PR templates, release workflow, Docker/container setup.556557Combine all three streams into the output JSON under `analysis.streams`:558559```json560{561 "streams": {562 "code": { "score": 0.85, "findings": [...] },563 "documentation": { "score": 0.60, "findings": [...] },564 "operations": { "score": 0.75, "findings": [...] }565 },566 "compositeHealth": 0.73567}568```569570## Design Pattern Recognition (Inspired by Skill_Seekers C3.1 PatternRecognizer)571572Detect common design patterns with confidence scoring:573574| Pattern | Detection Signal | Confidence Threshold |575| ---------- | ------------------------------------------- | -------------------- |576| Singleton | Private constructor + static instance | 0.80 |577| Factory | `create*` methods returning interface types | 0.70 |578| Observer | `subscribe`/`on`/`emit`/`addEventListener` | 0.70 |579| Strategy | Interface + multiple implementations | 0.60 |580| Decorator | Wrapper classes with same interface | 0.60 |581| Repository | Data access layer abstraction | 0.70 |582| Middleware | Chain-of-responsibility in request pipeline | 0.70 |583584Output detected patterns in the analysis JSON with location, confidence, and evidence:585586```json587{588 "patterns": [589 {590 "type": "Factory",591 "category": "Creational",592 "confidence": 0.85,593 "location": "src/services/UserFactory.ts",594 "evidence": ["createUser method", "returns IUser interface"]595 }596 ]597}598```599600## References601602For additional detection patterns extracted from the Auto-Claude analysis framework, see:603604- `references/auto-claude-patterns.md` - Monorepo indicators, SERVICE_INDICATORS, SERVICE_ROOT_FILES, infrastructure detection, convention detection605- `references/service-patterns.md` - Service type detection (frontend, backend, library), framework-specific patterns, entry point detection606- `references/database-patterns.md` - Database configuration file patterns, ORM detection (Prisma, SQLAlchemy, TypeORM, Drizzle, Mongoose), connection string patterns607- `references/route-patterns.md` - Express, FastAPI, Flask, Django, Next.js, Go, Rust API route detection patterns608609These references provide comprehensive regex patterns and detection logic for brownfield codebase analysis.610611## Memory Protocol (MANDATORY)612613**Before starting:**614Read `.claude/context/memory/learnings.md`615616**After completing:**617618- New pattern -> `.claude/context/memory/learnings.md`619- Issue found -> `.claude/context/memory/issues.md`620- Decision made -> `.claude/context/memory/decisions.md`621622> ASSUME INTERRUPTION: If it's not in memory, it didn't happen.