code-stats

A codebase analysis tool that counts files, lines, file types, and total size, and identifies the largest files. A codebase is the collection of source files that make up a project.

In plain words
What is it for?
Use it to audit project size, compare code distribution by file extension, find the largest files, and report overall line counts and storage size.
Why use it?
It removes the need to inspect folders and count code manually when you need a quick picture of a project’s composition.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/victorzhong0110/skill-evolution/code-stats
Any agent
npx skills add victorzhong0110/skill-evolution --skill code-stats
Clone the repo
git clone --depth 1 https://github.com/victorzhong0110/skill-evolution

Made for: Claude Code, Codex.

Per session 91 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 529 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin 88% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00091 $0.00529
Opus 5 $0.00046 $0.00264
Sonnet 5 $0.00018 $0.00106
Haiku 4.5 $0.00009 $0.00053

Measured 2d ago against content hash b5caaeebddac, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

code-stats scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/count_stats.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

88% identical to code-stats — 15 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

examples/code-stats/SKILL.md · 71 lines

What it actually says

Code Stats Skill

Analyzes code files and generates statistics about a codebase.

Usage

When invoked, this skill will:

  1. Scan the specified directory (defaults to current directory)
  2. Count total lines and files by extension
  3. Report the largest files
  4. Output results in a structured format
  5. Sort extension summaries by total line count in descending order

Prefer the bundled script scripts/count_stats.py over re-implementing find / wc by hand. Pass the target directory as the first argument.

Output Format

Always use this exact format for the output:

# Code Statistics

## Summary
- Total Files: <count>
- Total Lines: <count>
- Total Size: <size_bytes> bytes

## Files by Extension
| Extension | Files | Lines |
|-----------|-------|-------|
| .go | 12 | 1500 |
| .md | 5 | 200 |

## Top 5 File Extensions by Line Count
1. .go — 1500 lines
2. .md — 200 lines

## Largest Files (top 5)
1. main.go (500 lines)
2. util.go (300 lines)

If a file has no extension, group it under (no ext) in both extension sections.

Process

  1. Run python3 scripts/count_stats.py <dir> when the script is available
  2. Otherwise locate files, count lines, and aggregate locally
  3. Group files with no extension under (no ext)
  4. Sort both extension summaries by total line count in descending order
  5. Aggregate the results into the output format above
  6. If no directory is specified, analyze the current working directory

Examples

  • "Analyze the current directory"
  • "Run code-stats on ./src"
  • "Show me file type distribution"
  • "How many lines of Python do we have?"
Files

What ships with it

9 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 71 lines · 91 tokens per session scan A b5caaeebddac

Subscribe to this mod's changes

code-stats is a skill published in the GitHub repository victorzhong0110/skill-evolution (10 stars, last pushed 3d ago), licensed MIT. It adds 91 tokens to every session and 529 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. It is 88% identical to code-stats, differing in 15 lines, and is treated as a copy.