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/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---5
6**References (archive):** [SCAFFOLD_SKILLS_ARCHIVE_MAP.md](../../docs/SCAFFOLD_SKILLS_ARCHIVE_MAP.md) — ProjectAnalyzer monorepo/service detection from Auto-Claude-develop analysis/analyzers.
7
8<identity>
9Project Analyzer - Automated brownfield codebase analysis for rapid project onboarding and understanding.
10</identity>
11
12<capabilities>
13- Detecting project type (frontend, backend, fullstack, library, cli, mobile, monorepo)
14- Identifying frameworks and libraries from manifests and structure
15- Generating file statistics and language breakdown
16- Mapping component relationships and module structure
17- Detecting architecture patterns (MVC, layered, microservices, etc.)
18- Analyzing dependency health and outdated packages
19- Identifying code quality indicators (linting, testing, type safety)
20- Detecting technical debt and anti-patterns
21- Generating prioritized improvement recommendations
22</capabilities>
23
24<instructions>
25<execution_process>
26
27### Step 1: Identify Project Root
28
29Locate project root by finding manifest files:
30
311. **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)
38
392. **Identify project root**:
40 - Directory containing primary package manager file
41 - Handle monorepos (multiple package.json files)
42 - Detect workspace configuration
43
443. **Validate project root**:
45 - Check for `.git` directory
46 - Verify source code directories exist
47 - Ensure manifest files are parsable
48
49### Step 2: Detect Project Type
50
51Classify project based on manifest files and directory structure:
52
531. **Frontend Projects**:
54 - Indicators: React, Vue, Angular, Svelte dependencies
55 - Directory: `src/components/`, `public/`, `assets/`
56 - Frameworks: Next.js, Nuxt.js, Gatsby, Vite
57
582. **Backend Projects**:
59 - Indicators: Express, FastAPI, Django, Flask, Gin dependencies
60 - Directory: `routes/`, `controllers/`, `models/`, `api/`
61 - Frameworks: Next.js API routes, FastAPI, Express
62
633. **Fullstack Projects**:
64 - Indicators: Both frontend and backend frameworks
65 - Directory: Combined frontend + backend structure
66 - Frameworks: Next.js, Remix, SvelteKit, Nuxt.js
67
684. **Library/Package Projects**:
69 - Indicators: No application-specific directories
70 - Files: `index.ts`, `lib/`, `dist/`, `build/`
71 - Manifests: `library` field in package.json
72
735. **CLI Projects**:
74 - Indicators: `bin` field in package.json
75 - Files: CLI entry points, command parsers
76 - Dependencies: Commander, Yargs, Inquirer
77
786. **Mobile Projects**:
79 - Indicators: React Native, Flutter, Ionic dependencies
80 - Files: `android/`, `ios/`, `mobile/`
81 - Frameworks: React Native, Expo, Flutter
82
837. **Monorepo Projects**:
84 - Indicators: `workspaces` in package.json, `pnpm-workspace.yaml`
85 - Structure: Multiple packages in subdirectories
86 - Tools: Turborepo, Nx, Lerna
87
888. **Microservices Projects**:
89 - Indicators: Multiple service directories
90 - Files: `docker-compose.yml`, service configs
91 - Structure: Service-based organization
92
93### Step 3: Framework Detection
94
95Identify frameworks from manifest files and imports:
96
971. **Read package.json dependencies** (Node.js):
98 - Parse `dependencies` and `devDependencies`
99 - Detect framework versions
100 - Categorize by type (framework, ui-library, testing, etc.)
101
1022. **Read requirements.txt** (Python):
103 - Parse Python dependencies
104 - Detect FastAPI, Django, Flask
105 - Identify version constraints
106
1073. **Analyze imports** (optional deep scan):
108 - Scan source files for import statements
109 - Detect used vs declared dependencies
110 - Identify framework-specific patterns
111
1124. **Framework Categories**:
113 - **Framework**: React, Next.js, FastAPI, Express
114 - **UI Library**: Material-UI, Ant Design, Chakra UI
115 - **State Management**: Redux, Zustand, Pinia
116 - **Testing**: Jest, Vitest, Cypress, Playwright
117 - **Build Tool**: Vite, Webpack, Rollup, esbuild
118 - **Database**: Prisma, TypeORM, SQLAlchemy
119 - **ORM**: Prisma, Sequelize, Mongoose
120 - **API**: tRPC, GraphQL, REST
121 - **Auth**: NextAuth, Auth0, Clerk
122 - **Logging**: Winston, Pino, Bunyan
123 - **Monitoring**: Sentry, Datadog, New Relic
124
1255. **Confidence Scoring**:
126 - **1.0**: Framework listed in dependencies
127 - **0.8**: Framework detected from imports
128 - **0.6**: Framework inferred from structure
129
130### Step 4: File Statistics
131
132Generate quantitative project statistics:
133
1341. **Count files by type**:
135 - Use glob patterns for common extensions
136 - Exclude: `node_modules/`, `.git/`, `dist/`, `build/`
137 - Group by language/file type
138
1392. **Count lines of code**:
140 - Read source files and count lines
141 - Exclude empty lines and comments (optional)
142 - Calculate total LOC per language
143
1443. **Identify largest files**:
145 - Track file sizes (line count)
146 - Report top 10 largest files
147 - Flag files > 1000 lines (violates micro-service principle)
148
1494. **Calculate averages**:
150 - Average file size (lines)
151 - Average directory depth
152 - Files per directory
153
1545. **Language Detection**:
155 - Map extensions to languages:
156 - `.ts`, `.tsx` → TypeScript
157 - `.js`, `.jsx` → JavaScript
158 - `.py` → Python
159 - `.go` → Go
160 - `.rs` → Rust
161 - `.java` → Java
162 - `.md` → Markdown
163 - `.json` → JSON
164 - `.yaml`, `.yml` → YAML
165
166### Step 5: Structure Analysis
167
168Analyze project structure and architecture:
169
1701. **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/`
179
1802. **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/`
185
1863. **Detect architecture pattern**:
187 - **MVC**: `models/`, `views/`, `controllers/`
188 - **Layered**: `presentation/`, `business/`, `data/`
189 - **Hexagonal**: `domain/`, `application/`, `infrastructure/`
190 - **Microservices**: Multiple service directories
191 - **Modular**: Feature-based organization
192 - **Flat**: All files in src/
193
1944. **Detect module system**:
195 - Check `package.json` for `"type": "module"` (ESM)
196 - Scan for `import`/`export` (ESM) vs `require` (CommonJS)
197 - Identify mixed module systems
198
199### Step 6: Dependency Analysis
200
201Analyze dependency health:
202
2031. **Count dependencies**:
204 - Production dependencies
205 - Development dependencies
206 - Total dependency count
207
2082. **Check for outdated packages** (optional):
209 - Run `npm outdated` or equivalent
210 - Parse output for outdated packages
211 - Identify major version updates (breaking changes)
212
2133. **Security scan** (optional):
214 - Run `npm audit` or equivalent
215 - Identify vulnerabilities by severity
216 - Flag critical security issues
217
218### Step 7: Code Quality Indicators
219
220Detect code quality tooling:
221
2221. **Linting Configuration**:
223 - Detect: `.eslintrc.json`, `eslint.config.js`, `ruff.toml`
224 - Tool: ESLint, Ruff, Flake8, Pylint
225 - Run linter if configured (optional)
226
2272. **Formatting Configuration**:
228 - Detect: `.prettierrc`, `pyproject.toml` (Black/Ruff)
229 - Tool: Prettier, Black, Ruff
230
2313. **Testing Framework**:
232 - Detect: Jest, Vitest, Pytest, Cypress
233 - Count test files
234 - Check for coverage configuration
235
2364. **Type Safety**:
237 - Detect TypeScript: `tsconfig.json`
238 - Check strict mode: `"strict": true`
239 - Detect Python typing: mypy, pyright
240
241### Step 8: Pattern Detection
242
243Identify common patterns and anti-patterns:
244
2451. **Good Practices**:
246 - Modular component structure
247 - Comprehensive test coverage
248 - TypeScript strict mode enabled
249 - CI/CD configuration present
250
2512. **Anti-Patterns**:
252 - Large files (> 1000 lines)
253 - Missing tests
254 - Outdated dependencies
255 - No linting configuration
256
2573. **Neutral Patterns**:
258 - Specific architecture choices
259 - Framework-specific patterns
260
261### Step 9: Technical Debt Analysis
262
263Calculate technical debt score:
264
2651. **Debt Indicators**:
266 - **Outdated Dependencies**: Count outdated packages
267 - **Missing Tests**: Low test file ratio
268 - **Dead Code**: Unused imports/exports (optional)
269 - **Complexity**: Large files, deep nesting
270 - **Documentation**: Missing README, docs
271 - **Security**: Known vulnerabilities
272 - **Performance**: Bundle size, load time
273
2742. **Debt Score** (0-100):
275 - 0-20: Excellent health
276 - 21-40: Good health, minor issues
277 - 41-60: Moderate debt, needs attention
278 - 61-80: High debt, refactoring recommended
279 - 81-100: Critical debt, major overhaul needed
280
2813. **Remediation Effort**:
282 - **Trivial**: < 1 hour
283 - **Minor**: 1-4 hours
284 - **Moderate**: 1-3 days
285 - **Major**: 1-2 weeks
286 - **Massive**: > 2 weeks
287
288### Step 10: Generate Recommendations
289
290Create prioritized improvement recommendations:
291
2921. **Categorize Recommendations**:
293 - **Security**: Critical vulnerabilities, outdated auth
294 - **Performance**: Bundle optimization, lazy loading
295 - **Maintainability**: Refactor large files, add tests
296 - **Testing**: Increase coverage, add E2E tests
297 - **Documentation**: Add README, API docs
298 - **Architecture**: Improve modularity, separation of concerns
299 - **Dependencies**: Update packages, remove unused
300
3012. **Prioritize by Impact**:
302 - **P0**: Critical security, blocking production
303 - **P1**: High impact, affects reliability
304 - **P2**: Medium impact, improves quality
305 - **P3**: Low impact, nice-to-have
306
3073. **Estimate Effort and Impact**:
308 - Effort: trivial, minor, moderate, major, massive
309 - Impact: low, medium, high, critical
310
311### Step 11: Validate Output
312
313Validate analysis output against schema:
314
3151. **Schema Validation**:
316 - Validate against `project-analysis.schema.json`
317 - Ensure all required fields present
318 - Check data types and formats
319
3202. **Output Metadata**:
321 - Analyzer version
322 - Analysis duration (ms)
323 - Files analyzed count
324 - Files skipped count
325 - Errors encountered
326
327</execution_process>
328
329<performance>
330**Performance Requirements**:
331
332- **Target**: < 30 seconds for typical projects (< 10k files)
333- **Optimization**:
334 - Skip large directories: `node_modules/`, `.git/`, `dist/`
335 - Use parallel file processing
336 - Cache results for incremental analysis
337 - Limit deep scans to essential files
338 - Use streaming for large file counts
339 </performance>
340
341<integration>
342**Integration with Conductor**:
343- Provides automated project discovery
344- Eliminates manual context gathering
345- Enables 80% faster brownfield onboarding
346- Feeds project context to chat interface
347
348**Integration with Other Skills**:
349
350- **rule-selector**: Auto-select rules based on detected frameworks
351- **repo-rag**: Semantic search for architectural patterns
352- **dependency-analyzer**: Deep dependency analysis
353 </integration>
354
355<best_practices>
356
3571. **Progressive Disclosure**: Start with manifest analysis, add deep scans if needed
3582. **Performance First**: Skip expensive operations for large projects
3593. **Fail Gracefully**: Handle missing files, parse errors
3604. **Validate Output**: Always validate against schema
3615. **Cache Results**: Store analysis output for reuse
3626. **Incremental Updates**: Re-analyze only changed files
363 </best_practices>
364 </instructions>
365
366<examples>
367<usage_example>
368**Programmatic Usage**:
369
370```bash
371# Analyze current project
372node .claude/tools/project-analyzer/analyzer.mjs
373
374# Analyze specific directory
375node .claude/tools/project-analyzer/analyzer.mjs /path/to/project
376
377# Output to file
378node .claude/tools/project-analyzer/analyzer.mjs --output .claude/context/artifacts/project-analysis.json
379
380# Run tests
381node .claude/tools/project-analyzer/tests/analyzer.test.mjs
382```
383
384**Agent Invocation**:
385
386```
387# Analyze current project
388Analyze this project
389
390# Generate comprehensive analysis
391Perform full project analysis and save to artifacts
392
393# Quick analysis (manifest only)
394Quick project type detection
395```
396
397</usage_example>
398
399<formatting_example>
400**Sample Output** (`.claude/context/artifacts/project-analysis.json`):
401
402```json
403{
404 "analysis_id": "analysis-llm-rules-20250115",
405 "project_type": "fullstack",
406 "analyzed_at": "2025-01-15T10:30:00.000Z",
407 "project_root": "C:\\dev\\projects\\LLM-RULES",
408 "stats": {
409 "total_files": 1243,
410 "total_lines": 125430,
411 "languages": {
412 "JavaScript": 45230,
413 "TypeScript": 38120,
414 "Markdown": 25680,
415 "JSON": 12400,
416 "YAML": 4000
417 },
418 "file_types": {
419 ".js": 234,
420 ".mjs": 156,
421 ".ts": 89,
422 ".md": 312,
423 ".json": 145
424 },
425 "directories": 87,
426 "avg_file_size_lines": 101,
427 "largest_files": [
428 {
429 "path": ".claude/tools/enforcement-gate.mjs",
430 "lines": 1520
431 }
432 ]
433 },
434 "frameworks": [
435 {
436 "name": "nextjs",
437 "version": "14.0.0",
438 "category": "framework",
439 "confidence": 1.0,
440 "source": "package.json"
441 },
442 {
443 "name": "react",
444 "version": "18.2.0",
445 "category": "framework",
446 "confidence": 1.0,
447 "source": "package.json"
448 }
449 ],
450 "structure": {
451 "root_directories": [
452 {
453 "name": ".claude",
454 "purpose": "config",
455 "file_count": 543
456 },
457 {
458 "name": "conductor-main",
459 "purpose": "source",
460 "file_count": 234
461 }
462 ],
463 "entry_points": [
464 {
465 "path": "conductor-main/src/index.ts",
466 "type": "main"
467 }
468 ],
469 "architecture_pattern": "modular",
470 "module_system": "esm"
471 },
472 "dependencies": {
473 "production": 45,
474 "development": 23
475 },
476 "code_quality": {
477 "linting": {
478 "configured": true,
479 "tool": "eslint"
480 },
481 "formatting": {
482 "configured": true,
483 "tool": "prettier"
484 },
485 "testing": {
486 "framework": "vitest",
487 "test_files": 89,
488 "coverage_configured": true
489 },
490 "type_safety": {
491 "typescript": true,
492 "strict_mode": true
493 }
494 },
495 "tech_debt": {
496 "score": 35,
497 "indicators": [
498 {
499 "category": "complexity",
500 "severity": "medium",
501 "description": "3 files exceed 1000 lines",
502 "remediation_effort": "moderate"
503 }
504 ]
505 },
506 "recommendations": [
507 {
508 "priority": "P1",
509 "category": "maintainability",
510 "title": "Refactor large files",
511 "description": "Break down files > 1000 lines into smaller modules",
512 "effort": "moderate",
513 "impact": "high"
514 }
515 ],
516 "metadata": {
517 "analyzer_version": "1.0.0",
518 "analysis_duration_ms": 2340,
519 "files_analyzed": 1243,
520 "files_skipped": 3420,
521 "errors": []
522 }
523}
524```
525
526</formatting_example>
527</examples>
528
529## References
530
531For additional detection patterns extracted from the Auto-Claude analysis framework, see:
532
533- `references/auto-claude-patterns.md` - Monorepo indicators, SERVICE_INDICATORS, SERVICE_ROOT_FILES, infrastructure detection, convention detection
534- `references/service-patterns.md` - Service type detection (frontend, backend, library), framework-specific patterns, entry point detection
535- `references/database-patterns.md` - Database configuration file patterns, ORM detection (Prisma, SQLAlchemy, TypeORM, Drizzle, Mongoose), connection string patterns
536- `references/route-patterns.md` - Express, FastAPI, Flask, Django, Next.js, Go, Rust API route detection patterns
537
538These references provide comprehensive regex patterns and detection logic for brownfield codebase analysis.
539
540## Memory Protocol (MANDATORY)
541
542**Before starting:**
543Read `.claude/context/memory/learnings.md`
544
545**After completing:**
546
547- New pattern -> `.claude/context/memory/learnings.md`
548- Issue found -> `.claude/context/memory/issues.md`
549- Decision made -> `.claude/context/memory/decisions.md`
550
551> ASSUME INTERRUPTION: If it's not in memory, it didn't happen.