Skip to content
Back to skills

Code Stats

ASecurity

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.

  • 6 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added October 15, 2026
ai-agentspythongobashnodegit

Security analysis

A100/100

Pro scans all 12 files and shows the line behind each finding

Scanned October 15, 2026

npx -y skills add DeadHead04/skillEd --skill code-stats --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Code Stats?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Code Stats
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/deadhead04-code-stats/badge)](https://www.skillsdirectory.com/skills/deadhead04-code-stats)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: code-stats
description: 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.
version: 1.0.0
---

# Code Stats Skill

Analyzes code files and generates statistics about a codebase.

## Usage

When invoked, this skill will:
1. Scan the specified directory (defaults to current directory)
   - Exclude `node_modules/`, `.git/`, `dist/`, and `build/` unless the user explicitly asks to count them. These are dependencies, repository metadata, or generated output rather than project source.
2. Count total lines, files by extension
3. Report the largest files
4. Output results in a structured format
5. 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

1. Use `Bash` with `find` to locate project files, pruning the excluded directories
2. Use `Bash` with `wc -l` to count lines per file
3. Group files with no extension under `(no ext)`
4. Sort both extension summaries by total line count in descending order
5. Aggregate the results into the output format above
6. 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?"

Files in this skill

  • README.md4.6 KB
  • SKILL.md2.1 KB
  • evals/cases/analyze-directory.yaml1.5 KB
  • evals/cases/current-directory-format.yaml841 B
  • evals/cases/exclude-dependencies.yaml1 KB
  • evals/cases/top-extensions.yaml687 B
  • evals/eval.yaml910 B
  • evals/evals.json1.8 KB
  • evals/fixtures/repos/sample-project/README.md73 B
  • evals/fixtures/repos/sample-project/main.go143 B
  • evals/fixtures/repos/sample-project/util.go134 B
  • evals/fixtures/scripts/check-stats.sh1.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.