← Back to Skills Marketplace
johnnywang2001

Code Metrics

by John Wang · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
136
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install code-metrics
Description
Analyze code quality metrics including lines of code by language, cyclomatic complexity (Python), function/class counts, comment ratios, and largest file ran...
README (SKILL.md)

Code Metrics

Analyze code quality and complexity metrics across your project. Supports 17+ languages.

Quick Start

# Analyze current project
python3 scripts/code_metrics.py

# Analyze specific directory
python3 scripts/code_metrics.py /path/to/project

# JSON output
python3 scripts/code_metrics.py --json

# Skip complexity analysis (faster)
python3 scripts/code_metrics.py --no-complexity

# Exclude additional directories
python3 scripts/code_metrics.py --exclude migrations fixtures

Metrics Provided

  • Lines of Code — total, code, comments, blank lines per language
  • Comment-to-code ratio — overall documentation density
  • Function & class counts — per language
  • Cyclomatic complexity — per-function for Python files (AST-based)
  • Largest files — top N files ranked by code lines
  • High complexity warnings — flags functions with complexity ≥5

Complexity Scale (Python)

Range Risk Meaning
1-4 🟢 Low Simple, well-structured
5-9 🟢 Moderate Acceptable
10-14 🟡 High Consider refactoring
15+ 🔴 Very High Refactor strongly recommended

Dependencies

  • Python 3.8+ (stdlib only, no pip packages needed)
Usage Guidance
This appears to be a straightforward, local code metrics tool. Before running it: 1) run it in the project directory you intend to analyze (avoid running it from / or other sensitive root paths), 2) review any large or unexpected files it reports if you pointed it at a wide path, and 3) confirm you are comfortable executing a Python script from this source (you can inspect scripts/code_metrics.py fully). There are no network calls or credential requests in the included code.
Capability Analysis
Type: OpenClaw Skill Name: code-metrics Version: 1.0.0 The code-metrics skill is a standard static analysis tool that calculates lines of code, function/class counts, and cyclomatic complexity for Python. The implementation in scripts/code_metrics.py uses only Python standard libraries (ast, re, os) and contains no network activity, shell execution, or unauthorized file access beyond the target project directory.
Capability Assessment
Purpose & Capability
Name/description claim to compute LOC, comment ratios, function/class counts, and Python cyclomatic complexity; the repository includes a Python script that implements those analyses and no unrelated capabilities (no cloud SDKs, no credential usage, no unrelated binaries).
Instruction Scope
SKILL.md instructs running the bundled Python script against a project path (or cwd). The script only reads source files discovered under the provided path, parses Python AST for complexity, and computes text-based metrics. The instructions do not ask the agent to read unrelated system files, environment secrets, or transmit data to external endpoints.
Install Mechanism
No install spec is provided (instruction-only with a bundled script). The script uses only Python stdlib and there are no downloads or archive extraction steps.
Credentials
The skill requests no environment variables, credentials, or config paths. The code does not attempt to access environment secrets or network services; its filesystem access is limited to reading files under the target project directory.
Persistence & Privilege
always is false and the skill does not request persistent/privileged presence or modify other skills or system-wide configuration.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install code-metrics
  3. After installation, invoke the skill by name or use /code-metrics
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
Initial release of code-metrics. - Analyze code quality metrics across 17+ programming languages. - Reports lines of code, comment ratios, function/class counts, and largest files. - Measures cyclomatic complexity for Python (with per-function details and warnings). - Offers JSON output, directory exclusion, and complexity analysis toggling. - Requires only Python 3.8+ with no external dependencies.
Metadata
Slug code-metrics
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is Code Metrics?

Analyze code quality metrics including lines of code by language, cyclomatic complexity (Python), function/class counts, comment ratios, and largest file ran... It is an AI Agent Skill for Claude Code / OpenClaw, with 136 downloads so far.

How do I install Code Metrics?

Run "/install code-metrics" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Code Metrics free?

Yes, Code Metrics is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Code Metrics support?

Code Metrics is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Code Metrics?

It is built and maintained by John Wang (@johnnywang2001); the current version is v1.0.0.

💬 Comments