project-health-auditor

Multi-dimensional code health analysis with complexity, churn, and test coverage - identifies technical debt hot spots

View on GitHub
Author Jeremy Longshore
Namespace @jeremylongshore/claude-code-plugins-plus
Category code-quality
Version 1.0.0
Stars 1,193
Downloads 5
self.md verified
Table of content

Multi-dimensional code health analysis with complexity, churn, and test coverage - identifies technical debt hot spots

Installation

npx claude-plugins install @jeremylongshore/claude-code-plugins-plus/project-health-auditor

Contents

Folders: agents, commands, examples, servers, skills, tests

Files: CONTRIBUTING.md, LICENSE, README.md, eslint.config.mjs, package.json, server.json, tsconfig.json, vitest.config.ts

Documentation

MCP Server Plugin for Claude Code

Analyze local repositories for code health, complexity, test coverage gaps, and git churn patterns. Get multi-dimensional insights into your codebase health combining complexity metrics, change frequency, and test coverage.


Features

4 Powerful MCP Tools

1. list_repo_files - File Discovery

2. file_metrics - Code Health Analysis

3. git_churn - Change Frequency Analysis

4. map_tests - Test Coverage Mapping


Installation

# Install the plugin
/plugin install project-health-auditor@claude-code-plugins-plus

# The MCP server will be automatically available

Usage

Quick Analysis

Analyze the health of /path/to/my-project

Claude will use the MCP tools to:

  1. List all source files
  2. Analyze complexity of key files
  3. Check git churn patterns
  4. Map test coverage

Individual Tool Usage

List Repository Files:

Use list_repo_files on /path/to/repo with globs ["src/**/*.ts", "lib/**/*.js"]

Analyze File Metrics:

What's the complexity of src/services/auth.ts?

Check Git Churn:

Show me the most frequently changed files in the last 6 months

Map Tests:

Which files are missing tests in this project?

️ MCP Tools Reference

list_repo_files

Purpose: Discover files in a repository

Input:

{
  repoPath: string;           // Absolute path to repository
  globs?: string[];           // Patterns to match (default: ["**/*"])
  exclude?: string[];         // Patterns to exclude
}

Output:

{
  "repoPath": "/path/to/repo",
  "totalFiles": 245,
  "files": ["src/index.ts", "src/utils/helper.ts", ...],
  "patterns": ["**/*"],
  "excluded": ["node_modules/**", ".git/**"]
}

file_metrics

Purpose: Analyze a single file’s health

Input:

{
  filePath: string;  // Absolute path to file
}

Output:

{
  "file": "src/services/auth.ts",
  "size": 12543,
  "lines": 342,
  "extension": ".ts",
  "complexity": {
    "cyclomatic": 28,
    "functions": 12,
    "averagePerFunction": 2
  },
  "comments": {
    "lines": 45,
    "ratio": 13.16
  },
  "healthScore": 75
}

Health Score Factors:


git_churn

Purpose: Find frequently changing files (hot spots)

Input:

{
  repoPath: string;             // Absolute path to git repository
  since?: string;               // Time period (default: "6 months ago")
}

Output:

{
  "repoPath": "/path/to/repo",
  "since": "6 months ago",
  "totalCommits": 342,
  "filesChanged": 156,
  "topChurnFiles": [
    {
      "file": "src/api/handler.ts",
      "commits": 45,
      "authors": ["Alice", "Bob"],
      "authorCount": 2
    }
  ],
  "summary": {
    "highChurn": 12,      // >10 commits
    "mediumChurn": 34,    // 5-10 commits
    "lowChurn": 110       // <5 commits
  }
}

High churn files are candidates for refactoring or stabilization.


map_tests

Purpose: Identify test coverage gaps

Input:

{
  repoPath: string;  // Absolute path to repository
}

Output:

{
  "repoPath": "/path/to/repo",
  "summary": {
    "totalSourceFiles": 156,
    "totalTestFiles": 98,
    "testedFiles": 102,
    "coverageRatio": 65.38
  },
  "coverage": {
    "src/services/auth.ts": ["src/services/auth.test.ts"],
    "src/utils/helper.ts": ["src/utils/helper.spec.ts"]
  },
  "missingTests": [
    "src/api/legacy.ts",
    "src/utils/old-helper.ts"
  ],
  "recommendations": [
    "️  Test coverage is below 80%. Consider adding tests for remaining files.",
    " High priority: Add tests for 23 files in critical directories"
  ]
}

Use Cases

1. Pre-Refactoring Analysis

Before refactoring, identify:

Strategy: Refactor high-complexity, high-churn files first.

2. Code Review Preparation

Analyze changed files:

What's the complexity of the files I changed in the last commit?

3. Test Coverage Improvement

Fin

…(truncated)

Source

View on GitHub

Tags: code-quality mcpcode-qualitytechnical-debtcomplexitygit-churntest-coverageanalytics