Agent skill
code-health
Analyze codebase health - large files, test coverage gaps, duplicate code, dead/legacy code, and documentation issues. Use when asked to scan, audit, or assess code quality, find refactoring targets, or identify technical debt.
Install this agent skill to your Project
npx add-skill https://github.com/lepinkainen/skills/tree/main/code-health
SKILL.md
Code Health Analysis
Run scripts/health.py to analyze codebase health. The script auto-detects project type (Go, Python, JS/TS) and runs appropriate checks.
Usage
Primary (LLM/programmatic use):
# Full scan with JSON output (recommended for LLM consumption)
python /path/to/skill/scripts/health.py --json [directory]
# Specific checks with JSON output
python /path/to/skill/scripts/health.py --check size --json [directory]
python /path/to/skill/scripts/health.py --check tests --json [directory]
python /path/to/skill/scripts/health.py --check dupes --json [directory]
python /path/to/skill/scripts/health.py --check dead --json [directory]
python /path/to/skill/scripts/health.py --check docs --json [directory]
Secondary (human debugging):
# Human-readable output with emojis (for manual inspection)
python /path/to/skill/scripts/health.py [directory]
python /path/to/skill/scripts/health.py --check size [directory]
Checks
| Check | Description |
|---|---|
size |
Large files, function counts, git churn |
tests |
Coverage gaps, missing test files, test quality |
dupes |
Duplicate function names, similar patterns |
dead |
Legacy markers, unused exports, stale code |
docs |
Undocumented exports, missing READMEs |
Output
JSON format (recommended): Structured output for LLM/programmatic parsing with severity levels:
"critical": Immediate attention needed"warning": Should address soon"info": Nice to fix
Each finding includes file path, line number (when applicable), message, and suggested action.
Human-readable format (debugging only): Pretty-printed output with emoji severity indicators (🔴 critical, 🟡 warning, 🟢 info) for manual inspection.
AST-Based Function Analysis
For more accurate function analysis, use the included AST parsers:
gofuncs - Go Function Analyzer
go run scripts/gofuncs.go -dir /path/to/project
Output format: file:line:type:exported:name:receiver:signature
type:f=function,m=methodexported:y=public,n=private
Example:
api.go:15:f:n:fetchItems:()[]Item
config.go:144:m:y:GetCategory:*Mapper:(string)string
pyfuncs - Python Function Analyzer
python scripts/pyfuncs.py --dir /path/to/project
Output format: file:line:type:exported:name:class:signature:decorators
type:f=function,m=method,s=staticmethod,c=classmethod,p=propertyexported:y=public,n=private (underscore prefix)
Example:
main.py:15:f:y:process_data::(data:List[str])->Dict[str,int]:
api.py:45:m:y:fetch:APIClient:async (url:str)->Response:cache,retry
jsfuncs - JavaScript/TypeScript Function Analyzer
node scripts/jsfuncs.js --dir /path/to/project
Output format: file:line:type:exported:name:class:signature:decorators
type:f=function,m=method,a=arrow,c=constructor,g=getter,s=setterexported:y=public,n=private
Example:
main.js:15:f:y:processData::(data:string[])=>Promise<Object>:
api.ts:45:m:y:fetch:APIClient:async (url:string)=>Response:
Use Cases for AST Tools
These tools provide accurate function-level analysis for:
- Complexity analysis: Count functions per file, analyze parameter complexity
- Test coverage: Identify which specific functions lack tests
- Duplicate detection: Find similar function signatures across the codebase
- API surface analysis: List all public vs private functions
- Documentation gaps: Cross-reference with doc comments
Combine with health.py for comprehensive codebase health analysis.
Requirements
Required: python3
Optional (for better results): rg (ripgrep), fd, git, go (for Go projects), staticcheck, node (for JS/TS projects)
Missing tools are reported but don't block execution.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
plex-query
This skill should be used when the user asks questions about their Plex media library, such as "what movies can I watch on Plex", "find romantic movies under 100 minutes", "show me Tom Cruise films from the 90s", "how many unwatched episodes of Always Sunny do I have", "give me a British comedy show I haven't watched", or "shows with episodes under 30 minutes that I've started". Use whenever user mentions Plex in combination with movies, TV shows, or media queries.
check-test-quality-go
Analyze Go test files (*_test.go) for quality issues, anti-patterns, and code smells. This is a Go-specific tool that checks for external dependencies, complexity, flaky patterns, and testing anti-patterns. Use when users ask to check Go test quality, analyze Go tests for issues, find test anti-patterns in Go code, find flaky Go tests, or improve Go test reliability.
obsidian-vault
Search, create, and manage notes in the Obsidian vault with wikilinks and index notes. Use when user wants to find, create, or organize notes in Obsidian.
setup-pre-commit
Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo. Use when user wants to add pre-commit hooks, set up Husky, configure lint-staged, or add commit-time formatting/typechecking/testing.
scaffold-exercises
Create exercise directory structures with sections, problems, solutions, and explainers that pass linting. Use when user wants to scaffold exercises, create exercise stubs, or set up a new course section.
edit-article
Edit and improve articles by restructuring sections, improving clarity, and tightening prose. Use when user wants to edit, revise, or improve an article draft.
Didn't find tool you were looking for?