code-health-check
Code Health Check analyzes a directory's codebase to produce a structured quality report by examining file organization, error handling, security vulnerabilities, code duplication, and dependency hygiene. Use this skill when a user requests code quality analysis, wants to identify issues in a project, or needs a comprehensive health assessment with actionable recommendations organized by severity levels from critical to informational.
git clone --depth 1 https://github.com/huangjia2019/claude-code-engineering /tmp/code-health-check && cp -r /tmp/code-health-check/04-Skills/projects/07-skill-fork-demo/.claude/skills/code-health-check ~/.claude/skills/code-health-checkSKILL.md
# Code Health Check
Analyze the codebase at `$ARGUMENTS` and produce a structured health report.
## Checks to Perform
### 1. File Organization
- Are files reasonably sized? (Flag files > 200 lines)
- Is the directory structure logical?
- Any files that look misplaced?
### 2. Error Handling
- Are async operations wrapped in try/catch?
- Are errors propagated correctly (not swallowed)?
- Is there a global error handler?
### 3. Security Basics
- Any hardcoded secrets, API keys, or passwords?
- Any use of `eval()` or similar dangerous functions?
- Are user inputs validated before use?
### 4. Code Quality
- Any obvious code duplication (similar blocks in multiple files)?
- Any unused variables or imports?
- Are function signatures reasonable (not too many parameters)?
### 5. Dependency Hygiene
- Are all imported modules actually used?
- Any circular dependencies?
## Severity Levels
Use these to categorize issues:
| Severity | Meaning | Example |
|----------|---------|---------|
| CRITICAL | Must fix immediately | Hardcoded secrets, SQL injection |
| WARNING | Should fix soon | Missing error handling, large files |
| INFO | Nice to improve | Minor duplication, naming conventions |
## Output Format
Return a structured report in this exact format:
```markdown
# Code Health Report: {directory}
## Overall Score: {A/B/C/D/F}
## Summary
- Files analyzed: {count}
- Issues found: {critical} critical, {warning} warnings, {info} info
## Critical Issues
{list each with file:line and description}
## Warnings
{list each with file:line and description}
## Info
{list each with file:line and description}
## Recommendations
{top 3 actionable recommendations}
```Review code changes for quality, security, and best practices. Proactively use this after code modifications.
Run tests and report results concisely. Use this after code changes to verify everything works.
Analyze log files and extract actionable insights. Use when troubleshooting issues or investigating incidents.
Explore and analyze API-related code. Use when investigating endpoints, routing, or HTTP handling.
Explore and analyze authentication-related code. Use when investigating auth flows, session management, or security.
Explore and analyze database-related code. Use when investigating data models, queries, or persistence.
Analyze root cause of bugs after location is identified. Second step in bug investigation.
Implement bug fixes after analysis is complete. Third step in bug fix pipeline.