/logic-lens:logic-health runs instead · from logic-lens
Sweeps a directory, module, or full codebase for logic correctness and produces a scored health dashboard with systemic patterns. Useful for pre-ship reviews, onboarding audits, and identifying where to focus testing.
This skill never runs in Claude Code
It ships in logic-lens at skills/, but /logic-lens:logic-health (a command, or a skill Claude Code finds first) has the same name: typing it, or Claude choosing it, runs that one instead.
Use lazy loading per ../_shared/common.md §13:
../_shared/common.md only for language, Iron Law, Logic Score, scope routing, Remedy discipline, config fields, and loading budget.logic-health-guide.md as you reach it.../_shared/logic-risks.md, ../_shared/semiformal-guide.md, ../_shared/semiformal-checklist.md, ../_shared/report-template.md, and ../logic-review/logic-review-guide.md on demand when the current module trace needs them.Step 0. Language + scope routing. Detect language per common.md §1. Proceed for multi-file scopes and for single-module scopes when the user explicitly uses "health check", "health overview", or "logic health". If scope is one file and none of those health phrases appear, switch to logic-review.
Step 1. Enumerate modules and plan the sweep (guide Step 1) — prioritize public API surfaces, recently changed files, and user-flagged modules. Read .logic-lens.yaml only for ignore:, focus:, disable:, severity:, custom_risks, and trace.* fields. For broad scopes, build a ranked worklist before opening files.
Step 2. Run focused logic-review per module (guide Step 2) — apply Premises → Trace → Divergence on public-facing functions; skip internal helpers unless a trace leads into them. Apply the per-module function budget from guide Step 2 (small/medium/large line-count tiers) — do not trace all functions in large modules.
Step 3. Record findings per module (guide Step 3) — tag module, L-code, severity.
Step 4. Aggregate findings (guide Step 4) — counts by severity and by L-code; cross-reference modules.
Step 5. Compute scores (guide Step 5) — per-module Logic Score via the standard formula; overall score is the line-weighted average (per common.md §6).
Step 6. Identify systemic patterns (guide Step 6) — L-codes appearing in ≥ 3 modules or ≥ 30% of scanned modules (whichever threshold is lower) indicate codebase-wide habits; architectural enablers (heavy global state → L7; deep callee chains → L6) get explicit mention.
Step 7. Output the Health Report (guide Step 7) — standard header; Findings; Summary; then Module Breakdown, Systemic Patterns, and Recommended Priority Order (top 3–5) appended after Summary. Localize all headers if the user wrote in Chinese.
Mode line in report: Logic Health (Chinese: 逻辑体检).
Health-specific additions (append after the standard Summary):
## Module Breakdown
| Module | Score | Critical | Warning | Suggestion | Top Risk |
|--------|-------|----------|---------|------------|----------|
## Systemic Patterns
[Risk codes appearing in ≥ 3 modules or ≥ 30% of scanned modules — codebase-wide habit rather than isolated bugs]
## Recommended Priority Order
1. [Most critical single finding]
2. [Systemic pattern with widest impact]
3. [Quick wins: suggestions that prevent future Criticals]
Localize column and section headers when the user wrote in Chinese (e.g., 模块分布, 系统性模式, 优先级建议).
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub hyhmrright/logic-lens --plugin logic-lens6 skills in this plugin
/logic-diffCompare two code versions for semantic equivalence via semi-formal tracing of both versions side-by-side. Trigger when the user shares a refactor, rewrite, migration, or A/B implementation and wants to confirm behavior is unchanged — "did I break anything", "is this equivalent", "are these equivalent", "semantically equivalent", "are these two implementations semantically equivalent", "check my refactor", "same behavior after the change?", "does my rewrite produce the same output", "switched from X to Y — same results?". SCOPE HARD RULE: requires two code versions (A and B). A single version for bug-finding uses logic-review; one version + a failing test uses logic-locate; explaining what one piece of code does uses logic-explain; codebase audit uses logic-health. Do NOT trigger for: single-version review, performance comparison, design-quality comparison, or "which is better-written" questions.
/logic-explainExplain what a specific piece of code actually does for a given input by producing a step-by-step execution trace (interprocedural, with name resolution and type transitions). Trigger when the user is confused about behavior or asks why code produces X instead of Y — "walk me through this", "trace through X with input Y", "why does this return X", "what does yield-from do here", "explain the execution path". SCOPE HARD RULE: a specific function + a specific input scenario. If the user wants to find bugs without a scenario in mind, use logic-review; two-version comparison uses logic-diff; concrete failures use logic-locate; codebase-wide audit uses logic-health. Do NOT trigger for: finding bugs without a behavioral question, style or design discussion, or concept explanations not tied to specific code.
/logic-fix-allAutonomous repository-wide audit-and-fix pipeline: health → review → locate/explain → fix → diff-verify → iterate until clean. Starts with a mandatory consent prompt (token-intensive); after consent runs hands-free. Trigger when the user wants ALL logic issues found and fixed — "fix everything", "fix all logic issues", "fix all logic issues in this code", "clean up all logic issues", "audit and fix the whole repo", "fix all bugs automatically", or frustration with recurring bugs wanting a one-shot pass. SCOPE RULE: repo-wide by default; also trigger for a pasted code snippet when the user says "fix all" — produce the full Fix Report (Fix Log, before/after Logic Score). Analysis-only requests use logic-health or logic-review. Single failure uses logic-locate. Two versions uses logic-diff. One path explanation uses logic-explain. Do NOT trigger for: analysis-only ("show me the bugs"), style/lint/format concerns, or fixing a single named finding.
/logic-locateLocate the root cause of a CONFIRMED failure via backward-then-forward semi-formal tracing. Trigger when the user provides a stack trace, failing assertion, error message, or specific wrong-value observation — "find the bug", "this test is failing", "track down this crash", "why is this test failing", "KeyError at line 89", "expected 70, got 100", "NoneType has no attribute X", "cart empties when second tab opens". SCOPE HARD RULE: requires a concrete failure (exception, failing test, or specific wrong output). Vague suspicion without evidence uses logic-review; behavior explanation uses logic-explain; refactor comparison uses logic-diff; codebase audit uses logic-health. Do NOT trigger for: vague "what's wrong" without a concrete symptom, style questions, or performance issues.
/logic-reviewFind logic bugs in a single file or function via semi-formal execution tracing (Premises → Trace → Divergence → Trigger → Remedy). Trigger when a user shares code and suspects something is wrong without naming a concrete failure — phrases like "review this", "does this look right", "check this function", "audit this code", "tests pass but prod fails". SCOPE HARD RULE: one file or one function only. For a directory or whole module use logic-health; for a confirmed failure (stack trace, failing test, specific wrong value) use logic-locate; for two versions use logic-diff; for repo-wide autonomous fixing use logic-fix-all. Do NOT trigger for: style/formatting, security scanning, performance, test generation, architecture or design questions.
Other plugins' skills for the same job