From lazycortex-diagram
Bootstrap the lazycortex-diagram plugin for the current project (or globally). Syncs the authoring rule shipped by the plugin into the consumer's rules directory, seeds agent model tiers for the per-format drawer agents, and cleans up orphaned rules from previous versions. Idempotent — safe to re-run. Detects install scope automatically.
How this skill is triggered — by the user, by Claude, or both
Slash command
/lazycortex-diagram:lazy-diagram.installThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Bootstrap the plugin in the right scope: sync every rule template shipped by the plugin into the consumer's rules directory, seed agent model tiers for the per-format drawer subagents (`lazy-diagram.draw-mermaid`, `lazy-diagram.draw-ascii`), and offer to delete orphan rules from prior versions.
Bootstrap the plugin in the right scope: sync every rule template shipped by the plugin into the consumer's rules directory, seed agent model tiers for the per-format drawer subagents (lazy-diagram.draw-mermaid, lazy-diagram.draw-ascii), and offer to delete orphan rules from prior versions.
This skill has 6 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 — Detect install scopeStep 2 — Determine pathsStep 3 — Sync rule templatesStep 4 — Seed lazy.settings.jsonStep 5 — Verify / ReportStep 6 — Log the runin_progress on enter and completed on exit. "Completed" means "I executed the step's logic AND produced a report line for it". No-ops count only if they produced an explicit outcome line (e.g. asserted, already-ignored, absent, skipped-per-user-choice).TaskList shows every prior task completed or explicitly skipped with an outcome. A still-pending task is a bug — stop and execute it first.Read ~/.claude/plugins/installed_plugins.json. The lazycortex-diagram@lazycortex key holds an array of entries — one per project where /plugin install was last run. The plugin cache is shared globally across all projects, so any non-empty array proves the plugin is installed and usable in the current cwd.
Do NOT compare an entry's projectPath against the current working directory. projectPath records where the install command was last run, not where the plugin "belongs" — Step 2 targets <repo-root> (i.e. git rev-parse --show-toplevel in the current cwd) regardless of any entry's projectPath. A projectPath mismatch is never grounds for aborting.
Look at the scope field of the entries in the array:
"user" — plugin enabled globally in ~/.claude/settings.json"project" — plugin enabled per-project in .claude/settings.jsonIf both scopes appear in the array, ask the user which to target. Default: project.
Abort only if the lazycortex-diagram@lazycortex key is absent or its array is empty. In that case tell the user to install it first:
"enabledPlugins": { "lazycortex-diagram@lazycortex": true }
then run /plugin install lazycortex/lazycortex-diagram.
Enumerate every rule file shipped by the plugin via Glob: <installPath>/rules/*.md — never hardcode filenames. <installPath> is the installPath field from installed_plugins.json for lazycortex-diagram@lazycortex.
For each source file <installPath>/rules/<name>.md, the rule destination by scope is:
| Scope | Rule destination |
|---|---|
user | ~/.claude/rules/<name>.md |
project | <repo-root>/.claude/rules/<name>.md |
Project root is git rev-parse --show-toplevel (or current working directory if not in a git repo — but warn the user).
If the glob returns zero files, abort and tell the user the plugin cache is empty — they likely need to run /plugin update lazycortex-diagram@lazycortex first.
Rules eat context on every session — the user owns the decision to install each one.
Glob <installPath>/rules/*.md.lazy-diagram, plus every unique <ns>. prefix appearing in source rule filenames.Glob <targetRulesDir>/<ns>.*.md for each owned namespace. Union them.mkdir -p.Every per-rule prompt MUST surface the rule's purpose so the user can make an informed decision. Extract description: from the rule file's frontmatter — from the source file for New/Drift, from the target file for Orphan (source is gone). If the description is longer than ~200 chars, use its first sentence. If no description: field exists, fall back to the first non-heading line of the body, and flag the missing-description as a WARN in the report.
For every rule name in (source ∪ target), determine its state and act:
AskUserQuestion with:
Install rule `<name>.md`?**Purpose:** <source description>\n\n**What this does:** Copies the shipped rule into `<targetPath>`. Rules are auto-loaded into every Claude Code session (when `always_loaded`) or when editing files matching their `paths:` scope.AskUserQuestion with:
Rule `<name>.md` has drift — overwrite with shipped version?AskUserQuestion with:
Rule `<name>.md` is no longer shipped by the plugin — delete from `<targetDir>`?**Purpose (from your local copy):** <target description>\n\n**Why you're seeing this:** The plugin used to ship this rule but no longer does (renamed, merged into another rule, or deprecated). Keeping it means it stays loaded into your sessions but will never receive updates.rm <target>, state deleted. Keep → state kept-orphan.One AskUserQuestion at a time — wait for the answer before the next prompt.
Orphan detection only considers target files whose filename starts with one of this plugin's owned namespaces. Rules from other plugins and user-authored rules in unrelated namespaces are never offered for deletion.
Non-destructively seed the lazycortex domain group in agent_models with the subagents this plugin ships. Tier values are read from lazycortex-core's default-tiers.json at runtime — there is no hardcoded table here. Adding/removing a lazycortex-diagram:* agent and updating default-tiers.json is enough; this step picks the change up automatically.
| Scope | Path |
|---|---|
user | ~/.claude/lazy.settings.json |
project | <repo-root>/.claude/lazy.settings.json |
Read the target file. If missing or unparseable, treat its contents as {"version": 1, "agent_models": {}}.
Ensure agent_models.lazycortex exists as an object (create empty {} if absent — never overwrite existing content, and never touch other groups).
default-tiers.jsonlazycortex-core is a declared dependency (plugin.json), so it must be installed (in the cache) or co-resident (in the dev vault). Locate the canonical defaults file per the inter-plugin boundary contract — walk $LAZYCORTEX_PLUGIN_DIRS first, fall back to the cache glob when env is unset (install-time invocation outside the daemon):
FILE=""
IFS=":" read -ra DIRS <<< "${LAZYCORTEX_PLUGIN_DIRS:-}"
for d in "${DIRS[@]}"; do
if [[ "$d" == *"/lazycortex-core" ]] && [ -f "$d/skills/lazy-core.agent-models/default-tiers.json" ]; then
FILE="$d/skills/lazy-core.agent-models/default-tiers.json"; break
fi
done
[ -z "$FILE" ] && FILE=$(ls ~/.claude/plugins/cache/lazycortex/lazycortex-core/*/skills/lazy-core.agent-models/default-tiers.json 2>/dev/null | sort -V | tail -1)
The newest version wins. Read the file, parse the JSON, and select every key under defaults that starts with lazycortex-diagram:. Those are the entries to seed (key + tier verbatim).
If the file is absent → FAIL with lazycortex-core not installed; install it before /lazy-diagram.install. Don't fall through to a hardcoded fallback — silent drift is exactly what the SOT is meant to prevent.
For each (dispatch, tier) pulled from the JSON (write back only if anything changed):
agent_models.lazycortex → add the entry with the JSON's tier. State added.Never touch other lazycortex entries (e.g. lazycortex-log:* seeded by lazy-log.install).
If any mutation happened, write the file with version: 1 at the top.
One line per seeded entry: lazycortex.<key> = <value> (<state>). Include the resolved default-tiers.json path so the user can see where the defaults came from.
--- frontmatter parses.<version> / <gitCommitSha> (from installed_plugins.json)<path>agent_models seed outcome from Step 4Log to ./.logs/claude/lazy-diagram.install/YYYY-MM-DD_HH-MM-SS.md per the logging rule (include git_sha frontmatter).
Use two separate steps: Bash(mkdir -p ...) then Write tool. Never chain with &&.
/lazy-diagram.install aborts: "plugin not installed" — lazycortex-diagram@lazycortex has no entry in ~/.claude/plugins/installed_plugins.json → add "lazycortex-diagram@lazycortex": true to enabledPlugins in your settings.json and restart Claude Code, then re-run./lazy-diagram.install aborts: "plugin cache is empty" — the plugin glob returned zero rule files → run /plugin update lazycortex-diagram@lazycortex to refresh the cache, then re-run./plugin update: /plugin update refreshes the plugin cache but does not re-sync rule files into .claude/rules/. Re-run this skill after every plugin update to pick up rule changes — otherwise projects keep running the old rule content.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.