From lazycortex-diagram
Take an existing diagram fence and re-conform it to the current drawer-agent standards. Reads the host section's prose as the request, infers (kind, format) from the existing fence's syntax marker, dispatches the per-format drawer agent, and replaces the fence in place when the body differs. Outcome vocabulary: replaced / unchanged / failed:<reason>. Use when an old diagram drifted from the contract (palette removed, theme directive missing, terminology changed); for inserting a NEW fence under a heading see /lazy-diagram.draw.
How this skill is triggered — by the user, by Claude, or both
Slash command
/lazycortex-diagram:lazy-diagram.fixThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Recompose an existing diagram fence so it satisfies the current drawer-agent contract. Behaves like `/lazy-diagram.draw`, except a fence MUST already exist under the anchor; `(kind, format)` are inferred from the fence's syntax marker when not pinned. The host section's prose IS the request the drawer re-renders against.
Recompose an existing diagram fence so it satisfies the current drawer-agent contract. Behaves like /lazy-diagram.draw, except a fence MUST already exist under the anchor; (kind, format) are inferred from the fence's syntax marker when not pinned. The host section's prose IS the request the drawer re-renders against.
This skill has 8 ordered steps. The executing agent MUST NOT skip, merge, reorder, or silently omit any step. To make dropped steps structurally impossible:
TaskCreate with exactly one task per step below — no merging, no abbreviation, no renaming. The canonical list (use these titles verbatim):
Step 1 — Validate inputs and locate fenceStep 2 — Infer kind and formatStep 3 — Extract host-section prose as requestStep 4 — Resolve scheme pathStep 5 — Dispatch drawer agentStep 6 — Byte-compare and replaceStep 7 — ReportStep 8 — Log the runin_progress on enter and completed on exit. "Completed" means "I executed the step's logic AND produced an outcome line for it".TaskList shows every prior task completed.target_file (required) — absolute path of the file containing the diagram.anchor_section (required) — H2/H3 heading the fence sits under.kind (optional) — pin if the existing fence is malformed enough that inference fails.format (optional) — pin in the same case as kind.scheme (optional) — colour scheme name. Resolves to ${CLAUDE_PLUGIN_ROOT}/templates/diagram.mermaid/styles-<scheme>.json. Defaults to default. Ignored for format=ascii.target_file. Grep for <anchor_section> (H2 or H3). Within the section's body, locate the FIRST code fence — ```mermaid or ```text — and capture its body (between the fences) and the info-string (mermaid / text).[FAIL] no fence under anchor. Short-circuit to Step 7.Outcome: located fence at line <N> or [FAIL].
format: mermaid if info-string is mermaid; ascii if info-string is text. If neither, [FAIL] cannot infer format from info-string=<X> (caller must pin).kind: scan the fence body for a syntax marker:
flowchart → flow (default; if the body contains a subgraph block AND the host-section heading mentions architecture/services/components, prefer architecture. When ambiguous, default to flow).sequenceDiagram → sequence.stateDiagram-v2 → state.erDiagram → erd.classDiagram → class.block-beta → layout.gantt → gantt.journey → journey.mindmap → mindmap.timeline → timeline.architecture-beta → architecture.<dir>/ line at column 0 → fs-tree; box-and-arrow → flow; box-only-no-arrow → layout.kind overrides inference. When inference cannot disambiguate (e.g. flowchart body that could be any of flow|nav|tree|decision-tree|controls-scheme|screen-scheme), [FAIL] cannot infer kind from fence syntax — pin kind=<one> with the candidate list.Outcome: inferred kind=<kind> format=<format> or [FAIL].
[WARN] no host-section prose; using fence labels as request.Outcome: extracted (<chars>) or warned.
format=mermaid: resolve ${CLAUDE_PLUGIN_ROOT}/templates/diagram.mermaid/styles-<scheme|default>.json. If the file does not exist → failed:scheme-not-found:<name>. Short-circuit.format=ascii: skip — ASCII drawers do not consume scheme files.Outcome: resolved scheme=<name> (mermaid) / n/a (ascii) / failed:scheme-not-found:<name>.
kind=<kind> request=<verbatim host-section prose> scheme=<resolved-scheme-name> facts=none. For format=ascii, omit the scheme= token.format=mermaid → Agent(subagent_type: "lazycortex-diagram:lazy-diagram.draw-mermaid", prompt: "<above>").format=ascii → Agent(subagent_type: "lazycortex-diagram:lazy-diagram.draw-ascii", prompt: "<above>").failed: / split-into-N: / skipped-below-threshold outcome line. Propagate outcomes; on failed: or split-into-N: short-circuit to Step 7.Outcome: drawn (<bytes> bytes) or failed:<reason> or split-into-N or skipped-below-threshold.
```mermaid or ```text).unchanged.Edit. Outcome: replaced.Outcome: unchanged / replaced.
Render a markdown report. Format mirrors /lazy-diagram.draw Step 8 with one line per task. The summary line:
target_file=<path> anchor=<anchor> kind=<kind> format=<format> outcome=<unchanged|replaced|failed:<reason>>
Outcome: reported.
Per ./.claude/rules/lazy-log.logging.md:
Bash: mkdir -p ./.logs/claude/lazy-diagram.fixWrite: ./.logs/claude/lazy-diagram.fix/<UTC-timestamp>.md with frontmatter and report body.Outcome: logged.
/lazy-diagram.fix aborts: "[FAIL] no fence under anchor" — the anchor section exists in target_file but contains no ```mermaid or ```text fence → use /lazy-diagram.draw instead to create the initial diagram, then re-run fix if drift develops later./lazy-diagram.fix aborts: "[FAIL] cannot infer format from info-string=" — the existing fence has an unrecognised info-string (not mermaid or text) → pin format=mermaid or format=ascii explicitly when calling fix./lazy-diagram.fix aborts: "[FAIL] cannot infer kind from fence syntax" — the fence's syntax marker matches multiple kinds (e.g. plain flowchart could be flow, nav, tree, etc.) → pin kind=<one> from the candidate list in the failure message.styles-<name>.json) does not exist → omit scheme= to use the default, or check ${CLAUDE_PLUGIN_ROOT}/templates/diagram.mermaid/styles-*.json for valid names.missing-in-style:<role>, template malformed) → check the reason string; re-run with a richer host-section prose, or fix the named scheme/template field./lazy-diagram.draw is the entry point for that. Fix only touches an already-present fence.npx claudepluginhub mebius-san/lazy-cortex --plugin lazycortex-diagramProvides CDSS development patterns for drug interaction checking, dose validation, clinical scoring (NEWS2, qSOFA), and alert classification integrated into EMR workflows.