Codebase Stats for Openclaw

A zero-dependency Python tool for deep codebase analysis, measuring complexity, language distribution, and technical debt indicators.

charlie-morrison
v1.0.1
May 1, 2026
0
848
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install codebase-stats

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install codebase-stats using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Codebase Stats?

Codebase Stats is a high-performance analysis utility designed to provide developers and AI agents with a comprehensive view of a project's health and scale. As a core part of the Openclaw Skills library, it offers a zero-dependency solution to audit code quality, count lines of code (LOC), and identify technical debt across more than 40 programming languages.

By leveraging this skill, teams can gain immediate insights into their software architecture, from cyclomatic complexity estimates to code-to-comment ratios. Whether you are performing a quick project size audit or integrating metrics into a CI/CD pipeline, this tool delivers actionable data in both human-readable Markdown and machine-parseable JSON formats.

Codebase Stats Use Cases

  • Performing a comprehensive audit of code quality and technical debt signals like TODOs and FIXMEs.
  • Generating language distribution reports to understand the technology stack of a new repository.
  • Measuring cyclomatic complexity to identify high-risk functions that require refactoring.
  • Calculating project size and lines of code for documentation or sprint planning.
  • Auditing dependency counts across various package managers like npm, pip, and Cargo.

How Codebase Stats Works

  1. The user or AI agent triggers the skill by specifying a target directory path and optional filters.
  2. The script performs a recursive scan of the file system, identifying 40+ supported file extensions.
  3. It parses each file to distinguish between raw code, comments, and blank lines while flagging tech debt markers.
  4. Complexity heuristics are applied to functions and methods to estimate cyclomatic complexity.
  5. The tool aggregates metrics into a structured report based on the requested format (Markdown, JSON, or console).
  6. The final output is returned or saved to a file, providing a snapshot of the codebase health.

Codebase Stats Setup

To start using this Openclaw Skills component, ensure you have Python 3 installed. No external dependencies are required.

# Navigate to your script directory
cd scripts/

# Analyze the current directory with default settings
python3 codebase_stats.py

# Analyze a specific project and output a Markdown report
python3 codebase_stats.py /path/to/project --format markdown --output report.md

Codebase Stats Data Schema & Taxonomy

The skill organizes analysis data into specific categories for granular reporting:

Category Metrics Tracked
Size Total files, code lines, comment lines, blank lines, lines per file
Languages Distribution percentages by line count and file count
Complexity Cyclomatic complexity estimates and identification of the top 10 complex functions
Tech Debt Counts for specific tags: TODO, FIXME, HACK, and XXX
Ecosystem Dependency counts from package files (package.json, requirements.txt, etc.)
Large Files A ranked list of the largest files in the repository

Codebase Stats Advanced Features

  • Multi-format output support including JSON for seamless integration with CI/CD dashboards.
  • Language-specific filtering to isolate metrics for a single part of a polyglot codebase.
  • Deep scanning for technical debt signals to automate code quality gate checks.
  • Cross-platform compatibility as a pure Python script with zero external library requirements.
  • Support for niche languages and configuration files including Terraform, Protobuf, and Solidity.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*