mcpField
C
code-stats

code-stats

github.com/0xdarkmatterDevelopment7865 installsUpdated 2w ago
Repository

About code-stats

A code-analysis skill for quickly measuring repository size, language composition, and code changes. It documents tokei for line counts and difft for AST-aware semantic comparisons.

Key features

  1. 01Count lines by language with tokei
  2. 02Sort and filter code statistics
  3. 03Export statistics as JSON
  4. 04Compare files with AST-aware diffs
  5. 05Use difft with Git

Use cases

  1. 01Survey a repository's size and language mix
  2. 02Track codebase growth
  3. 03Review refactoring changes
  4. 04Compare files while accounting for moved code

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/0xdarkmatter/claude-mods --skill code-stats

After installing, type/code-statsin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

assets/
.gitkeep
references/
difft-advanced.md
tokei-advanced.md
scripts/
.gitkeep

Details

From the project README

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 diffdifft
Line-by-lineAST-aware
Shows moved as delete+addRecognizes moves
Whitespace sensitiveIgnores formatting

Quick Reference

TaskCommand
Count all codetokei
Compact outputtokei --compact
Sort by codetokei --sort code
TypeScript onlytokei -t TypeScript
JSON outputtokei --output json
Exclude dirtokei --exclude node_modules
Semantic diffdifft file1 file2
Git diffGIT_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

Additional Resources

For detailed patterns, load:

  • ./references/tokei-advanced.md - Filtering, output formats, CI integration
  • ./references/difft-advanced.md - Display modes, git integration, language support

Comments

Markdown supported