{"slug":"openspec-init","title":"openspec-init","summary":"Initialize or repair OpenSpec in the current repo for the /la:pr flow. Ensures the openspec CLI is available (global install, npx fallback), scaffolds openspec/ with `openspec init --tools none` (corpus only, no /opsx:* commands), and verifies. Invoked by /la:pr when openspec/ is","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-11-29T00:43:59.835131Z","repo":{"url":"https://github.com/MotleyAI/living-architecture","stars":16,"forks":2,"license":"MIT","updatedAt":"2026-11-27T11:19:06Z"},"bodyHtml":"<hr>\n<h2>name: openspec-init\ndescription: Initialize or repair OpenSpec in the current repo for the /la:pr flow. Ensures the openspec CLI is available (global install, npx fallback), scaffolds openspec/ with <code>openspec init --tools none</code> (corpus only, no /opsx:* commands), and verifies. Invoked by /la:pr when openspec/ is absent or invalid, or run directly.</h2>\n<p><strong>Preflight:</strong> run <code>la-doctor --plugin &lt;this skill's base directory&gt;</code> once per session before using any <code>la-*</code> or <code>trmv-*</code> command; if it fails, stop and show the user its output — unless the only failure is the private-store finding (the one naming <code>/la:openspec-init</code>), which Step 1b fixes. If <code>la-doctor</code> is not found, or reports the la tools older than the plugin, stop and give the user the install command at this plugin's <code>version</code> (in its <code>.claude-plugin/plugin.json</code>): <code>uv tool install living-architecture==&lt;version&gt; --with-executables-from type-rename-move</code> in a Python repo, <code>npm install -g living-architecture@&lt;version&gt; type-rename-move@&lt;version&gt;</code> in a TS/JS repo.</p>\n<p>Bring the current repo to a valid OpenSpec state: the <code>openspec</code> CLI resolvable\nand an <code>openspec/</code> corpus (<code>specs/</code> + <code>changes/</code>) present and healthy. Corpus\nonly — no <code>/opsx:*</code> slash commands or AGENTS wiring, because the <code>/la:pr</code> flow\nreplaces propose/apply.</p>\n<h2>Step 1 — Resolve the CLI (set <code>OPENSPEC_CMD</code>)</h2>\n<ol>\n<li>If <code>command -v openspec</code> succeeds → <code>OPENSPEC_CMD=openspec</code>.</li>\n<li>Else install globally: <code>npm i -g @fission-ai/openspec</code> (no sudo where the npm\nglobal prefix is user-writable — nvm/fnm/<code>~/.local</code>-style node). Re-check\n<code>command -v openspec</code>.</li>\n<li>If the global install fails (non-writable prefix, no permission, or offline):\nfall back to <code>OPENSPEC_CMD=\"npx -y @fission-ai/openspec@1.11.0\"</code> (bump the pin\nas needed). If even npx can't fetch, STOP and tell me — do not proceed.</li>\n</ol>\n<p>Use <code>$OPENSPEC_CMD</code> for every openspec call below and hand it back to the caller.</p>\n<h2>Step 1b — Stealth mode: the private store</h2>\n<p>If <code>la-config get stealth</code> prints <code>true</code> and <code>git ls-tree -r --name-only HEAD -- openspec/</code> prints nothing, never\nwrite <code>openspec/</code> into the repo; set up the private store instead and skip Steps 2–5:</p>\n<ol>\n<li>If <code>$OPENSPEC_CMD store --help</code> fails, STOP and tell me this OpenSpec CLI has no stores, so stealth mode needs a\nnewer one.</li>\n<li>Run <code>$OPENSPEC_CMD store setup $(la-config get openspec_store) --path &lt;C&gt;/living-architecture/openspec --init-git</code>,\nwhere <code>&lt;C&gt;</code> is <code>git rev-parse --path-format=absolute --git-common-dir</code>.</li>\n<li>Verify: <code>la-doctor</code> reports no private-store finding, and\n<code>$OPENSPEC_CMD list --store $(la-config get openspec_store)</code> succeeds.</li>\n<li>Stage and commit nothing in the repo. Hand back <code>--store $(la-config get openspec_store)</code> for every later\n<code>openspec</code> call.</li>\n</ol>\n<h2>Step 2 — Check repo state</h2>\n<p>Run from the repo root (<code>init</code> writes <code>openspec/</code> into the cwd). Classify:</p>\n<ul>\n<li><strong>Absent</strong> — no <code>openspec/config.yaml</code> → Step 3.</li>\n<li><strong>Healthy</strong> — <code>openspec/config.yaml</code> exists and <code>$OPENSPEC_CMD list</code> runs\ncleanly → nothing to do; report and return. (A healthy repo may have no\n<code>specs/</code> or <code>changes/</code> yet — see Step 3 — so their absence is NOT invalid.)</li>\n<li><strong>Invalid</strong> — <code>openspec/</code> exists but has no <code>config.yaml</code>, or <code>list</code>/<code>doctor</code>\nerrors → Step 4.</li>\n</ul>\n<h2>Step 3 — Initialize (absent)</h2>\n<pre><code>$OPENSPEC_CMD init --tools none --no-animation\n</code></pre>\n<p>Add <code>--force</code> only if it complains about legacy files. This creates just\n<code>openspec/config.yaml</code> (<code>schema: spec-driven</code>); <code>--tools none</code> keeps it\ncorpus-only (no <code>/opsx:*</code> commands or AGENTS wiring — <code>/la:pr</code> gets its authoring\nformat from <code>openspec instructions</code>). Note: <code>changes/&lt;id&gt;/</code> is created later by\n<code>openspec new change</code>, and <code>specs/</code> by the first <code>openspec archive</code> — init alone\nlays down only <code>config.yaml</code>.</p>\n<h2>Step 4 — Repair (invalid)</h2>\n<ul>\n<li>Version / instruction staleness → <code>$OPENSPEC_CMD update</code>.</li>\n<li>Structurally broken (missing <code>specs/</code>|<code>changes/</code>, unparseable corpus) → report\nthe exact <code>doctor</code>/<code>list</code> error and ask how to proceed. Never guess-fix a\ncorrupted corpus.</li>\n</ul>\n<h2>Step 5 — Verify and stage</h2>\n<ul>\n<li>Confirm health: <code>$OPENSPEC_CMD list</code> must succeed (and\n<code>$OPENSPEC_CMD validate --strict</code> if any specs/changes already exist).</li>\n<li>Stage with a SPECIFIC path — <code>git add openspec/</code> plus any other newly created\nfiles — never <code>git add -A</code>. Do NOT commit; leave that to me.</li>\n<li>Worktree caveat: <code>openspec/</code> lives on the branch, so init on the mainline (then\nmerge) if you want every future branch/worktree to inherit it — don't init\nper-worktree.</li>\n</ul>\n<p>Return to the caller (e.g. <code>/la:pr</code>) with OpenSpec now valid.</p>\n","files":[{"path":"SKILL.md","sizeBytes":4611,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"clean","suspicious":0,"notes":0,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-11-29T00:46:05.837589Z","sha256":"EF7523FA7C7F6EFE9850614E06FD619602186B0570E01E959BAF3BF4BD5B0BB9","sizeBytes":2217},"review":null,"source":{"repositoryUrl":"https://github.com/MotleyAI/living-architecture","path":"plugin/la/skills/openspec-init","license":"MIT","commit":"c1ecf0af05da41d754e0a83233334edf6cbca797","subtreeSha":"1AC0396E9EA1E0530A2789E31C1B9CFC79646BCA826D0FB9E628EC8FA04699C3","lastSyncedAt":"2026-11-29T00:43:57.908191Z"},"reviewedAt":"2026-11-29T00:52:55.567763Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/MotleyAI/living-architecture/tree/main/plugin/la/skills/openspec-init"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install motleyai-living-architecture@llmmart"},{"target":"git","command":"git clone https://github.com/MotleyAI/living-architecture.git"}]}