Install Code Stats
Pick your agent. Every command is ready to paste.
npx skills add alibaba/skill-up --skill code-statsThe open skills CLI detects your agents (Claude Code, Cursor, Codex and 70+ more) and installs to the right folder. Add -g to install globally.
01
Install it
Run the command above, or upload the folder in Claude.
02
Ask naturally
Describe the task. Your agent loads code-stats when the request matches its description.
03
Name it if needed
If it does not trigger, say “use the code-stats skill”. In Codex, type $code-stats.
Code Stats Skill
Analyzes code files and generates statistics about a codebase.
Usage
When invoked, this skill will:
- Scan the specified directory (defaults to current directory)
- Exclude
node_modules/,.git/,dist/, andbuild/unless the user explicitly asks to count them. These are dependencies, repository metadata, or generated output rather than project source.
- Exclude
- Count total lines, files by extension
- Report the largest files
- Output results in a structured format
- Sort extension summaries by total line count in descending order
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
- Use
Bashwithfindto locate project files, pruning the excluded directories - Use
Bashwithwc -lto count lines per file - Group files with no extension under
(no ext) - Sort both extension summaries by total line count in descending order
- Aggregate the results into the output format above
- 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?"
Tips for Code Stats
- • Start a fresh session after installing so your agent picks up the new skill.
- • This skill ships scripts. Read them before the first run, and run it in a project without secrets first.
- • It is part of a pack with 22 skills. Install only the ones you need with --skill to keep triggers precise.
- • If two skills overlap, mention the one you want by name.
Questions about Code Stats
What does the Code Stats skill do?
Analyzes code files and reports statistics including line counts, file counts by extension, and total size. Use this skill whenever the user wants to understand the composition of a codebase - asking about "how many lines of code", "what file types exist", "code distribution", or needing a quick audit of project size and structure. Make sure to invoke this skill when users mention analyzing codebases, counting lines,
How do I install Code Stats?
Run "npx skills add alibaba/skill-up --skill code-stats" in your project. The skills CLI installs it for Claude Code, Cursor, Codex and 70+ other agents. In Claude on the web, upload the skill folder as a ZIP under Customize > Skills.
Does Code Stats work in Cursor and Codex?
Yes. Code Stats uses the open SKILL.md format, so it works in Claude Code, Claude, Cursor, OpenAI Codex, Gemini CLI, GitHub Copilot and other agents that support agent skills.
Is Code Stats free?
Code Stats is open source on GitHub under the Apache-2.0 license. It is free to install; check the license before commercial use.
Who made Code Stats?
Code Stats is published by alibaba in the alibaba/skill-up repository, together with 21 other skills.





