code-metrics

Calculate complexity, size, coupling, and duplication metrics from source code.

1|1|Updated Dec 25, 2025
One-click install
npx skills add https://github.com/uukuguy/claude-agent-framework --skill code-metrics-uukuguy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-metrics
Source: https://github.com/uukuguy/claude-agent-framework/tree/main/examples/production/07_codebase_analysis/.claude/skills/code-metrics
Command: npx skills add https://github.com/uukuguy/claude-agent-framework --skill code-metrics-uukuguy

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the need for objective code quality assessment by providing a standardized methodology for calculating various code metrics.

Core Features & Use Cases

  • Complexity Analysis: Measures cyclomatic and cognitive complexity to identify high-risk code sections.
  • Size Metrics: Tracks Lines of Code (LOC), function length, and file length against established thresholds.
  • Coupling & Duplication: Assesses module dependencies and code duplication to understand maintainability and refactoring needs.
  • Use Case: Integrate this Skill into your CI/CD pipeline to automatically flag code that exceeds complexity or duplication thresholds before merging.

Quick Start

Calculate code metrics for the provided codebase.

Frequently Asked Questions about code-metrics

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I calculate code complexity and size metrics for static analysis?

To calculate code complexity and size metrics for static analysis, this Skill parses source files into Abstract Syntax Trees (AST) to aggregate cyclomatic complexity, cognitive complexity, and Lines of Code (LOC) at function, class, and file levels.

What is cyclomatic and cognitive complexity analysis used for in software development?

Cyclomatic and cognitive complexity analysis is used to identify high-risk code sections by measuring logical branching paths. This provides an objective code quality assessment to prioritize maintainability and refactoring efforts.

How do I assess module coupling and code duplication for refactoring prioritization?

To assess module coupling and code duplication for refactoring prioritization, this Skill evaluates module dependencies and redundant code blocks against established thresholds, highlighting areas that require maintainability improvements.

Can I integrate static code analysis into a CI/CD pipeline to flag high complexity before merging?

Yes, you can integrate this static code analysis into a CI/CD pipeline to automatically flag code that exceeds complexity or duplication thresholds before merging, ensuring code quality assessment is enforced continuously.

Do I need to parse Abstract Syntax Trees to measure maintainability metrics at the file level?

Yes, measuring maintainability metrics at the file level requires parsing source files into Abstract Syntax Trees (AST). This parsing aggregates complexity, size, and coupling data across function, class, and file structures.