/doc-mirror:ship-a-pluginfrom doc-mirror
WHAT: the dev-flow for building AND distributing a Claude Code plugin + marketplace (ONE catalog that REFERENCES plugins, not a monorepo of their code); the full build -> commit -> install -> dogfood flow + the gotchas. WHEN: creating, packaging, publishing, installing, or distributing a plugin or marketplace; before touching .claude-plugin/plugin.json or marketplace.json; user says 'ship a plugin / add to the marketplace'.
Ships in doc-mirror. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
This is a DEVELOPMENT-FLOW skill: it is the way you make a plugin, the complete set of things that must
be coherent for it to actually install + run, and how you verify it. Read it before any plugin/marketplace
work. Ground truth examples (READ them, don't guess): the canonical multi-plugin marketplace is
~/.claude/plugins/marketplaces/claude-plugins-official/.claude-plugin/marketplace.json (207 plugins,
ONE catalog); plugin structure depth is the plugin-dev:plugin-structure skill.
A plugin is ONE dir with .claude-plugin/plugin.json (the manifest: name = the skill namespace,
doc-mirror:doc-mirror). At the dir ROOT (NOT inside .claude-plugin/), Claude Code AUTO-DISCOVERS:
skills/<name>/SKILL.md, hooks/hooks.json, agents/*.md, commands/*.md, rules/*.md, .mcp.json.
${CLAUDE_PLUGIN_ROOT} (set by Claude Code at hook-run time),
never a hardcoded ~/.claude path.bin/ CLIs and loose runtime files are NOT auto-placed — a manifest can't put a CLI on PATH. That
is the ONE thing needing a setup step → ship an install WIZARD skill (see §3.2).A marketplace is ONE repo with ONE .claude-plugin/marketplace.json. That file is a CATALOG — a
plugins[] list. Each entry has a source, and the source is EITHER:
"./plugins/<name>" — the plugin's files live as a subdir of the catalog repo; OR{"source":"git-subdir"|"url", "url":..., "path":..., "ref":..., "sha":...}
— the plugin lives in its OWN repo and the catalog just POINTS at it.THEREFORE (the things that are NOT true, that cost us a session):
marketplace.jsons; naming two the same does nothing. ONE catalog per marketplace.plugins[]. (Each plugin keeps its own plugin.json; only the catalog root has marketplace.json.)env → ${CLAUDE_PLUGIN_ROOT} → a machine-config file the wizard writes → derive. Zero absolute /home/... literals in shipped code.install.sh to put bin/* on PATH + write a config recording
the plugin root, and TELLS THE USER the exact command if the env blocks it. (Pattern: doc-mirror-install.)plugins[] entry whose source points at the plugin's repo
(or ./plugins/<name> if co-locating). Do NOT spawn a new marketplace.claude plugin marketplace add|update <catalog> then claude plugin install <plugin>@<catalog>.
These are agent-runnable CLI subcommands (not REPL-only). GOTCHA: a plugin activates only on RESTART.${CLAUDE_PLUGIN_ROOT}), bins work, search/CLIs resolve the plugin's own data.mv to a backup, never rm): remove any old
hand-installed copies now that the plugin provides them. GOTCHA: if a persona/skill-sync ALSO ships
these skills (e.g. this container's sync_on_startup from /tmp/heaven_data/skills/_defaults.json),
you MUST remove them from the sync source too (the add-to-defaults mechanism, inverse), or they
re-sync every boot and the de-scatter is futile.Not "the code ran." A plugin is verified when a FRESH boot / a DIFFERENT agent installs and USES it, observed: skills invoke, hooks fire from the plugin path, bins resolve, the wizard places host pieces and user-falls-back when blocked. Watch it happen; don't trust the report.
~/.claude.When I touch any plugin or marketplace, I FIRST read this flow + the canonical claude-plugins-official
catalog. I build the structure, de-hardcode paths, ship the install wizard, commit+push to the plugin's
own repo, register it in the ONE shared CATALOG by reference (never a one-off marketplace, never a code
monorepo), install, RESTART, dogfood by a fresh boot/different agent, then de-scatter replace-before-remove
(including the persona sync source). I never trust "it ran"; I watch it install + run.
What SKILL.md sets; muted values are Claude Code's defaults
13 skills in this plugin
/check-sophia-progressWHAT: check the live status of the Sophia rollup / cohere worker — is the daemon running, how far BEHIND it is (how many journals not yet cohered / the lag between newest journal and newest momentum), and how many issues meta-Sophia has flagged. WHEN: when you want to know if Sophia is running + caught up, when a rehydration or decided-logic query looks stale, when you suspect the rollup died, or when the user asks 'is sophia running / caught up / how far behind / how many meta issues' (any of)./distill-to-essential-transformWHAT: a thinking move -- collapse a complex system to its one-sentence ESSENTIAL TRANSFORM (input->output->artifact) and rebuild it at the LOWEST sufficient mechanism, borrowing reliability from a substrate you do not own. WHEN: a system feels too heavy/fragile to depend on; a built thing was forgotten but its function keeps recurring; turning a system into a util/skill; user says distill / collapse / simplify / 'what does this actually do' / 'make it just instructions'.Other plugins' skills for the same job
/doc-mirrorWHAT: THE LAW of doc-mirror -- the 4 legal doc-layer file kinds, deterministic addressing, the doc(m) template, the closure test, fork-on-change. The invariant every state operates under. WHEN: you need the rule for what a doc(m)/vision(m)/journal/tracker IS or where it lives; classifying a doc-layer file; unsure whether an action is legal in the machine.npx claudepluginhub sancovp/doc-mirror --plugin doc-mirror