Set up OpenSpec in a repository, or update it: check the CLI, run openspec init for Claude Code with its skills on the machine, install the spec-plan schema (lean specs, then one plan.md implemented one phase per pull request), and write openspec/config.yaml with the repository context. Use when the person asks to add, install, set up or update OpenSpec, or spec-driven development, in a repository.
2 stars
0 votes
0 copies
0 views
Added November 30, 2026
ai-agentsgoshellbashnodegit
Works with
claude code
cursor
terminal
cli
Security analysis
C71/100
criticalPipes output to a shell interpreter
mediumUses curl or wget to download content
criticalDownloads and executes remote scripts — classic supply chain attack
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Openspec Setup?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/jorgecostamacia-openspec-setup)
---
name: openspec-setup
description: >-
Set up OpenSpec in a repository, or update it: check the CLI, run openspec
init for Claude Code with its skills on the machine, install the spec-plan
schema (lean specs, then one plan.md implemented one phase per pull
request), and write openspec/config.yaml with the repository context. Use
when the person asks to add, install, set up or update OpenSpec, or
spec-driven development, in a repository.
disable-model-invocation: true
---
# Set up OpenSpec
OpenSpec keeps the behavior of a repository as specs, and every feature as a change. This skill prepares a repository to work with the `spec-plan` schema. A change has two artifacts: the delta of its specs, and a `plan.md` that is also its task list. A person approves both before anyone writes code, and each phase of the plan goes in its own pull request.
The schema holds the planning and implementation rules, so they apply with any agent and any OpenSpec skill: `/create-plan` or `/openspec-propose`, `/implement-plan-phase` or `/openspec-apply-change`.
## 1. Before starting
- Check that the working tree is clean. The setup is a change like any other, so create its branch first, as the repository's workflow says. The repository's `AGENTS.md` names the workflow.
- Read the repository's `AGENTS.md`. It gives the context for the config. It also says whether the team uses other agents (Cursor, Codex…) and in which language the repository's docs are.
## 2. The CLI
Run `openspec --version`.
- **Installed:** run `openspec version --check`. When a newer version exists, tell the person, with the update command that it prints. Do not update it yourself.
- **Missing:** stop and give the person the command to install the standalone binary, which needs no Node.js. They run it themselves: it downloads and runs an installer, which an agent must not do.
```powershell
irm https://raw.githubusercontent.com/Fission-AI/OpenSpec/main/scripts/binary/install.ps1 | iex
```
```bash
curl -fsSL https://raw.githubusercontent.com/Fission-AI/OpenSpec/main/scripts/binary/install.sh | sh
```
On Windows, only a new terminal reads the new `PATH`. Continue when `openspec --version` answers.
## 3. Initialize or update
- **No `openspec/` folder yet:** `openspec init --tools claude --scope global --profile core --no-animation`. Add the other agents that the team uses to `--tools` (`claude,cursor`; `agents` for any tool that reads `AGENTS.md`). When the repository's docs are not in English, add `--language <language>`. It writes language lines into the config's `context`; keep them in step 4.
- **`openspec/` already there:** first set `skillsScope: global` in `openspec/config.yaml`. Then run `openspec update --dry-run`, show the person the result, and wait for a yes. Then run `openspec update`. It refreshes the skills on the machine. It does not touch the specs or the changes.
- **The repository carries generated skills** from an older setup with project scope: remove them with `git rm -r --ignore-unmatch`, which skips a path that does not exist. The CLI does not remove them by itself. Name each generated path exactly, never a glob such as `openspec*`: it would also remove the repository's own skills whose names start with `openspec`. The paths are:
- `.agents/skills/<skill>` and `.claude/skills/<skill>` for each of `openspec`, `openspec-propose`, `openspec-explore`, `openspec-apply-change`, `openspec-update-change`, `openspec-sync-specs` and `openspec-archive-change`.
- `.agents/skills/.openspec-target`.
Then check that `openspec update --dry-run` changes no file in the repository.
- **A new machine, in a repository that is already set up:** the person runs `openspec init --tools claude --scope global` once on that machine, and `openspec update` after each CLI update. It installs the skills on the machine; `git status` then shows no change in the repository.
**Global scope: the skills live on the machine, not in the repository.** The skills must match the CLI that runs them. In the repository, every CLI update would mean regenerating them in every repository, or they drift. On the machine, one `openspec update` refreshes them for every repository, and the repository keeps only `openspec/`. `update` has no scope flag: it reads `skillsScope` from the config, so the config of step 4 always carries `skillsScope: global`. The only reason for `--scope project` is an agent that cannot read a home folder that someone prepares, such as GitHub's hosted Copilot agent; ask the person before you use it.
The repository gets `openspec/specs/` and `openspec/changes/`. The machine gets seven skills in `~/.agents/skills/` and `~/.claude/skills/`: `openspec` (the entry point), `openspec-propose`, `openspec-explore`, `openspec-apply-change`, `openspec-update-change`, `openspec-sync-specs` and `openspec-archive-change`. They load in every session, of every repository. Add `.agents/skills/` and `.claude/skills/` to the repository's `.gitignore` when the repository has no skills of its own there, so that a project-scope install never gets committed.
If the CLI says that it collects usage data, tell the person how to turn it off, as its message says.
## 4. The schema and the config
- **The schema:** copy [`references/schema/spec-plan/`](references/schema/spec-plan) to `openspec/schemas/spec-plan/` in the repository, as it is. When the repository already has it, replace it with this version and show the person the difference. Never edit the rules inside the repository's copy: a repository rule goes in the config (below).
- **New config:** replace the one that `init` wrote with [`references/config.yaml`](references/config.yaml). Fill `context` from the repository's `AGENTS.md`: what the repository is, what counts as observable behavior there, its stack, the exact build and test commands, the workflow and the base branch of its pull requests. Keep the language lines that `--language` wrote. Summarize; never paste `AGENTS.md` whole. OpenSpec puts the context in the prompt of every artifact and of `apply`.
- **Existing config:** make it match the template. Set `schema: spec-plan` and `skillsScope: global`. Remove the rules and the operations guidance that an older setup wrote, because the schema now holds them. Keep the rules that the repository added itself, under `rules:` with the artifact ids `specs` and `plan`. Read the `context` against the repository's `AGENTS.md` and correct what is no longer true. Show the person the difference and wait for a yes before you write it.
- **Changes in progress:** a change keeps the schema that it was created with. Let the person finish the changes listed by `openspec list` on their old schema, or ask before you move one.
## 5. Tell the repository how to use it
Add this rule to the repository's `AGENTS.md`. If the file has a section of rules that always apply, put it there. If not, add it as a short section near the top.
> **Features start with a plan.** Every `feat` and every breaking change starts with an OpenSpec change (`/create-plan` or `/openspec-propose`): specs and a `plan.md`, which a person approves before any code. Each run of `/implement-plan-phase` or `/openspec-apply-change` implements one phase in its own pull request, and the last phase archives the change. Fixes, chores and dependency updates do not need a plan. OpenSpec's skills live on each machine, not in the repository: on a new machine, run `openspec init --tools claude --scope global` once, and `openspec update` after each CLI update.
## 6. Check and commit
- Run `openspec schema validate spec-plan` and `openspec list`, and check that they show no errors.
- Commit `openspec/`, `AGENTS.md` and the `.gitignore` together, as the repository's commit conventions say, and open the pull request.
- Tell the person that the first change waits for this pull request. A change starts from the base branch, and the base branch has no `openspec/` until the setup merges.
- Tell the person what stays outside this skill. A CI check that runs `openspec validate --all --strict`, or that fails a `feat` pull request without an OpenSpec change, belongs in the repository's workflows.
## Existing behavior
A repository does not need specs for everything before its first change. The specs grow with each change: the first change in an area writes the specs of what it touches, and the next changes modify them. For the current behavior that a change will touch, use `openspec-create-spec-from-code` first.