codebase-inspection — Claude Code skill: code analysis
Counts code lines, files, languages, and code-to-comment ratios with pygount. Use it to inspect a repository’s size and composition.
npx skills add NousResearch/hermes-agent --skill codebase-inspection -a claude-codeWhat codebase-inspection does
This skill runs pygount against a repository and reports lines of code, file counts, language breakdowns, and code-to-comment ratios. It can produce a summary table, JSON, or file-level output, and can restrict the scan by file suffix with --suffix.
The workflow uses shell commands: change into the repository, run pygount, and optionally process its output with sort and head. Install pygount with pip first. Set --folders-to-skip for .git, node_modules, venv, and build directories because an unrestricted scan can crawl dependency trees for a long time. Markdown is counted as comments, while exact JSON line counts should come from wc -l.
What it helps with
- count lines of code in a repository
- break down a project by programming language
- compare code and comment totals
- rank files by their code-line count
- exclude dependencies and build folders from a scan
Example prompts for the agent
- Inspect this repository with `pygount`, report languages, files, code lines, and comments, and skip `.git`, `node_modules`, and `venv`.
- Create a summary for Python files with `pygount --suffix=py --format=summary .`.
- Return the repository analysis as JSON using `pygount --format=json .`.
How to install codebase-inspection
1Skills CLI (Vercel)
npx skills add NousResearch/hermes-agent --skill codebase-inspection -a claude-code2Manually: put the files in place
~/.claude/skills/codebase-inspection/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/codebase-inspection/
1Skills CLI (Vercel)
npx skills add NousResearch/hermes-agent --skill codebase-inspection -a codex2Manually: put the files in place
.agents/skills/codebase-inspection/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add NousResearch/hermes-agent --skill codebase-inspection -a cursor2Manually: put the files in place
.cursor/skills/codebase-inspection/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install NousResearch/hermes-agent codebase-inspection2Manually: put the files in place
.github/skills/codebase-inspection/SKILL.md1Skills CLI (Vercel)
npx skills add NousResearch/hermes-agent --skill codebase-inspection -a gemini-cli2Platform CLI
gemini skills install https://github.com/NousResearch/hermes-agent --path skills/software-development/codebase-inspectionManually: put the files in place
.devin/skills/codebase-inspection/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add NousResearch/hermes-agent --skill codebase-inspection -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
From the same set42
The whole set →Similar
Questions about codebase-inspection
How do I install codebase-inspection in Claude Code?
Run npx skills add NousResearch/hermes-agent --skill codebase-inspection -a claude-code, run the same command a second time, then check ~/.claude/skills/codebase-inspection/SKILL.md.
What does codebase-inspection do?
It analyzes a repository with pygount and reports code lines, files, languages, comments, and their ratios. It can also produce JSON and filter files by suffix.
What does codebase-inspection need to run?
Install pygount with pip first. For large projects, use --folders-to-skip so the scan does not traverse dependency and build directories.
Source text
SKILL.md · MIT
---
name: codebase-inspection
description: "Inspect codebases w/ pygount: LOC, languages, ratios."
version: 1.0.0
author: Hermes Agent
license: MIT
platforms: [linux, macos, windows]
metadata:
hermes:
tags: [LOC, Code Analysis, pygount, Codebase, Metrics, Repository]
related_skills: [github]
prerequisites:
commands: [pygount]
---
# Codebase Inspection with pygount
Analyze repositories for lines of code, language breakdown, file counts, and code-vs-comment ratios using `pygount`.
## When to Use
- User asks for LOC (lines of code) count
- User wants a language breakdown of a repo
- User asks about codebase size or composition
- User wants code-vs-comment ratios
- General "how big is this repo" questions
## Prerequisites
```bash
pip install --break-system-packages pygount 2>/dev/null || pip install pygount
```
## 1. Basic Summary (Most Common)
Get a full language breakdown with file counts, code lines, and comment lines:
```bash
cd /path/to/repo
pygount --format=summary \
--folders-to-skip=".git,node_modules,venv,.venv,__pycache__,.cache,dist,build,.next,.tox,.eggs,*.egg-info" \
.
```
**IMPORTANT:** Always use `--folders-to-skip` to exclude dependency/build directories, otherwise pygount will crawl them and take a very long time or hang.
## 2. Common Folder Exclusions
Adjust based on the project type:
```bash
# Python projects
--folders-to-skip=".git,venv,.venv,__pycache__,.cache,dist,build,.tox,.eggs,.mypy_cache"
# JavaScript/TypeScript projects
--folders-to-skip=".git,node_modules,dist,build,.next,.cache,.turbo,coverage"
# General catch-all
--folders-to-skip=".git,node_modules,venv,.venv,__pycache__,.cache,dist,build,.next,.tox,vendor,third_party"
```
## 3. Filter by Specific Language
```bash
# Only count Python files
pygount --suffix=py --format=summary .
# Only count Python and YAML
pygount --suffix=py,yaml,yml --format=summary .
```
## 4. Detailed File-by-File Output
```bash
# Default format shows per-file breakdown
pygount --folders-to-skip=".git,node_modules,venv" .
# Sort by code lines (pipe through sort)
pygount --folders-to-skip=".git,node_modules,venv" . | sort -t$'\t' -k1 -nr | head -20
```
## 5. Output Formats
```bash
# Summary table (default recommendation)
pygount --format=summary .
# JSON output for programmatic use
pygount --format=json .
# Pipe-friendly: Language, file count, code, docs, empty, string
pygount --format=summary . 2>/dev/null
```
## 6. Interpreting Results
The summary table columns:
- **Language** — detected programming language
- **Files** — number of files of that language
- **Code** — lines of actual code (executable/declarative)
- **Comment** — lines that are comments or documentation
- **%** — percentage of total
Special pseudo-languages:
- `__empty__` — empty files
- `__binary__` — binary files (images, compiled, etc.)
- `__generated__` — auto-generated files (detected heuristically)
- `__duplicate__` — files with identical content
- `__unknown__` — unrecognized file types
## Pitfalls
1. **Always exclude .git, node_modules, venv** — without `--folders-to-skip`, pygount will crawl everything and may take minutes or hang on large dependency trees.
2. **Markdown shows 0 code lines** — pygount classifies all Markdown content as comments, not code. This is expected behavior.
3. **JSON files show low code counts** — pygount may count JSON lines conservatively. For accurate JSON line counts, use `wc -l` directly.
4. **Large monorepos** — for very large repos, consider using `--suffix` to target specific languages rather than scanning everything.
© Hermes Agent · MIT · NousResearch/hermes-agent