Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
aj-geddes avatar

Code Metrics Analysis

  • 409 installs
  • 305 repo stars
  • Updated March 4, 2026
  • aj-geddes/useful-ai-prompts

code-metrics-analysis is a code quality skill that measures complexity, churn, coverage gaps, and hotspot files for developers who need data-driven refactor priorities before merge or release.

About

code-metrics-analysis is a useful-ai-prompts skill that helps developers quantify code health before merge or release. It guides measurement of cyclomatic complexity, cognitive complexity, maintainability index, lines of code, function counts, and nesting depth using TypeScript AST analysis and Python radon tooling. The skill ships 4 reference guides covering a TypeScript complexity analyzer, Python radon metrics, an ESLint complexity plugin, and CI/CD quality gate patterns. Developers reach for code-metrics-analysis when assessing technical debt, identifying refactoring candidates, automating review gates, or tracking complexity trends across legacy modules. The skill emphasizes trends over absolute thresholds and combining multiple metrics rather than relying on a single score.

  • Complexity and cyclomatic hotspot detection
  • Churn and change-frequency risk flags
  • Test coverage gap identification
  • Dependency and coupling observations
  • Actionable refactor prioritization lists

Code Metrics Analysis by the numbers

  • 409 all-time installs (skills.sh)
  • Ranked #258 of 1,352 Code Review & Quality skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill code-metrics-analysis

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs409
repo stars305
Last updatedMarch 4, 2026
Repositoryaj-geddes/useful-ai-prompts

How do you find high-complexity refactor hotspots?

Evaluate complexity, churn, coverage gaps, and hotspot files before merge or release to catch maintainability risks and prioritize refactors.

Who is it for?

Engineering teams running pre-merge quality reviews or technical-debt audits on TypeScript and Python codebases.

Skip if: Developers who only need runtime profiling, load testing, or security penetration results without static complexity analysis.

When should I use this skill?

A developer asks to assess code complexity, identify refactoring candidates, monitor technical debt, or set CI quality gates from metrics.

What you get

Complexity metric reports, hotspot file rankings, CI quality gate thresholds, and prioritized refactor candidate lists with trend context.

  • Complexity metric reports
  • Hotspot rankings
  • CI quality gate configs

By the numbers

  • Bundles 4 reference guides for TypeScript, Python radon, ESLint complexity, and CI/CD quality gates

Files

SKILL.mdMarkdownGitHub ↗

Code Metrics Analysis

Table of Contents

Overview

Measure and analyze code quality metrics to identify complexity, maintainability issues, and areas for improvement.

When to Use

  • Code quality assessment
  • Identifying refactoring candidates
  • Technical debt monitoring
  • Code review automation
  • CI/CD quality gates
  • Team performance tracking
  • Legacy code analysis

Quick Start

Minimal working example:

import * as ts from "typescript";
import * as fs from "fs";

interface ComplexityMetrics {
  cyclomaticComplexity: number;
  cognitiveComplexity: number;
  linesOfCode: number;
  functionCount: number;
  classCount: number;
  maxNestingDepth: number;
}

class CodeMetricsAnalyzer {
  analyzeFile(filePath: string): ComplexityMetrics {
    const sourceCode = fs.readFileSync(filePath, "utf-8");
    const sourceFile = ts.createSourceFile(
      filePath,
      sourceCode,
      ts.ScriptTarget.Latest,
      true,
    );

    const metrics: ComplexityMetrics = {
      cyclomaticComplexity: 0,
      cognitiveComplexity: 0,
// ... (see reference guides for full implementation)

Reference Guides

Detailed implementations in the references/ directory:

GuideContents
TypeScript Complexity AnalyzerTypeScript Complexity Analyzer
Python Code Metrics (using radon)Python Code Metrics (using radon)
ESLint Plugin for ComplexityESLint Plugin for Complexity
CI/CD Quality GatesCI/CD Quality Gates

Best Practices

✅ DO

  • Monitor metrics over time
  • Set reasonable thresholds
  • Focus on trends, not absolute numbers
  • Automate metric collection
  • Use metrics to guide refactoring
  • Combine multiple metrics
  • Include metrics in code reviews

❌ DON'T

  • Use metrics as sole quality indicator
  • Set unrealistic thresholds
  • Ignore context and domain
  • Punish developers for metrics
  • Focus only on one metric
  • Skip documentation

Related skills

How it compares

Pick code-metrics-analysis over generic lint skills when you need quantitative complexity, churn, and maintainability scoring to prioritize refactors.

FAQ

What metrics does code-metrics-analysis cover?

code-metrics-analysis covers cyclomatic complexity, cognitive complexity, maintainability index, lines of code, function and class counts, max nesting depth, and code churn. Reference guides include TypeScript AST analysis, Python radon, ESLint complexity rules, and CI gate patte

When should I run code-metrics-analysis?

code-metrics-analysis fits pre-merge review, release readiness checks, legacy audits, and CI quality gates. The skill recommends tracking trends over time and combining multiple metrics rather than blocking merges on one absolute complexity number.

Code Review & Qualitytestingbackendfrontend

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.