Skip to content
Back to skills

Openspec Init

BSecurity

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 absent or invalid, or run directly.

  • 16 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added October 24, 2026
developmentpythonnodegit

Works with

  • cli

Security analysis

B84/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned November 29, 2026

npx -y skills add MotleyAI/living-architecture --skill openspec-init --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Openspec Init?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Openspec Init
[![Security: B — Skills Directory](https://www.skillsdirectory.com/api/skills/motleyai-openspec-init/badge)](https://www.skillsdirectory.com/skills/motleyai-openspec-init)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: openspec-init
description: 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 absent or invalid, or run directly.
---

**Preflight:** run `la-doctor --plugin <this skill's base directory>` once per session before using any `la-*` or `trmv-*` command; if it fails, stop and show the user its output — unless the only failure is the private-store finding (the one naming `/la:openspec-init`), which Step 1b fixes. If `la-doctor` is not found, or reports the la tools older than the plugin, stop and give the user the install command at this plugin's `version` (in its `.claude-plugin/plugin.json`): `uv tool install living-architecture==<version> --with-executables-from type-rename-move` in a Python repo, `npm install -g living-architecture@<version> type-rename-move@<version>` in a TS/JS repo.

Bring the current repo to a valid OpenSpec state: the `openspec` CLI resolvable
and an `openspec/` corpus (`specs/` + `changes/`) present and healthy. Corpus
only — no `/opsx:*` slash commands or AGENTS wiring, because the `/la:pr` flow
replaces propose/apply.

## Step 1 — Resolve the CLI (set `OPENSPEC_CMD`)

1. If `command -v openspec` succeeds → `OPENSPEC_CMD=openspec`.
2. Else install globally: `npm i -g @fission-ai/openspec` (no sudo where the npm
   global prefix is user-writable — nvm/fnm/`~/.local`-style node). Re-check
   `command -v openspec`.
3. If the global install fails (non-writable prefix, no permission, or offline):
   fall back to `OPENSPEC_CMD="npx -y @fission-ai/openspec@1.11.0"` (bump the pin
   as needed). If even npx can't fetch, STOP and tell me — do not proceed.

Use `$OPENSPEC_CMD` for every openspec call below and hand it back to the caller.

## Step 1b — Stealth mode: the private store

If `la-config get stealth` prints `true` and `git ls-tree -r --name-only HEAD -- openspec/` prints nothing, never
write `openspec/` into the repo; set up the private store instead and skip Steps 2–5:

1. If `$OPENSPEC_CMD store --help` fails, STOP and tell me this OpenSpec CLI has no stores, so stealth mode needs a
   newer one.
2. Run `$OPENSPEC_CMD store setup $(la-config get openspec_store) --path "$(la-config get openspec_store_path)" --init-git`.
   If it fails, STOP and show me its output.
3. Verify: `la-doctor` reports no private-store finding, and
   `$OPENSPEC_CMD list --store $(la-config get openspec_store)` succeeds.
4. Stage and commit nothing in the repo. Hand back `--store $(la-config get openspec_store)` for every later
   `openspec` call.

## Step 2 — Check repo state

Run from the repo root (`init` writes `openspec/` into the cwd). Classify:

- **Absent** — no `openspec/config.yaml` → Step 3.
- **Healthy** — `openspec/config.yaml` exists and `$OPENSPEC_CMD list` runs
  cleanly → nothing to do; report and return. (A healthy repo may have no
  `specs/` or `changes/` yet — see Step 3 — so their absence is NOT invalid.)
- **Invalid** — `openspec/` exists but has no `config.yaml`, or `list`/`doctor`
  errors → Step 4.

## Step 3 — Initialize (absent)

```
$OPENSPEC_CMD init --tools none --no-animation
```

Add `--force` only if it complains about legacy files. This creates just
`openspec/config.yaml` (`schema: spec-driven`); `--tools none` keeps it
corpus-only (no `/opsx:*` commands or AGENTS wiring — `/la:pr` gets its authoring
format from `openspec instructions`). Note: `changes/<id>/` is created later by
`openspec new change`, and `specs/` by the first `openspec archive` — init alone
lays down only `config.yaml`.

## Step 4 — Repair (invalid)

- Version / instruction staleness → `$OPENSPEC_CMD update`.
- Structurally broken (missing `specs/`|`changes/`, unparseable corpus) → report
  the exact `doctor`/`list` error and ask how to proceed. Never guess-fix a
  corrupted corpus.

## Step 5 — Verify and stage

- Confirm health: `$OPENSPEC_CMD list` must succeed (and
  `$OPENSPEC_CMD validate --strict` if any specs/changes already exist).
- Stage with a SPECIFIC path — `git add openspec/` plus any other newly created
  files — never `git add -A`. Do NOT commit; leave that to me.
- Worktree caveat: `openspec/` lives on the branch, so init on the mainline (then
  merge) if you want every future branch/worktree to inherit it — don't init
  per-worktree.

Return to the caller (e.g. `/la:pr`) with OpenSpec now valid.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.