← 返回 Skills 市场
johnnywang2001

Code Metrics

作者 John Wang · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
136
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install code-metrics
功能描述
Analyze code quality metrics including lines of code by language, cyclomatic complexity (Python), function/class counts, comment ratios, and largest file ran...
使用说明 (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)
安全使用建议
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.
功能分析
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.
能力评估
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.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install code-metrics
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /code-metrics 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
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.
元数据
Slug code-metrics
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Code Metrics 是什么?

Analyze code quality metrics including lines of code by language, cyclomatic complexity (Python), function/class counts, comment ratios, and largest file ran... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 136 次。

如何安装 Code Metrics?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install code-metrics」即可一键安装,无需额外配置。

Code Metrics 是免费的吗?

是的,Code Metrics 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Code Metrics 支持哪些平台?

Code Metrics 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Code Metrics?

由 John Wang(@johnnywang2001)开发并维护,当前版本 v1.0.0。

💬 留言讨论