agentsclimarketplace

Claude health

Skill sd0xdev/sd0x-harness/skills/claude-health

Claude Code config health check + plugin sync. Use when: auditing .claude/ structure, checking naming, verifying hook setup, detecting plugin version drift, syncing installed assets. Not for: skill quality (use skill-health-check), code review (use codex-code-review). Output: health report + fix recommendations.From its SKILL.md

Install
npx -y skills add sd0xdev/sd0x-harness --skill claude-health

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

SKILL.md

16.3 KB, as published. Nobody here has run it

Claude Health Check

Trigger

  • Keywords: health check, .claude check, config audit, lint .claude, claude health, plugin sync, version drift, upgrade check, doctor

When NOT to Use

  • Code review (use /codex-review-fast)
  • Doc review (use /codex-review-doc)
  • Security review (use /codex-security)

Scope

ArgumentDescription
--scope hygieneOnly run C1-C7 hygiene checks
--scope syncOnly run S1-S3 sync checks
--scope allRun both modules (default)

Workflow

[--scope] → Select modules → Scan → Classify → Report → Fix suggestions
               │                                  │
       ┌───────┴───────┐                     P0/P1/P2
       ▼               ▼                    + fix commands
  Hygiene (C1-C7)  Sync (S1-S3)

Hygiene Module — Checks (7 items)

#CheckMethodCriteria
1Junk filesfind .claude/ -name ".DS_Store" -o -name "*.zip" -o -name ".tmp*"Any exists → P1
2.gitignore existsls .claude/.gitignoreMissing → P1
3.gitignore completenessRead .claude/.gitignore, compare required itemsMissing required → P2
4Naming consistencyScan all skills/*/ for reference vs referencesInconsistent → P2
5README count syncCount actual vs README descriptionMismatch → P2
6Command-Skill pairingEach core skill should have corresponding commandMissing → P1
7Cache sizedu -sh .claude/cache/> 50M → P2

Check 1: Junk Files

find .claude/ -name ".DS_Store" -o -name "*.zip" -o -name ".tmp*" 2>/dev/null
  • Has results → P1: List files, suggest deletion
  • No results → ✅

Check 2-3: .gitignore

ls .claude/.gitignore 2>/dev/null || echo "MISSING"

Missing → P1. If exists, read content and compare required items:

Required ItemReason
.DS_StoremacOS generates continuously
settings.local.jsonPersonal config
cache/Runtime cache
.tmp*Temp files
*.tmpTemp files (suffix variant)
*.zipBackup archives

Missing any → P2

Check 4: Naming Consistency

# Scan all skill subdirectories
for dir in .claude/skills/*/; do
  if [ -d "${dir}reference" ]; then echo "INCONSISTENT: ${dir}reference"; fi
done

Has reference/ (singular) → P2, suggest renaming to references/

Check 5: README Count Sync

# Count actual items
ls .claude/commands/ 2>/dev/null | wc -l
ls .claude/skills/ 2>/dev/null | wc -l
ls .claude/agents/ 2>/dev/null | wc -l
ls .claude/rules/ 2>/dev/null | wc -l
ls .claude/hooks/*.sh 2>/dev/null | wc -l

Extract counts from README.md, compare. Mismatch → P2

Check 6: Command-Skill Pairing

Scan all skills/*/SKILL.md, exclude these types, then check for corresponding command:

Exclude TypeExamplesReason
Domain KBportfolio, aumReferenced by other skills, no standalone entry
Externalagent-browserNot maintained by this project

Remaining skills without command → P1

Check 7: Cache Size

du -sh .claude/cache/ 2>/dev/null
  • > 50M → P2, suggest cleanup
  • ≤ 50M → ✅

Sync Module — Checks (S1-S3)

Only runs when --scope sync or --scope all (default).

S1: Version Check

#CheckMethodCriteria
S1.1Manifest existsRead .sd0x/install-state.jsonMissing → P1
S1.2Manifest parseableJSON.parseParse error → P1
S1.3schema_version current== 1Mismatch → P2
S1.4plugin_version matchesmanifest vs .claude-plugin/plugin.json or package.jsonMismatch → P1
S1.5Manifest completenessHas rules + hook_scripts + scripts keysMissing key → P2 (MANIFEST_GAP)

Plugin version resolution (priority order):

.claude-plugin/plugin.json → package.json → "unknown"

Plugin source location (same as /install-rules Phase 1):

Glob: ~/.claude/plugins/**/sd0x-dev-flow/rules/auto-loop.md
Glob: ${REPO_ROOT}/node_modules/sd0x-dev-flow/rules/auto-loop.md
Fallback: @rules/auto-loop.md (plugin-relative)

S2: Component Classification

For each managed component (rules, hooks, scripts), compute 3 hashes and classify:

manifest_hash  = manifest[category][filename].hash    # null if missing
local_hash     = git hash-object --no-filters <local-path>  # null if file missing
plugin_hash    = git hash-object --no-filters <plugin-path>  # source of truth

Classification table (read-only diagnostic; maps to install-rules states for delegation):

Doctor StateConditionSeverityinstall-rules Equivalent
OKlocal == manifest == plugin✅SKIP
MISSINGlocal_hash is null, plugin existsP1FRESH_INSTALL
OUTDATEDlocal == manifest, plugin != manifestP1AUTO_UPDATE
LOCAL_MODIFIEDlocal != manifest, plugin == manifest✅KEEP_LOCAL
CONFLICTlocal != manifest, plugin != manifestP2CONFLICT
LEGACYmanifest_hash is null, local existsP2LEGACY
MANIFEST_GAPmanifest category key missingP2N/A
TOMBSTONEDmanifest deleted: true, local missing✅SKIP_DELETED

Managed inventory (hardcoded):

CategoryLocal PathPlugin SourceFiles
Rules.claude/rules/*.mdrules/*.mdauto-loop.md, codex-invocation.md, fix-all-issues.md, framework.md, testing.md, security.md, git-workflow.md, logging.md, docs-writing.md, docs-numbering.md, self-improvement.md, context-management.md
Hooks.claude/hooks/*.shhooks/*.shpre-edit-guard.sh, post-edit-format.sh, post-skill-auto-loop.sh, post-compact-auto-loop.sh, stop-guard.sh, user-prompt-review-guard.sh
Scripts.claude/scripts/scripts/precommit-runner.js, verify-runner.js, review-state.js, dep-audit.sh, commit-msg-guard.sh, pre-push-gate.sh, lib/utils.js, lib/tree-digest.js

S2.5: Override Safeguard Checks

6 checks for project override files (e.g., auto-loop-project.md):

#CheckSeverityDetectionRecommendation
1Override driftP2based_on hash comment in project file vs the hash of the base file that comment names (derived, never hard-coded — both auto-loop-project.md and testing-project.md ship) — only when the override file has active content; a scaffold with every section still commented out has no overrides to review, so drift is not reported"Base <rule> updated since override authored; review your overrides"
2Policy contradictionP1An overridden section omits a required check command that the same section of the base rule contains"Override drops a required check command its base section carries"
3Missing reference or baseP1For each shipped override file (auto-loop-project.md, testing-project.md): .claude/CLAUDE.md has @rules/<file> but the file is missing, OR the file exists but is not referenced, OR the file exists but the base rule its Based on: comment names is missing from .claude/rules//install-rules to recreate the missing file or base, or add the reference
4Wrong-layer editP2Base auto-loop.md has LOCAL_MODIFIED, CONFLICT, or LEGACY state while project override exists"Move customization to auto-loop-project.md"
5Duplicate headingP2Override file has multiple active ## <heading> with same text"Keep one, remove duplicates. Last occurrence takes effect."
6Legacy precedence headerP2Precedence declaration exists only inside an HTML comment (<!-- Precedence: present, no live Precedence: line before the first ##) — HTML comments are stripped from model context (R8), so the declaration never reaches its only reader"Header predates the live-precedence contract; migrate the precedence line to live text by hand or regenerate via /install-rules --customize <rule> --reset. This check is read-only — it never edits the user-owned file"

Policy contradiction detection: For each ## <heading> section the override restates, extract the backticked check commands (/codex-review-fast, /codex-review-doc, /precommit) from the same-heading section of the base auto-loop.md and require the restated section to keep every one of them. A verbatim copy therefore never flags; only a restatement that drops a command its base section carries is P1. (The base's Auto-Trigger table was retired by R3 — code/doc routing now lives in the unheaded terminal-invariant paragraph, which the exact-##-heading override mechanism cannot restate, so routing itself is not overridable and is out of this check's scope.) No restated section → check passes vacuously.

Override drift detection: First check whether the project file has active content. Two forms count, and the distinction matters because the scaffold ships its ## headings live: a non-empty, non-comment body line under any heading, or a heading that carries its own value (## Plan Review: enabled, ## Git Memory: enabled — for these settings the heading is the value, so there is no body to look for). A bare scaffold heading with nothing but comments beneath it is an empty slot, not an override. The live Precedence: header is preamble material and never activation. A scaffold whose sections are all still commented out is skipped: drift means "the base changed since you wrote your overrides", and there are none, so reporting it on a fresh install is a false positive rather than a finding. Otherwise read the <!-- Based on: <base>.md @ <hash> --> comment and derive the base file from the comment's own filename — git hash-object --no-filters .claude/rules/<base>.md | cut -c1-7. The base must not be hard-coded: R8 distributes testing-project.md alongside auto-loop-project.md, so a fixed auto-loop.md comparand would check a testing override's hash against the wrong rule and report drift that does not exist. If the derived base file is missing, drift is undefined rather than zero — report it through check #3's missing base branch (P1) and do not emit a drift finding. Both checks must cover every shipped override file, not just auto-loop-project.md: an active testing-project.md whose testing.md has been deleted would otherwise fall through both. If the hashes differ, the base has been updated since the override was authored. Uses blob hash for content-level comparison; accepts legacy commit-style hashes (any 7+ hex chars) during backward-compat transition.

S3: Settings Compatibility

Check both settings.json and settings.local.json (precedence: settings.local.json > settings.json). A hook entry in either file satisfies the integrity check.

#CheckMethodCriteria
S3.1Legacy hook pathsGrep both settings files for bare .claude/hooks/ without $CLAUDE_PROJECT_DIRFound → P2
S3.2Retired guard-mode settingRead env.STOP_GUARD_MODE (and legacy hooks_config.stop_guard_mode) from either settings fileFound in either → P2 (retired: the Stop hook is reminder-only since hook-lightweighting — the setting is dead config, recommend removing it). Absent → ✅
S3.3Hook entry integrityEach installed hook script has matching entry in either settings fileMissing from both → P1
S3.4Orphan hook entriesEither settings file references script that doesn't exist on diskOrphan → P2

Settings file precedence: settings.local.json overrides settings.json at runtime. When delegating S3 fixes, use /install-hooks --local if the issue is in settings.local.json.

Legacy path detection:

Grep for: "\.claude/hooks/[^"]+\.sh"  (without leading "$CLAUDE_PROJECT_DIR")
Applied to both: settings.json and settings.local.json

Fix Tiers

Only applies when --fix-safe or --fix is specified alongside sync scope.

TierFlagDescription
Report(default)Diagnosis only — output actionable recommendations
Safe--fix-safeAuto-fix P1 hygiene + safe sync fixes
Guided--fixAuto-fix P1 hygiene + guided sync remediation (interactive)

Category-specific safe fix delegation:

CategoryMISSINGOUTDATEDCONFLICT/LEGACY
Rules/install-rules <names>/install-rules <names> (smart merge AUTO_UPDATE)Skip (report only)
Hooks/install-hooks <names>Report only + suggest /install-hooks <names> --forceSkip (report only)
Scripts/install-scripts <names>Report only + suggest /install-scripts <names> --forceSkip (report only)

Why hooks/scripts OUTDATED is report-only in safe tier: /install-hooks and /install-scripts use skip/force semantics (no manifest-aware smart merge). Only /install-rules has 7-state classification for safe auto-update.

S3 settings fix delegation: All settings mutations delegate to /install-hooks (sync module never writes JSON directly).

--fix tier: Delegates all actionable states (including CONFLICT, LEGACY) to /install-* commands which handle interactive resolution.

Argument conflict: --fix and --fix-safe are mutually exclusive. If both specified, error.

Output

# .claude/ Health Check Report

## Hygiene Summary (C1-C7)

| Item | Status | Notes |
|------|--------|-------|
| Junk files | ✅/⛔ | ... |
| .gitignore | ✅/⛔ | ... |
| Naming consistency | ✅/⛔ | ... |
| README count | ✅/⛔ | ... |
| Command-Skill | ✅/⛔ | ... |
| Cache size | ✅/⛔ | ... |

## Sync Summary (S1-S3)

### S1: Version
| Check | Status | Detail |
|-------|--------|--------|
| Manifest | ✅/⛔ | Found / Missing |
| Plugin version | ✅/⛔ | 2.0.3 == 2.0.3 / 1.8.12 → 2.0.3 |
| Manifest keys | ✅/⛔ | Complete / Missing: hook_scripts, scripts |

### S2: Component Status
| File | Category | Status | Action |
|------|----------|--------|--------|
| auto-loop.md | Rules | OUTDATED | `/install-rules auto-loop` |
| security.md | Rules | OK | — |
| stop-guard.sh | Hooks | MISSING | `/install-hooks stop-guard` |
| ... | ... | ... | ... |

### S3: Settings Compatibility
| Check | Status | Detail |
|-------|--------|--------|
| Hook paths | ✅/⛔ | Modern / Legacy found |
| Retired guard mode | ✅/⚠️ | absent / STOP_GUARD_MODE found (dead config) |
| Entry integrity | ✅/⛔ | All matched / N missing |
| Orphan entries | ✅/⛔ | None / N orphans |

## Statistics

| Category | Count |
|----------|-------|
| Commands | N |
| Skills | N |
| Rules | N (installed) / N (managed) |
| Hooks | N |

## Issues

### P1
- [Issue] → [Fix recommendation / command]

### P2
- [Issue] → [Fix recommendation]

## Gate
✅ All Pass / ⛔ N issues need fixing

Verification

  • Hygiene: All 7 checks executed (when scope includes hygiene)
  • Sync: S1-S3 checks executed (when scope includes sync)
  • Each check has clear ✅/⛔ status
  • P1 issues have specific fix commands
  • S2 classification covers all 23 managed files
  • Fix delegation uses targeted file names (not --all)

References

  • references/best-practices.md — Best practices for .claude/ directory structure

Examples

Input: /claude-health
Action: Scan hygiene (7 items) + sync (S1-S3) → Generate consolidated report

Input: /claude-health --scope sync
Action: Scan S1-S3 only → Report version drift + component status

Input: /claude-health --fix-safe
Action: Scan all → Auto-fix safe items → Delegate to /install-* → Report

Input: Is my plugin up to date?
Action: Trigger sync check → Report version + component drift

Keep looking

Skills are one crate of 628,853. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.