Project analyzer

From oimiragieo/agent-studio · View interactive version

Project analyzer is an AI agent skill from the GitHub repository oimiragieo/agent-studio. 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.

How to use this skill

Skill file

References (archive): SCAFFOLD_SKILLS_ARCHIVE_MAP.md — ProjectAnalyzer monorepo/service detection from Auto-Claude-develop analysis/analyzers.

<identity>

Project Analyzer - Automated brownfield codebase analysis for rapid project onboarding and understanding.

</identity>

<capabilities>

</capabilities>

<instructions>

<execution_process>

Step 1: Identify Project Root

Locate project root by finding manifest files:

  1. Search for package manager files:
  1. Identify project root:
  1. Validate project root:

Step 2: Detect Project Type

Classify project based on manifest files and directory structure:

  1. Frontend Projects:
  1. Backend Projects:
  1. Fullstack Projects:
  1. Library/Package Projects:
  1. CLI Projects:
  1. Mobile Projects:
  1. Monorepo Projects:
  1. Microservices Projects:

Step 3: Framework Detection

Identify frameworks from manifest files and imports:

  1. Read package.json dependencies (Node.js):
  1. Read requirements.txt (Python):
  1. Analyze imports (optional deep scan):
  1. Framework Categories:
  1. Confidence Scoring:

Step 4: File Statistics

Generate quantitative project statistics:

  1. Count files by type:
  1. Count lines of code:
  1. Identify largest files:
  1. Calculate averages:
  1. Language Detection:

Step 5: Structure Analysis

Analyze project structure and architecture:

  1. Identify root directories:
  1. Detect entry points:
  1. Detect architecture pattern:
  1. Detect module system:

Step 6: Dependency Analysis

Analyze dependency health:

  1. Count dependencies:
  1. Check for outdated packages (optional):
  1. Security scan (optional):

Step 7: Code Quality Indicators

Detect code quality tooling:

  1. Linting Configuration:
  1. Formatting Configuration:
  1. Testing Framework:
  1. Type Safety:

Step 8: Pattern Detection

Identify common patterns and anti-patterns:

  1. Good Practices:
  1. Anti-Patterns:
  1. Neutral Patterns:

Step 9: Technical Debt Analysis

Calculate technical debt score:

  1. Debt Indicators:
  1. Debt Score (0-100):
  1. Remediation Effort:

Step 10: Generate Recommendations

Create prioritized improvement recommendations:

  1. Categorize Recommendations:
  1. Prioritize by Impact:
  1. Estimate Effort and Impact:

Step 11: Validate Output

Validate analysis output against schema:

  1. Schema Validation:
  1. Output Metadata:

</execution_process>

<performance>

Performance Requirements:

</performance>

<integration>

Integration with Conductor:

Integration with Other Skills:

</integration>

<best_practices>

  1. Progressive Disclosure: Start with manifest analysis, add deep scans if needed
  2. Performance First: Skip expensive operations for large projects
  3. Fail Gracefully: Handle missing files, parse errors
  4. Validate Output: Always validate against schema
  5. Cache Results: Store analysis output for reuse
  6. Incremental Updates: Re-analyze only changed files

</best_practices>

</instructions>

<examples>

<usage_example>

Programmatic Usage:

# 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

</usage_example>

<formatting_example>

Sample Output (.claude/context/artifacts/project-analysis.json):

{
  "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": []
  }
}

</formatting_example>

</examples>

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):

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:

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:

ASSUME INTERRUPTION: If it's not in memory, it didn't happen.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.