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/project-analyzer/analyzer.mjs
# Analyze specific directory
node .claude/tools/project-analyzer/analyzer.mjs /path/to/project
# Output to file
node .claude/tools/project-analyzer/analyzer.mjs --output .claude/context/artifacts/project-analysis.json
# Run tests
node .claude/tools/project-analyzer/tests/analyzer.test.mjs
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": []
}
}
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. Detects project type, frameworks, dependencies, architecture patterns, and generates comprehensive project profile. Essential for Conductor integration and onboarding existing projects.4---56<identity>7Project Analyzer - Automated brownfield codebase analysis for rapid project onboarding and understanding.8</identity>910<capabilities>11- Detecting project type (frontend, backend, fullstack, library, cli, mobile, monorepo)12- Identifying frameworks and libraries from manifests and structure13- Generating file statistics and language breakdown14- Mapping component relationships and module structure15- Detecting architecture patterns (MVC, layered, microservices, etc.)16- Analyzing dependency health and outdated packages17- Identifying code quality indicators (linting, testing, type safety)18- Detecting technical debt and anti-patterns19- Generating prioritized improvement recommendations20</capabilities>2122<instructions>23<execution_process>2425### Step 1: Identify Project Root2627Locate project root by finding manifest files:28291. **Search for package manager files**:30 - `package.json` (Node.js/JavaScript/TypeScript)31 - `requirements.txt`, `pyproject.toml`, `setup.py` (Python)32 - `go.mod` (Go)33 - `Cargo.toml` (Rust)34 - `pom.xml`, `build.gradle` (Java/Maven/Gradle)35 - `composer.json` (PHP)36372. **Identify project root**:38 - Directory containing primary package manager file39 - Handle monorepos (multiple package.json files)40 - Detect workspace configuration41423. **Validate project root**:43 - Check for `.git` directory44 - Verify source code directories exist45 - Ensure manifest files are parsable4647### Step 2: Detect Project Type4849Classify project based on manifest files and directory structure:50511. **Frontend Projects**:52 - Indicators: React, Vue, Angular, Svelte dependencies53 - Directory: `src/components/`, `public/`, `assets/`54 - Frameworks: Next.js, Nuxt.js, Gatsby, Vite55562. **Backend Projects**:57 - Indicators: Express, FastAPI, Django, Flask, Gin dependencies58 - Directory: `routes/`, `controllers/`, `models/`, `api/`59 - Frameworks: Next.js API routes, FastAPI, Express60613. **Fullstack Projects**:62 - Indicators: Both frontend and backend frameworks63 - Directory: Combined frontend + backend structure64 - Frameworks: Next.js, Remix, SvelteKit, Nuxt.js65664. **Library/Package Projects**:67 - Indicators: No application-specific directories68 - Files: `index.ts`, `lib/`, `dist/`, `build/`69 - Manifests: `library` field in package.json70715. **CLI Projects**:72 - Indicators: `bin` field in package.json73 - Files: CLI entry points, command parsers74 - Dependencies: Commander, Yargs, Inquirer75766. **Mobile Projects**:77 - Indicators: React Native, Flutter, Ionic dependencies78 - Files: `android/`, `ios/`, `mobile/`79 - Frameworks: React Native, Expo, Flutter80817. **Monorepo Projects**:82 - Indicators: `workspaces` in package.json, `pnpm-workspace.yaml`83 - Structure: Multiple packages in subdirectories84 - Tools: Turborepo, Nx, Lerna85868. **Microservices Projects**:87 - Indicators: Multiple service directories88 - Files: `docker-compose.yml`, service configs89 - Structure: Service-based organization9091### Step 3: Framework Detection9293Identify frameworks from manifest files and imports:94951. **Read package.json dependencies** (Node.js):96 - Parse `dependencies` and `devDependencies`97 - Detect framework versions98 - Categorize by type (framework, ui-library, testing, etc.)991002. **Read requirements.txt** (Python):101 - Parse Python dependencies102 - Detect FastAPI, Django, Flask103 - Identify version constraints1041053. **Analyze imports** (optional deep scan):106 - Scan source files for import statements107 - Detect used vs declared dependencies108 - Identify framework-specific patterns1091104. **Framework Categories**:111 - **Framework**: React, Next.js, FastAPI, Express112 - **UI Library**: Material-UI, Ant Design, Chakra UI113 - **State Management**: Redux, Zustand, Pinia114 - **Testing**: Jest, Vitest, Cypress, Playwright115 - **Build Tool**: Vite, Webpack, Rollup, esbuild116 - **Database**: Prisma, TypeORM, SQLAlchemy117 - **ORM**: Prisma, Sequelize, Mongoose118 - **API**: tRPC, GraphQL, REST119 - **Auth**: NextAuth, Auth0, Clerk120 - **Logging**: Winston, Pino, Bunyan121 - **Monitoring**: Sentry, Datadog, New Relic1221235. **Confidence Scoring**:124 - **1.0**: Framework listed in dependencies125 - **0.8**: Framework detected from imports126 - **0.6**: Framework inferred from structure127128### Step 4: File Statistics129130Generate quantitative project statistics:1311321. **Count files by type**:133 - Use glob patterns for common extensions134 - Exclude: `node_modules/`, `.git/`, `dist/`, `build/`135 - Group by language/file type1361372. **Count lines of code**:138 - Read source files and count lines139 - Exclude empty lines and comments (optional)140 - Calculate total LOC per language1411423. **Identify largest files**:143 - Track file sizes (line count)144 - Report top 10 largest files145 - Flag files > 1000 lines (violates micro-service principle)1461474. **Calculate averages**:148 - Average file size (lines)149 - Average directory depth150 - Files per directory1511525. **Language Detection**:153 - Map extensions to languages:154 - `.ts`, `.tsx` → TypeScript155 - `.js`, `.jsx` → JavaScript156 - `.py` → Python157 - `.go` → Go158 - `.rs` → Rust159 - `.java` → Java160 - `.md` → Markdown161 - `.json` → JSON162 - `.yaml`, `.yml` → YAML163164### Step 5: Structure Analysis165166Analyze project structure and architecture:1671681. **Identify root directories**:169 - Classify directories by purpose:170 - **source**: `src/`, `app/`, `lib/`171 - **tests**: `test/`, `__tests__/`, `cypress/`172 - **config**: `config/`, `.config/`173 - **docs**: `docs/`, `documentation/`174 - **build**: `dist/`, `build/`, `out/`175 - **scripts**: `scripts/`, `bin/`176 - **assets**: `assets/`, `static/`, `public/`1771782. **Detect entry points**:179 - Main entry: `index.ts`, `main.py`, `app.py`180 - App entry: `app.ts`, `server.ts`, `app/page.tsx`181 - Handler: `handler.ts`, `lambda.ts`182 - CLI: `cli.ts`, `bin/`1831843. **Detect architecture pattern**:185 - **MVC**: `models/`, `views/`, `controllers/`186 - **Layered**: `presentation/`, `business/`, `data/`187 - **Hexagonal**: `domain/`, `application/`, `infrastructure/`188 - **Microservices**: Multiple service directories189 - **Modular**: Feature-based organization190 - **Flat**: All files in src/1911924. **Detect module system**:193 - Check `package.json` for `"type": "module"` (ESM)194 - Scan for `import`/`export` (ESM) vs `require` (CommonJS)195 - Identify mixed module systems196197### Step 6: Dependency Analysis198199Analyze dependency health:2002011. **Count dependencies**:202 - Production dependencies203 - Development dependencies204 - Total dependency count2052062. **Check for outdated packages** (optional):207 - Run `npm outdated` or equivalent208 - Parse output for outdated packages209 - Identify major version updates (breaking changes)2102113. **Security scan** (optional):212 - Run `npm audit` or equivalent213 - Identify vulnerabilities by severity214 - Flag critical security issues215216### Step 7: Code Quality Indicators217218Detect code quality tooling:2192201. **Linting Configuration**:221 - Detect: `.eslintrc.json`, `eslint.config.js`, `ruff.toml`222 - Tool: ESLint, Ruff, Flake8, Pylint223 - Run linter if configured (optional)2242252. **Formatting Configuration**:226 - Detect: `.prettierrc`, `pyproject.toml` (Black/Ruff)227 - Tool: Prettier, Black, Ruff2282293. **Testing Framework**:230 - Detect: Jest, Vitest, Pytest, Cypress231 - Count test files232 - Check for coverage configuration2332344. **Type Safety**:235 - Detect TypeScript: `tsconfig.json`236 - Check strict mode: `"strict": true`237 - Detect Python typing: mypy, pyright238239### Step 8: Pattern Detection240241Identify common patterns and anti-patterns:2422431. **Good Practices**:244 - Modular component structure245 - Comprehensive test coverage246 - TypeScript strict mode enabled247 - CI/CD configuration present2482492. **Anti-Patterns**:250 - Large files (> 1000 lines)251 - Missing tests252 - Outdated dependencies253 - No linting configuration2542553. **Neutral Patterns**:256 - Specific architecture choices257 - Framework-specific patterns258259### Step 9: Technical Debt Analysis260261Calculate technical debt score:2622631. **Debt Indicators**:264 - **Outdated Dependencies**: Count outdated packages265 - **Missing Tests**: Low test file ratio266 - **Dead Code**: Unused imports/exports (optional)267 - **Complexity**: Large files, deep nesting268 - **Documentation**: Missing README, docs269 - **Security**: Known vulnerabilities270 - **Performance**: Bundle size, load time2712722. **Debt Score** (0-100):273 - 0-20: Excellent health274 - 21-40: Good health, minor issues275 - 41-60: Moderate debt, needs attention276 - 61-80: High debt, refactoring recommended277 - 81-100: Critical debt, major overhaul needed2782793. **Remediation Effort**:280 - **Trivial**: < 1 hour281 - **Minor**: 1-4 hours282 - **Moderate**: 1-3 days283 - **Major**: 1-2 weeks284 - **Massive**: > 2 weeks285286### Step 10: Generate Recommendations287288Create prioritized improvement recommendations:2892901. **Categorize Recommendations**:291 - **Security**: Critical vulnerabilities, outdated auth292 - **Performance**: Bundle optimization, lazy loading293 - **Maintainability**: Refactor large files, add tests294 - **Testing**: Increase coverage, add E2E tests295 - **Documentation**: Add README, API docs296 - **Architecture**: Improve modularity, separation of concerns297 - **Dependencies**: Update packages, remove unused2982992. **Prioritize by Impact**:300 - **P0**: Critical security, blocking production301 - **P1**: High impact, affects reliability302 - **P2**: Medium impact, improves quality303 - **P3**: Low impact, nice-to-have3043053. **Estimate Effort and Impact**:306 - Effort: trivial, minor, moderate, major, massive307 - Impact: low, medium, high, critical308309### Step 11: Validate Output310311Validate analysis output against schema:3123131. **Schema Validation**:314 - Validate against `project-analysis.schema.json`315 - Ensure all required fields present316 - Check data types and formats3173182. **Output Metadata**:319 - Analyzer version320 - Analysis duration (ms)321 - Files analyzed count322 - Files skipped count323 - Errors encountered324325</execution_process>326327<performance>328**Performance Requirements**:329330- **Target**: < 30 seconds for typical projects (< 10k files)331- **Optimization**:332 - Skip large directories: `node_modules/`, `.git/`, `dist/`333 - Use parallel file processing334 - Cache results for incremental analysis335 - Limit deep scans to essential files336 - Use streaming for large file counts337 </performance>338339<integration>340**Integration with Conductor**:341- Provides automated project discovery342- Eliminates manual context gathering343- Enables 80% faster brownfield onboarding344- Feeds project context to chat interface345346**Integration with Other Skills**:347348- **rule-selector**: Auto-select rules based on detected frameworks349- **repo-rag**: Semantic search for architectural patterns350- **dependency-analyzer**: Deep dependency analysis351 </integration>352353<best_practices>3543551. **Progressive Disclosure**: Start with manifest analysis, add deep scans if needed3562. **Performance First**: Skip expensive operations for large projects3573. **Fail Gracefully**: Handle missing files, parse errors3584. **Validate Output**: Always validate against schema3595. **Cache Results**: Store analysis output for reuse3606. **Incremental Updates**: Re-analyze only changed files361 </best_practices>362 </instructions>363364<examples>365<usage_example>366**Programmatic Usage**:367368```bash369# Analyze current project370node .claude/tools/project-analyzer/analyzer.mjs371372# Analyze specific directory373node .claude/tools/project-analyzer/analyzer.mjs /path/to/project374375# Output to file376node .claude/tools/project-analyzer/analyzer.mjs --output .claude/context/artifacts/project-analysis.json377378# Run tests379node .claude/tools/project-analyzer/tests/analyzer.test.mjs380```381382**Agent Invocation**:383384```385# Analyze current project386Analyze this project387388# Generate comprehensive analysis389Perform full project analysis and save to artifacts390391# Quick analysis (manifest only)392Quick project type detection393```394395</usage_example>396397<formatting_example>398**Sample Output** (`.claude/context/artifacts/project-analysis.json`):399400```json401{402 "analysis_id": "analysis-llm-rules-20250115",403 "project_type": "fullstack",404 "analyzed_at": "2025-01-15T10:30:00.000Z",405 "project_root": "C:\\dev\\projects\\LLM-RULES",406 "stats": {407 "total_files": 1243,408 "total_lines": 125430,409 "languages": {410 "JavaScript": 45230,411 "TypeScript": 38120,412 "Markdown": 25680,413 "JSON": 12400,414 "YAML": 4000415 },416 "file_types": {417 ".js": 234,418 ".mjs": 156,419 ".ts": 89,420 ".md": 312,421 ".json": 145422 },423 "directories": 87,424 "avg_file_size_lines": 101,425 "largest_files": [426 {427 "path": ".claude/tools/enforcement-gate.mjs",428 "lines": 1520429 }430 ]431 },432 "frameworks": [433 {434 "name": "nextjs",435 "version": "14.0.0",436 "category": "framework",437 "confidence": 1.0,438 "source": "package.json"439 },440 {441 "name": "react",442 "version": "18.2.0",443 "category": "framework",444 "confidence": 1.0,445 "source": "package.json"446 }447 ],448 "structure": {449 "root_directories": [450 {451 "name": ".claude",452 "purpose": "config",453 "file_count": 543454 },455 {456 "name": "conductor-main",457 "purpose": "source",458 "file_count": 234459 }460 ],461 "entry_points": [462 {463 "path": "conductor-main/src/index.ts",464 "type": "main"465 }466 ],467 "architecture_pattern": "modular",468 "module_system": "esm"469 },470 "dependencies": {471 "production": 45,472 "development": 23473 },474 "code_quality": {475 "linting": {476 "configured": true,477 "tool": "eslint"478 },479 "formatting": {480 "configured": true,481 "tool": "prettier"482 },483 "testing": {484 "framework": "vitest",485 "test_files": 89,486 "coverage_configured": true487 },488 "type_safety": {489 "typescript": true,490 "strict_mode": true491 }492 },493 "tech_debt": {494 "score": 35,495 "indicators": [496 {497 "category": "complexity",498 "severity": "medium",499 "description": "3 files exceed 1000 lines",500 "remediation_effort": "moderate"501 }502 ]503 },504 "recommendations": [505 {506 "priority": "P1",507 "category": "maintainability",508 "title": "Refactor large files",509 "description": "Break down files > 1000 lines into smaller modules",510 "effort": "moderate",511 "impact": "high"512 }513 ],514 "metadata": {515 "analyzer_version": "1.0.0",516 "analysis_duration_ms": 2340,517 "files_analyzed": 1243,518 "files_skipped": 3420,519 "errors": []520 }521}522```523524</formatting_example>525</examples>526527## References528529For additional detection patterns extracted from the Auto-Claude analysis framework, see:530531- `references/auto-claude-patterns.md` - Monorepo indicators, SERVICE_INDICATORS, SERVICE_ROOT_FILES, infrastructure detection, convention detection532- `references/service-patterns.md` - Service type detection (frontend, backend, library), framework-specific patterns, entry point detection533- `references/database-patterns.md` - Database configuration file patterns, ORM detection (Prisma, SQLAlchemy, TypeORM, Drizzle, Mongoose), connection string patterns534- `references/route-patterns.md` - Express, FastAPI, Flask, Django, Next.js, Go, Rust API route detection patterns535536These references provide comprehensive regex patterns and detection logic for brownfield codebase analysis.537538## Memory Protocol (MANDATORY)539540**Before starting:**541Read `.claude/context/memory/learnings.md`542543**After completing:**544545- New pattern -> `.claude/context/memory/learnings.md`546- Issue found -> `.claude/context/memory/issues.md`547- Decision made -> `.claude/context/memory/decisions.md`548549> ASSUME INTERRUPTION: If it's not in memory, it didn't happen.