Code stats
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, checking file distributions, or auditing code.From its SKILL.md
npx -y skills add alibaba/skill-up --skill code-statsAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- runs commandsInstructs the agent to run 2 commands, including `find` and 1 more.
SKILL.md
1.9 KB, 368 tokens by cl100k_base, as published. Nobody here has run it
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)
- 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 all code files - 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?"
What ships with it: 10 files
8.9 KB alongside SKILL.md, 1 of them executable
evals/
- cases/analyze-directory.yaml735 B
- cases/current-directory-format.yaml841 B
- cases/top-extensions.yaml687 B
- evals.json1.8 KB
- eval.yaml682 B
- fixtures/repos/sample-project/main.go143 B
- fixtures/repos/sample-project/README.md73 B
- fixtures/repos/sample-project/util.go134 B
- fixtures/scripts/check-stats.shruns1.9 KB
- README.md2.1 KB