code-stats

Tools and instructions for measuring a codebase with tokei and comparing code changes with difft. Tokei counts files and lines by language, while difft compares code using its structure rather than only its text.

In plain words
What is it for?
Use them to count lines by language, exclude directories such as node_modules, produce machine-readable statistics, or review semantic differences between files or Git revisions.
Why use it?
They provide a quick overview of project size and make meaningful code changes easier to inspect.

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/0xdarkmatter/claude-mods/code-stats
Any agent
npx skills add 0xDarkMatter/claude-mods --skill code-stats
Clone the repo
git clone --depth 1 https://github.com/0xDarkMatter/claude-mods

Made for: Claude Code, Codex.

Per session 63 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 642 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found 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.00063 $0.00642
Opus 5 $0.00032 $0.00321
Sonnet 5 $0.00013 $0.00128
Haiku 4.5 $0.00006 $0.00064

Measured 2d ago against content hash 05a4bb46de04, 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.

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.

skills/code-stats/SKILL.md · 95 lines

How it starts

The opening of the file, as written. The whole thing — 95 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Code Statistics

Quickly analyze codebase size, composition, and changes.

tokei - Line Counts

# Count all code
tokei

# Compact output sorted by code
tokei --compact --sort code

# Specific languages
tokei --type=TypeScript,JavaScript

# Exclude directories
tokei --exclude node_modules --exclude dist

# JSON output for scripting
tokei --output json | jq '.Total.code'

Sample Output

===============================================================================
 Language            Files        Lines         Code     Comments       Blanks
===============================================================================
 TypeScript             45        12847         9823         1456         1568
 JavaScript             12         2341         1876          234          231
-------------------------------------------------------------------------------
 Total                  57        15188        11699         1690         1799
===============================================================================

difft - Semantic Diffs

# Compare files
difft old.ts new.ts

# Inline mode
difft --display=inline old.ts new.ts

# With git
GIT_EXTERNAL_DIFF=difft git diff
GIT_EXTERNAL_DIFF=difft git show HEAD~1

Why Semantic?

Traditional diff difft
Line-by-line AST-aware
Shows moved as delete+add Recognizes moves
Whitespace sensitive Ignores formatting

Quick Reference

Task Command
Count all code tokei
Compact output tokei --compact
Sort by code tokei --sort code
TypeScript only tokei -t TypeScript
JSON output tokei --output json
Exclude dir tokei --exclude node_modules
Semantic diff difft file1 file2
Git diff GIT_EXTERNAL_DIFF=difft git diff

When to Use

  • Getting quick codebase overview
  • Comparing code changes semantically
  • Understanding project composition
  • Reviewing refactoring impact
  • Tracking codebase growth

Read the full file on GitHub · 95 lines

Files

What ships with it

4 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 · 95 lines · 63 tokens per session scan A 05a4bb46de04

Subscribe to this mod's changes

code-stats is a skill published in the GitHub repository 0xDarkMatter/claude-mods (32 stars, last pushed 10d ago), licensed MIT. It adds 63 tokens to every session and 642 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.