Diagnose/fix worktrees missing the generated openspec-* (opsx) skills after worktreeInit. Root cause: bare `npx openspec` can resolve a squatted registry stub instead of the real CLI.
npx skills add https://github.com/BlackBeltTechnology/pi-agent-dashboard --skill fix-worktree-opsx-skills-not-created
Use when a git worktree lacks the OpenSpec lifecycle skills (.pi/skills/openspec-explore, openspec-propose, and related directories), /opsx: commands are missing, openspec-apply-change stalls, or .pi/settings.json#worktreeInit needs an audit.
.pi/.gitignore contains skills/openspec-*/**; each fresh worktree must run openspec init.@fission-ai/openspec and identify its package-manager install command. The unscoped npm package openspec is a 0.0.0 stub.git status --porcelain=v1, then install repository dependencies. For this repository, run pnpm install --frozen-lockfile. pnpm exec openspec init --tools pi --force
pnpm exec uses the declared local dependency and fails when the binary is absent. In a repository that does not declare the CLI, use the version-pinned scoped package explicitly: npx @fission-ai/[email protected] init --tools pi --force.
openspec-explore, openspec-propose, openspec-apply-change, openspec-update-change, and openspec-archive-change.git status --short. Generated openspec-* skill directories should remain ignored. Review any tracked context-file rewrite before continuing.Bare npx openspec init ... can fetch [email protected] when node_modules/.bin/openspec is absent. The stub exits without generating lifecycle skills. Installing dependencies first and using pnpm exec openspec preserves the lockfile-selected CLI and fails visibly when setup is incomplete.
pnpm exec openspec cannot recover a missing local binary.test ! -d .pi/skills/openspec-explore correctly re-triggers initialization when generated skills are absent.openspec init --force can rewrite tracked AGENTS.md or CLAUDE.md. Generated skill directories are safe; tracked context changes require review.set -euo pipefail
before_status="$(git status --porcelain=v1)"
if [ -n "$before_status" ]; then
printf '%s\n' "Refusing recovery in a dirty worktree" >&2
exit 1
fi
pnpm install --frozen-lockfile
pnpm exec openspec --version
pnpm exec openspec init --tools pi --force
for skill in openspec-explore openspec-propose openspec-apply-change openspec-update-change openspec-archive-change; do
test -d ".pi/skills/$skill" || exit 1
done
after_status="$(git status --porcelain=v1)"
test -z "$after_status"
Completion requires setup success, every named directory, and empty Git status before and after recovery.
Take blackbelttechnology/fix-worktree-opsx-skills-not-created from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.
The instructions reference npm, npx.
Without those the skill loads but fails at the first command.