Claude Code健康检查
health-check
Claude Code 健康检查——一次性完成所有环境检查,指出故障所在的层,`--fix` 可自动修复。适用于被要求进行健康检查,或安装异常且原因不明的情况。
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 60
- Forks
- 6
01 前言 Front Matter
- args
- [--scope=all|registry|stack|agentic|runtime|usage] [--fix] [--dry-run] [--verbose]
- name
- health-check
- created
- 1770163200000
- modified
- 1794441600000
- reviewed
- 1794441600000
- description
- Claude Code health check — every environment check in one pass, names the broken layer, `--fix` repairs. Use when asked for a health check, or the install misbehaves and the cause is unknown.
- allowed-tools
- Bash(bash ${CLAUDE_SKILL_DIR}/scripts/check-plugins.sh *), Bash(bash ${CLAUDE_SKILL_DIR}/scripts/check-plugin-scope-lag.sh *), Bash(bash ${CLAUDE_SKILL_DIR}/scripts/check-settings.sh *), Bash(bash ${CLAUDE_SKILL_DIR}/scripts/check-hooks.sh *), Bash(bash ${CLAUDE_SKILL_DIR}/scripts/check-mcp.sh *), Bash(bash ${CLAUDE_SKILL_DIR}/scripts/check-permissions-coverage.sh *), Bash(bash ${CLAUDE_SKILL_DIR}/scripts/check-runtime.sh *), Bash(bash ${CLAUDE_SKILL_DIR}/scripts/check-usage.sh *), Bash(bash ${CLAUDE_SKILL_DIR}/scripts/check-marketplace-enrollment.sh *), Bash(bash ${CLAUDE_PLUGIN_ROOT}/skills/health-plugins/scripts/check-registry.sh *), Bash(bash ${CLAUDE_PLUGIN_ROOT}/skills/health-plugins/scripts/fix-registry.sh *), Bash(pre-commit validate-config *), Read, Glob, Grep, TodoWrite, AskUserQuestion
- argument-hint
- [--scope=all|registry|stack|agentic|runtime|usage] [--fix] [--dry-run] [--verbose]
- compatibility
- claude-code
02 资源文件 23
- 参考文档REFERENCE.md2.8 KB
- 参考文档references/audit-scopes.md5.7 KB
- 参考文档references/command-reference.md1.4 KB
- 参考文档references/environment-checks.md9.8 KB
- 参考文档references/known-issues.md970 B
- 脚本scripts/check-hooks.sh17.9 KB
- 脚本scripts/check-marketplace-enrollment.sh3.5 KB
- 脚本scripts/check-mcp.sh6.6 KB
- 脚本scripts/check-permissions-coverage.sh17.2 KB
- 脚本scripts/check-plugin-scope-lag.sh2.9 KB
- 脚本scripts/check-plugins.sh5.9 KB
- 脚本scripts/check-runtime.sh15.3 KB
- 脚本scripts/check-settings.sh5.2 KB
- 脚本scripts/check-usage.sh25.0 KB
- 脚本scripts/lib/retention.sh1.7 KB
- 脚本scripts/tests/test-check-hooks.sh19.2 KB
- 脚本scripts/tests/test-check-marketplace-enrollment.sh7.4 KB
- 脚本scripts/tests/test-check-mcp.sh9.8 KB
- 脚本scripts/tests/test-check-permissions-coverage.sh13.7 KB
- 脚本scripts/tests/test-check-plugin-scope-lag.sh5.8 KB
- 脚本scripts/tests/test-check-runtime.sh7.2 KB
- 脚本scripts/tests/test-check-settings.sh4.1 KB
- 脚本scripts/tests/test-check-usage.sh25.4 KB
03 SKILL.md 正文
/health:check
Single entry point for Claude Code health diagnostics. Runs environment checks (plugin registry, settings, hooks, MCP servers, SessionStart executability, pre-commit validity, permissions coverage, marketplace enrollment) plus optional deeper audits, and routes --fix to the appropriate internal workflow.
When to Use This Skill
| Use this skill when... | Use another approach when... |
|---|---|
| Running Claude Code diagnostics | Viewing raw settings (use Read on settings.json) |
| Troubleshooting plugin registry issues | Inspecting marketplace metadata manually |
| Auditing plugins for project fit | Installing a specific plugin (use /plugin install) |
| Checking skill agentic-optimisation quality | Editing a single known skill |
One-stop --fix across registry/stack/agentic |
Precise surgical edits to a single file |
Context
- Current project: !
pwd - Project settings exists: !
find . -maxdepth 2 -path '*/.claude/settings.json' - Local settings exists: !
find . -maxdepth 2 -path '*/.claude/settings.local.json'
Parameters
Parse these from $ARGUMENTS:
| Parameter | Description |
|---|---|
--scope=<all|registry|stack|agentic|runtime|usage> |
Which audits to run. Default all. |
--fix |
Apply fixes to findings (prompts for confirmation). |
--dry-run |
Preview fixes without modifying files. |
--verbose |
Include detailed diagnostics. |
Scope semantics:
| Scope | Covers |
|---|---|
registry |
Plugin registry health (orphaned projectPath, stale enabledPlugins, registry-vs-settings drift) |
stack |
Enabled plugins vs detected project tech stack |
agentic |
Skill/command/agent agentic-optimisation compliance |
runtime |
~/.claude.json bloat, history.jsonl growth, cleanupPeriodDays validity. Read-only. |
usage |
Never-fired and dormant skills and plugin agents, mined from session transcripts. Read-only; SKIPs when history is insufficient. |
all |
Environment checks + all five audits |
Execution
Execute this diagnostic router. Default scope is all when --scope is not provided.
Run every bundled script exactly as spelled in this file, path unquoted: each allowed-tools rule pre-approves only the command text it spells, and any other spelling goes through the normal permission flow. Add no $(…) substitution: Claude Code does not pre-approve a command containing one, and every script already defaults --project-dir to the working directory.
Step 1: Run environment checks (always)
These run regardless of --scope.
1a. Core environment scripts (including 1d permissions coverage and 1e marketplace enrollment)
bash ${CLAUDE_SKILL_DIR}/scripts/check-plugins.sh --home-dir "$HOME"
bash ${CLAUDE_SKILL_DIR}/scripts/check-plugin-scope-lag.sh --home-dir "$HOME"
bash ${CLAUDE_SKILL_DIR}/scripts/check-settings.sh --home-dir "$HOME"
bash ${CLAUDE_SKILL_DIR}/scripts/check-hooks.sh --home-dir "$HOME"
bash ${CLAUDE_SKILL_DIR}/scripts/check-mcp.sh --home-dir "$HOME"
bash ${CLAUDE_SKILL_DIR}/scripts/check-permissions-coverage.sh --home-dir "$HOME"
bash ${CLAUDE_SKILL_DIR}/scripts/check-marketplace-enrollment.sh --home-dir "$HOME"
Parse STATUS=, REASON= (when present) and ISSUES: from each. Pass --verbose when set on $ARGUMENTS. Read each script's extra keys as described in references/environment-checks.md, and name the file each finding came from: the settings or .mcp.json file, the plugin that declared a hook, the project path and both versions for scope_lag, the tool and task file for missing_permission.
1b, 1c. SessionStart smoke test, pre-commit config
Run each check as specified in references/environment-checks.md and score it OK/WARN/ERROR (pre-commit may SKIP when the tool is absent).
Step 2: Run scope-specific audits
For --scope=registry or all:
bash ${CLAUDE_PLUGIN_ROOT}/skills/health-plugins/scripts/check-registry.sh --home-dir "$HOME"
Parse STATUS=, PLUGIN_COUNT=, ORPHANED_ENTRIES=, STALE_ENABLED_ENTRIES=, and ISSUES:.
For --scope=stack or all: invoke the health-plugin:health-audit skill with the Skill tool, passing --verbose when set. Load it through the Skill tool rather than reading its SKILL.md: only a loaded skill gets its own ${CLAUDE_SKILL_DIR} substituted and its own allowed-tools (its enabled-plugins.sh and claude plugin list commands are not granted here).
For --scope=agentic or all: invoke the health-plugin:health-agentic-audit skill with the Skill tool the same way, passing --verbose when set.
For --scope=runtime or all:
bash ${CLAUDE_SKILL_DIR}/scripts/check-runtime.sh --home-dir "$HOME"
Parse STATUS=, ISSUES:, CLEANUP_SUGGESTED= and the per-finding counts listed in references/audit-scopes.md, which also documents --history-warn-mb and --verbose. The audit is read-only: it prints suggested cleanups (claude purge <path> --dry-run for dead projects, jq filters otherwise) for the operator.
Close every other Claude Code session before acting on these cleanups. The harness rewrites
~/.claude.jsonon session end, so a live session's in-memory state overwrites your edits.
For --scope=usage or all:
bash ${CLAUDE_SKILL_DIR}/scripts/check-usage.sh --home-dir "$HOME"
Parse STATUS=, REASON= (when present), ISSUES: and the counts listed in references/audit-scopes.md, which also documents --window-days and --verbose. The audit is read-only and advisory (review candidates, not a delete list); it SKIPs on insufficient history and WARNs on transcript schema drift. Never read pluginUsage.usageCount for it.
Step 3: Report findings
Print a consolidated report grouped by scope:
- Environment — plugins/settings/hooks/MCP status + counts, SessionStart smoke test, pre-commit validity, permissions coverage (tools found, tools missing an allow rule, unused project rules), marketplace enrollment
- Registry — orphaned projectPath entries, stale enabledPlugins keys, registry-vs-settings drift
- Stack — detected stack + relevant/irrelevant/missing plugin recommendations
- Agentic — bare CLI commands missing compact/fail-fast/JSON flags, stale or missing
revieweddates (CLI-wrapper skills without an Agentic Optimizations table appear as INFO only) - Runtime —
~/.claude.jsonsize and bloat findings,history.jsonlsize, effectivecleanupPeriodDays(read-only — no--fixpath) - Usage — never-fired and dormant skills from session telemetry (read-only — no
--fixpath; SKIPs when history is insufficient)
Use STATUS= indicators (OK/WARN/ERROR) and issue counts per scope. Include the one-row-per-check table from REFERENCE.md § Summary Table.
See REFERENCE.md for the full report template.
Step 4: Apply fixes (if --fix)
If --fix is set:
-
If
--scope=allAND findings exist in multiple scopes, useAskUserQuestionto let the user pick which scopes to fix (multi-select:registry,stack,agentic). -
For each selected scope, delegate:
Scope Delegate to registrybash ${CLAUDE_PLUGIN_ROOT}/skills/health-plugins/scripts/fix-registry.sh --home-dir "$HOME"(append--dry-runwhen set)stackSkill tool: health-plugin:health-auditwith--fix(plus--dry-runwhen set); it runs its own Step 6agenticSkill tool: health-plugin:health-agentic-auditwith--fix; it runs its own Step 6 -
Parse each script's output (
STATUS=,REMOVED_COUNT=,MESSAGE=,RESTART_REQUIRED=) and report what changed. -
If any fix reports
RESTART_REQUIRED=true, remind the user to restart Claude Code.
Permissions coverage has no --fix path: report the missing rules and let the user decide which to add.
Step 5: Verify
Re-run the relevant checks and confirm issue counts have dropped.
Agentic Optimizations
Per-scope invocations and quick manual checks: references/command-reference.md.
Known Issues
Known symptoms and their fix paths: references/known-issues.md.
04 同仓库更多 Skills
session-workflow-capture
Workflow-tool scripts and workflow friction from this session, filed as issues here or in the plugins repo. Use when a session ran Workflow scripts.
kitty-show-image
Show the user an image with a note on what to judge, via a file send or a labelled kitty tab. Use when the user must see an image, or icat fails with no /dev/tty.
kitty-session-persistence
Snapshot and restore kitty terminal sessions on macOS. Use when surviving WindowServer hangs without losing tabs, configuring snapshots, or restoring after a force-reboot.
kitty-remote-control
Safe kitty remote control from an agent — read panes with kitty @ ls/get-text, notify, and never mutate the live terminal unasked. Use when running inside kitty.
docs-reference-check
Dangling doc-reference gate: flag markdown naming repo paths or relative links that no longer exist. Use when docs cite moved/deleted files, or wiring a doc-drift lint.
YouTube 视频上传与编辑
youtube-upload
通过 Data API v3 将视频上传到 YouTube,并在之后编辑其标题、描述、标签或缩略图。适用于发布 YouTube 视频或修改其标题。