Run Health Check
Execute full system health check:Check Categories
The health check validates seven categories:1. System Requirements:lines/health-check.js:70
Operating System:lines/health-check.js:295- Validates platform (macOS, Linux, Windows)
- Checks OS version compatibility
- Supported: macOS 10.15+, Linux 20.04+, Windows 10+
- Requires Node.js 18 or higher
- Displays current version
- Warns if outdated
- Checks total and free memory
- Recommends 4GB+ RAM
- Shows current usage
- Tests connection to
api.anthropic.com - 5-second timeout
- Detects slow connections
- Identifies current shell (bash, zsh, fish)
- Recommends zsh for autocompletion
- Checks
$SHELLenvironment variable
2. Claude Code Setup:lines/health-check.js:109
Installation:lines/health-check.js:421- Checks local
node_modules/@anthropic-ai/claude-code - Checks global
claudecommand - Displays version
- Reads
~/.claude.json - Checks OAuth account (email)
- Checks API key
- Validates
ANTHROPIC_API_KEYenv var
- Placeholder check
- Assumes enabled by default
- Validates
~/.claudedirectory access - Checks write permissions
- Ensures directory exists
3. Project Setup:lines/health-check.js:142
Project Structure:lines/health-check.js:565- Looks for project indicators:
package.json(Node.js)requirements.txt(Python)Cargo.toml(Rust)go.mod(Go).git(Git repository)README.md
- Checks
.claude/directory exists - Counts files in directory
- Lists configuration files
- Reads
~/.claude/settings.json - Validates JSON syntax
- Analyzes structure:lines/health-check.js:1197
- Permissions (allow/deny rules)
- Hooks configuration
- Environment variables
- Model settings
- MCP auto-approval
- Reads
.claude/settings.json - Validates JSON syntax
- Same structure analysis as user settings
- Reads
.claude/settings.local.json - Optional file for machine-specific config
- Validates JSON syntax
4. Agents:lines/health-check.js:181
Project Agents:lines/health-check.js:803- Scans
.claude/agents/directory - Recursively counts
.mdfiles - Reports total agent count
- Scans
~/.claude/agents/directory - Recursively counts
.mdfiles - Reports total agent count
- Validates frontmatter presence
- Checks for
name:field - Checks for
description:field - Reports malformed agents
5. Custom Commands:lines/health-check.js:229
Project Commands:lines/health-check.js:730- Scans
.claude/commands/directory - Counts
.mdfiles - Reports total command count
- Scans
~/.claude/commands/directory - Counts
.mdfiles - Reports total command count
- Checks for
$ARGUMENTSplaceholder - Reports commands missing placeholder
- Essential for parameter handling
6. MCP Servers:lines/health-check.js:208
Project MCP Config:lines/health-check.js:613- Reads
.mcp.jsonin project - Counts configured servers
- Validates
mcpServersobject
- Validates each server configuration
- Required fields:
command: Executable path
- Optional fields:
args: Array of argumentsenv: Object of environment variables
- Reports invalid configurations
7. Hooks:lines/health-check.js:256
User Hooks:lines/health-check.js:926- Reads
~/.claude/settings.json - Extracts
hooksarray - Counts configured hooks
- Reads
.claude/settings.json - Extracts
hooksarray - Counts configured hooks
- Reads
.claude/settings.local.json - Extracts
hooksarray - Counts configured hooks
- Validates each hook command exists
- Checks if command is executable
- Validates shell builtins:lines/health-check.js:1080
echo,cd,pwd,test, etc.
- Uses
command -vto check existence:lines/health-check.js:1089
- Placeholder for future validation
- Currently returns warning
Status Indicators
Each check returns one of three statuses:- ✅ Pass: Check completed successfully
- ⚠️ Warn: Non-critical issue found
- ❌ Fail: Critical issue requiring attention
Health Score
Calculated as:lines/health-check.js:1310- 90-100%: Excellent
- 80-89%: Good
- 70-79%: Fair
- Below 70%: Needs attention
Recommendations
Automatically generated based on findings:lines/health-check.js:1333 Example recommendations:- “Consider switching to Zsh for better autocompletion”
- “Add $ARGUMENTS placeholder to command files”
- “Add proper frontmatter to agent files”
- “Create .claude/agents/ directory”
- “Create .mcp.json for MCP servers”
- “Fix JSON syntax errors in configuration”
Post-Check Setup
After the health check, you’re prompted to run project setup:lines/health-check.js:1383Usage Patterns
New Project Setup
Pre-deployment Check
Troubleshooting
API Usage
Import and use programmatically:Configuration Validation
Settings structure analysis:lines/health-check.js:1197 Permissions checked:allowrules (array)denyrules (array)additionalDirectories(array)
- Valid hook types:
PreToolUse,PostToolUse,Stop,Notification - Hook structure validation
- Lists env vars
- Warns on sensitive vars in project settings:
ANTHROPIC_API_KEYANTHROPIC_AUTH_TOKEN
enableAllProjectMcpServerssettingenabledMcpjsonServersarraydisabledMcpjsonServersarray
model: Model selectioncleanupPeriodDays: Conversation cleanup (must be ≥ 1)apiKeyHelper: API key management
Example: Automated CI Check
Troubleshooting
Authentication Fails
Error:Claude CLI not available or not authenticated
Solutions:
- Run
claude loginto authenticate - Set
ANTHROPIC_API_KEYenvironment variable - Create
~/.claude.jsonwith OAuth credentials
Permission Denied
Error:Permission check failed
Fix permissions:
Invalid JSON Syntax
Error:Invalid JSON in .claude/settings.json
Validate JSON:
Hook Command Not Found
Error:Command not found: my-script
Ensure script is:
- Executable:
chmod +x my-script - In PATH or use absolute path
- Shell builtin or installed command
See Also
- Stats Tools - Analyze commands, hooks, and MCPs
- Analytics Dashboard - Runtime analytics
- Plugin Dashboard - Plugin management