codebase-inspection — скилл для Claude Code: анализ кода
Считает строки кода, файлы и языки в репозитории через pygount. Пригодится для оценки размера и состава проекта.
npx skills add NousResearch/hermes-agent --skill codebase-inspection -a claude-codeЧто делает codebase-inspection
Скилл запускает pygount для анализа репозитория: показывает строки кода, разбивку по языкам, количество файлов и соотношение кода и комментариев. Результат можно получить в сводной таблице, JSON или построчно по файлам, а также ограничить набор расширений через --suffix.
Внутри используются команды оболочки: переход в каталог проекта, запуск pygount и обработка вывода через sort и head. Перед работой установите pygount через pip. Обязательно задавайте --folders-to-skip для .git, node_modules, venv и каталогов сборки, потому что без этого анализ может надолго зависнуть на дереве зависимостей. Markdown считается комментариями, а для точного подсчёта строк JSON советуется применять wc -l.
Какие задачи решает
- посчитать строки кода в репозитории
- разложить проект по языкам программирования
- сравнить объём кода и комментариев
- найти самые крупные файлы по числу строк
- исключить зависимости и каталоги сборки из подсчёта
Примеры запросов агенту
- Проанализируй текущий репозиторий через `pygount`: покажи языки, файлы, строки кода и комментарии, исключив `.git`, `node_modules` и `venv`.
- Сделай сводку по Python-файлам в проекте командой `pygount --suffix=py --format=summary .`.
- Выведи результаты анализа в JSON через `pygount --format=json .`.
Как установить codebase-inspection
1Через Skills CLI (Vercel)
npx skills add NousResearch/hermes-agent --skill codebase-inspection -a claude-code2Вручную: положить файлы
~/.claude/skills/codebase-inspection/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/codebase-inspection/
1Через Skills CLI (Vercel)
npx skills add NousResearch/hermes-agent --skill codebase-inspection -a codex2Вручную: положить файлы
.agents/skills/codebase-inspection/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add NousResearch/hermes-agent --skill codebase-inspection -a cursor2Вручную: положить файлы
.cursor/skills/codebase-inspection/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install NousResearch/hermes-agent codebase-inspection2Вручную: положить файлы
.github/skills/codebase-inspection/SKILL.md1Через Skills CLI (Vercel)
npx skills add NousResearch/hermes-agent --skill codebase-inspection -a gemini-cli2Командой платформы
gemini skills install https://github.com/NousResearch/hermes-agent --path skills/software-development/codebase-inspectionВручную: положить файлы
.devin/skills/codebase-inspection/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add NousResearch/hermes-agent --skill codebase-inspection -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
Из того же набора42
Весь набор →Похожие
Вопросы о codebase-inspection
Как установить codebase-inspection в Claude Code?
Выполните npx skills add NousResearch/hermes-agent --skill codebase-inspection -a claude-code, затем повторите эту команду ещё раз и проверьте файл ~/.claude/skills/codebase-inspection/SKILL.md.
Что делает codebase-inspection?
Скилл анализирует репозиторий через pygount: считает строки кода, файлы, языки, комментарии и их доли. Он также умеет формировать JSON и отбирать файлы по расширениям.
Что нужно подготовить для работы codebase-inspection?
Нужно установить pygount через pip. Для больших проектов задавайте --folders-to-skip, иначе анализ может пройти по каталогам зависимостей и сборки.
Исходный текст
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