$npx -y skills add alibaba/skill-up --skill code-statsAnalyzes 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
| 1 | # Code Stats Skill |
| 2 | |
| 3 | Analyzes code files and generates statistics about a codebase. |
| 4 | |
| 5 | ## Usage |
| 6 | |
| 7 | When invoked, this skill will: |
| 8 | 1. Scan the specified directory (defaults to current directory) |
| 9 | 2. Count total lines, files by extension |
| 10 | 3. Report the largest files |
| 11 | 4. Output results in a structured format |
| 12 | 5. Sort extension summaries by total line count in descending order |
| 13 | |
| 14 | ## Output Format |
| 15 | |
| 16 | Always use this exact format for the output: |
| 17 | |
| 18 | ``` |
| 19 | # Code Statistics |
| 20 | |
| 21 | ## Summary |
| 22 | - Total Files: <count> |
| 23 | - Total Lines: <count> |
| 24 | - Total Size: <size_bytes> bytes |
| 25 | |
| 26 | ## Files by Extension |
| 27 | | Extension | Files | Lines | |
| 28 | |-----------|-------|-------| |
| 29 | | .go | 12 | 1500 | |
| 30 | | .md | 5 | 200 | |
| 31 | |
| 32 | ## Top 5 File Extensions by Line Count |
| 33 | 1. .go — 1500 lines |
| 34 | 2. .md — 200 lines |
| 35 | |
| 36 | ## Largest Files (top 5) |
| 37 | 1. main.go (500 lines) |
| 38 | 2. util.go (300 lines) |
| 39 | ``` |
| 40 | |
| 41 | If a file has no extension, group it under `(no ext)` in both extension sections. |
| 42 | |
| 43 | ## Process |
| 44 | |
| 45 | 1. Use `Bash` with `find` to locate all code files |
| 46 | 2. Use `Bash` with `wc -l` to count lines per file |
| 47 | 3. Group files with no extension under `(no ext)` |
| 48 | 4. Sort both extension summaries by total line count in descending order |
| 49 | 5. Aggregate the results into the output format above |
| 50 | 6. If no directory is specified, analyze the current working directory |
| 51 | |
| 52 | ## Examples |
| 53 | |
| 54 | - "Analyze the current directory" |
| 55 | - "Run code-stats on ./src" |
| 56 | - "Show me file type distribution" |
| 57 | - "How many lines of Python do we have?" |