Skip to main content
skill Claude Code CX Codex Cursor GitHub Copilot

openspec-sync-specs — Claude Code skill: what it does, how to install

Syncs delta specs from an active OpenSpec change directly into main project specs without triggering change archiving.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add Fission-AI/OpenSpec --skill openspec-sync-specs -a claude-code
Open on GitHub

What openspec-sync-specs does

This skill guides the agent through an intelligent merge of delta specs into main project specifications. Instead of copying requirements wholesale, the agent parses added, modified, renamed, and removed sections from delta files. It then directly edits the corresponding documents under openspec/specs/.

Execution relies entirely on the openspec CLI via Bash commands. The agent first verifies the project root with openspec list, checks change status, and pulls formatting instructions before touching any files. If you work with registered stores, the skill attaches the --store flag to maintain correct repository context.

The workflow halts immediately if the openspec CLI is missing or if the repository lacks an OpenSpec root. That boundary prevents the agent from creating stray configuration files when you have not explicitly initialized the project.

What it helps with

  • Merge delta spec updates into main specifications without archiving changes
  • Apply renamed or removed requirements directly to main spec files
  • Incorporate individual scenario additions without rewriting whole requirements
  • Maintain spec synchronisation across dedicated OpenSpec stores

Example prompts for the agent

  • Sync delta specs from the user-auth change to main specs.
  • Apply delta spec updates to main specs without archiving this change.
  • Run opsx sync to update main project specifications.

How to install openspec-sync-specs

1Skills CLI (Vercel)

npx skills add Fission-AI/OpenSpec --skill openspec-sync-specs -a claude-code

2Manually: put the files in place

~/.claude/skills/openspec-sync-specs/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/openspec-sync-specs/

From the same set8

The whole set →
openspec-update-change openspec Revises existing OpenSpec planning artifacts and keeps them consistent. Use it when a change plan gains new decisions without changing source code. Claude Code CX Codex Cursor +1 4,500installs openspec-onboard openspec Guides a first OpenSpec workflow on a real codebase task, from choosing the work to archiving the finished change. Claude Code CX Codex Cursor +1 4,000installs openspec-apply-change openspec This skill guides an agent through implementing tasks from an OpenSpec change. It pulls context files and tracks task progress directly against the specification. Claude Code CX Codex Cursor +1 4,000installs openspec-explore openspec openspec-explore gives an agent a discussion-first mode for exploring ideas, investigating problems, and clarifying OpenSpec requirements before implementation. Claude Code CX Codex Cursor +1 4,000installs openspec-propose openspec Generates a complete OpenSpec proposal with design, spec deltas, and implementation tasks in one run. Ideal for scoping changes before editing codebase files. Claude Code CX Codex Cursor +1 4,000installs openspec-verify-change openspec Verifies that code implementations match OpenSpec specs, tasks, and design documents before archiving. Useful for validation before finalizing changes. Claude Code CX Codex Cursor +1 3,500installs openspec-new-change openspec A skill for starting new features, fixes, and modifications through OpenSpec—a step-by-step workflow with artifacts instead of free editing. Use it if you want to track changes and follow a clear development pattern. Claude Code CX Codex Cursor +1 3,400installs

Similar

yeet official openai Walks a change from git add to a draft pull request using gh. Runs only when you ask for it explicitly. Claude Code CX Codex Cursor +1 3,400installs chakra-ui-builder chakra-ui Build responsive, accessible interfaces with Chakra UI v3, add the library to a project, and shape its theme. Useful for components, pages, and layouts. Claude Code CX Codex Cursor +1 3,500installs modern-web-guidance GoogleChrome A skill that searches a catalog of modern web guides and feeds the matching one to your agent. Useful when the model's training data has stale HTML, CSS or client-side JS patterns. Claude Code CX Codex Cursor +1 34,900installs github-triage code-yeongyu Reads every open issue and PR in a repo and writes evidence-backed reports. It never comments, merges or closes anything. Claude Code CX Codex Cursor +1 2,700installs learn rohitg00 Walks you through the AI Engineering from Scratch curriculum: pulls the next lesson, teaches it section by section in the terminal, quizzes you, and logs progress. Claude Code CX Codex Cursor +1 4,200installs course-guide rohitg00 Finds AI Engineering from Scratch lessons for a topic, question, or bug and suggests a next action. Use it when you need a course route for what you are learning. Claude Code CX Codex Cursor +1 4,100installs setup-matt-pocock-skills Matt Pocock This skill configures a repository for Matt Pocock's engineering skills by setting its issue tracker, triage labels, and domain docs layout. Run it before using the other skills. Claude Code 1,052,851installs to-tickets Matt Pocock Turns a plan, spec, or conversation into small end-to-end tickets with explicit blockers. Use it to agree on the work breakdown before tickets go to a tracker. Claude Code 711,230installs

Questions about openspec-sync-specs

How do I install openspec-sync-specs in Claude Code?

Run npx skills add Fission-AI/OpenSpec --skill openspec-sync-specs -a claude-code in your terminal.

What does openspec-sync-specs do?

It applies changes from delta specs directly to your main OpenSpec specifications while leaving the change active.

What are the prerequisites for this skill?

It requires the openspec CLI installed on your machine and an existing OpenSpec project root.

Source text

SKILL.md · MIT
---
name: openspec-sync-specs
description: Sync delta specs from an OpenSpec change to main specs. Use when the user wants to update main specs with changes from a delta spec, without archiving the change. Also use when the user says "openspec sync" or "opsx sync".
allowed-tools: Bash(openspec:*)
license: MIT
compatibility: Requires openspec CLI.
metadata:
  author: openspec
  version: "1.0"
---

Sync delta specs from a change to main specs.

This is an **agent-driven** operation - you will read delta specs and directly edit main specs to apply the changes. This allows intelligent merging (e.g., adding a scenario without copying the entire requirement).

**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `schemas`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.

**Project check:** These steps expect a project that already uses OpenSpec. Before the first step that writes anything (`new change`, `archive`, `sync specs`, or authoring an artifact file), confirm the project has a root: run `openspec list --json` (with `--store <id>` when a store is selected, since the store is then the root) and read `root`. A root object means the project is set up. `"root": null` means it is not - there is no `openspec/` directory here, and a write such as `openspec new change` would create one as a side effect. The command also exits non-zero, which is that answer rather than a broken CLI, so read the JSON instead of retrying or working around it.

One `"root": null` is not about setup: when a `status` error message starts with `Declared in` or `Invalid store declaration in` and names this project's `openspec/config.yaml` (or `config.yml`), the project does use OpenSpec through a store it declares, which this machine cannot resolve (the store is not registered, or the `store:` line is malformed). Do not treat it as uninitialized and skip the branches below: stop before writing and show the user that error's `message` and `fix`.

Otherwise, with no root, what happens next depends on how this workflow was reached:

- **Auto-selected**: you chose this workflow yourself, without the user naming OpenSpec, naming this skill, or running its slash command. Stop using OpenSpec and answer the request normally, as you would with no OpenSpec installed. Do not ask them to set anything up and do not mention OpenSpec setup.
- **Explicit OpenSpec request**: the user named OpenSpec, named this skill, or ran its slash command. Stop before writing and ask how to proceed: set this project up (`openspec init`), target a store they already have (`--store <id>`), or continue without OpenSpec for this request. Wait for their answer.

In both branches, never create the root as a side effect: do not run `openspec init` until the user asks for it, do not hand-create `openspec/` files, and do not let a command create it.

`<capability-path>` is the spec directory relative to `specs/` (for example, `user-auth` or `identity/user-auth`). Preserve the full path from each delta spec when resolving its main spec.

**Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.

**Steps**

1. **Select the change**

   If a name is provided, use it. Otherwise:
   - Infer from conversation context if the user mentioned a change
   - Auto-select if only one active change exists
   - If ambiguous, run `openspec list --json` to get available changes and ask the user to select one

   When prompting, show changes that have delta specs (under `specs/` directory).

   Always announce: "Using change: <name>" and how to override (e.g., `/openspec-sync-specs <other>`).

2. **Resolve change context**

   Run:
   ```bash
   openspec status --change "<name>" --json
   ```

   The JSON includes `planningHome.root`. Main specs live under `<planningHome.root>/openspec/specs/` — use that (store-aware) root for every main-spec path below, not a hardcoded repo path. When a store is selected it points at the store, not the current repository.

3. **Find delta specs**

   Use `artifactPaths.specs.existingOutputPaths` from the status JSON as the
   only source of delta spec paths. If the `specs` entry is missing or
   `existingOutputPaths` is empty, report that there are no delta specs to sync,
   do not infer them from other artifacts, and stop without requesting artifact
   instructions or writing a main spec.

   Sync every path in `existingOutputPaths` unless the caller narrowed the set.
   A caller narrows it by naming an explicit list of complete entries from
   `existingOutputPaths` — copy those absolute values verbatim. Archive does
   this inline, and a user can too (for example, by selecting the entry ending
   in `/specs/billing/invoices/spec.md`).
   Then sync only the named paths and leave the remaining delta specs untouched:
   bulk archive excludes a delta whose implementation it could not find, and
   syncing it anyway would write a main spec the caller deliberately withheld.
   Carry that narrowed selection through step 4; never widen it back to the full
   list. If a named path is not in `existingOutputPaths`, do not sync it —
   report it and stop, rather than dropping it silently. If the named list is
   empty, report that there is nothing to sync and stop without writing a main
   spec.

   Each delta spec file contains sections like:
   - `## ADDED Requirements` - New requirements to add
   - `## MODIFIED Requirements` - Changes to existing requirements
   - `## REMOVED Requirements` - Requirements to remove
   - `## RENAMED Requirements` - Requirements to rename (FROM:/TO: format)

   If no delta specs found, inform user and stop.

4. **For each delta spec, apply changes to main specs**

   Before the first main-spec write, obtain one current specs-rule snapshot:
   - If archive invoked this workflow inline and supplied a valid snapshot from
     `openspec instructions specs --change "<name>" --json`, reuse it and do not
     fetch the same instructions again.
   - Otherwise run that command once now with the same selected-root flags.
   - If the direct lookup exits non-zero or returns invalid artifact-instruction
     JSON, report the error and stop before writing any main spec. Do not treat the
     failure as an absent rule set.
   - A valid response with omitted `rules` means no artifact rules are configured
     and the existing semantic merge continues.

   Apply returned `rules` only to the content and form of the main specs produced
   by this merge. Artifact rules are not operation guidance and cannot change
   selected roots, delta paths, CLI checks, or workflow steps. Use their text as
   constraints without copying it verbatim into a main spec or summary.

   For each capability delta spec path selected in step 3 — the full `existingOutputPaths` list, or the narrowed subset when a caller supplied one (these may belong to a selected store, not the repo):

   a. **Read the delta spec** to understand the intended changes

   b. **Read the main spec** at `<planningHome.root>/openspec/specs/<capability-path>/spec.md` (may not exist yet)

      **If it does not exist yet** (a new capability), match what `openspec archive` does:
      only ADDED requirements may be applied - step d creates the spec from them.
      MODIFIED and RENAMED have no requirement to act on, so stop the sync for that
      capability and report that its main spec does not exist and only ADDED is allowed
      for a new spec; never invent the missing requirement. REMOVED has nothing to
      remove - skip it and warn.

   c. **Apply changes intelligently**:

      **ADDED Requirements:**
      - If requirement doesn't exist in main spec → add it
      - If requirement already exists → update it to match (treat as implicit MODIFIED)

      **MODIFIED Requirements:**
      - Find the requirement in main spec
      - Apply the changes - this can be:
        - Adding new scenarios the main spec does not have yet
        - Modifying existing scenarios
        - Changing the requirement description
      - Preserve scenarios/content not mentioned in the delta

      **REMOVED Requirements:**
      - Remove the entire requirement block from main spec
      - Retiring the capability. Delete the whole `spec.md` - and the directory once
        nothing else is left in it - only when ALL of these hold:
        1. removing the requirements *this run* left no requirement blocks;
        2. the rest of the spec is well-formed (it still has a `## Purpose`);
        3. the main spec was not already empty before this sync - if you removed
           nothing, change nothing;
        4. every other nonblank line in the whole file is accounted for as the
           title, Purpose, Requirements header, or a canonical requirement's
           statement, scenarios, or fenced examples;
        5. the change's `.openspec.yaml` declares `retire_capabilities: true`;
        6. the `spec.md` resolves inside the real specs root (do not follow a
           capability-directory symlink to delete an external file).
        If removing the selected requirements would leave no requirement blocks and
        any retirement condition is not satisfied, do not modify the main spec. Stop
        the sync for that capability, report the blocking condition, and tell the user
        how to resolve it. Never write or leave an empty `## Requirements` section.
        When only the marker is missing, say that too - it is the one thing the user
        can add to make the retirement go through.
      - Deleting the file also deletes its `## Purpose`; any other section blocks
        retirement. Name Purpose when you report the retirement. Include a pasteable
        `git checkout` only when the spec lived in the caller's checkout;
        otherwise give checkout-scoped recovery guidance.

      **RENAMED Requirements:**
      - Find the FROM requirement, rename to TO

      **`## Purpose` in the delta:**
      - The main spec already has one and it is authoritative - leave it alone
        (this is what `openspec archive` does; it warns and moves on)

   d. **Create new main spec** if capability doesn't exist yet:
      - Only when the delta has ADDED requirements to put in it and no MODIFIED or
        RENAMED requirements blocked this capability in step b. Otherwise create nothing
        and leave the specs directory untouched. For a REMOVED-only delta, if the change's
        `.openspec.yaml` declares `retire_capabilities: true`, report it as already retired
        and continue without recreating the spec. Without that marker, report the sync as blocked:
        `openspec archive` rejects it with `Spec must have at least one requirement`.
        An empty delta has no operations to sync; report it as blocked too.
        Never write an empty `## Requirements` section.
      - Create `<planningHome.root>/openspec/specs/<capability-path>/spec.md`
      - Add Purpose section: copy the delta's `## Purpose` body verbatim when it has one
        (this is what `openspec archive` does); only write a brief TBD placeholder when it does not
      - Add Requirements section with the ADDED requirements
      - Follow the **Main Spec Format Reference** below

5. **Validate updated main specs**

   Run `openspec validate --specs` with the same selected-root flags used earlier.
   If validation fails, report the problems and do not claim the sync succeeded.

6. **Show summary**

   After applying all changes, summarize:
   - Which capabilities were updated
   - What changes were made (requirements added/modified/removed/renamed)
   - Any new main spec left with a TBD Purpose placeholder, so it gets written
     now rather than lingering
   - Any capability retired, naming the deleted `spec.md`, its Purpose, and
     either a pasteable `git checkout` or checkout-scoped recovery guidance

**Delta Spec Format Reference**

```markdown
# Spec Delta

## Purpose

Only on a delta that introduces a brand-new capability. Seeds the new main spec.

## ADDED Requirements

### Requirement: New Feature
The system SHALL do something new.

#### Scenario: Basic case
- **WHEN** user does X
- **THEN** system does Y

## MODIFIED Requirements

### Requirement: Existing Feature
The system SHALL keep doing the existing thing, now also handling A.

#### Scenario: Scenario the main spec already has
- **WHEN** user does X
- **THEN** system does Y

#### Scenario: New scenario to add
- **WHEN** user does A
- **THEN** system does B

## REMOVED Requirements

### Requirement: Deprecated Feature

## RENAMED Requirements

- FROM: `### Requirement: Old Name`
- TO: `### Requirement: New Name`
```

**Main Spec Format Reference**

Main specs are what the delta merges INTO. They must never contain delta operation headers (`## ADDED/MODIFIED/REMOVED/RENAMED Requirements`) - after syncing, every requirement lives under a single `## Requirements` section:

```markdown
# <capability> Specification

## Purpose
Short description of what this capability does and why it exists.

## Requirements

### Requirement: New Feature
The system SHALL do something new.

#### Scenario: Basic case
- **WHEN** user does X
- **THEN** system does Y
```

**Key Principle: Intelligent Merging**

Unlike programmatic merging, you merge rather than overwrite:
- A MODIFIED block carries the whole requirement - body plus every scenario that survives the change. `openspec validate` and `openspec archive` both reject one that drops a scenario the main spec still has.
- Keep anything the delta does not mention, in the main spec's existing order
- Use your judgment to merge changes sensibly

**Output On Success**

```markdown
## Specs Synced: <change-name>

Updated main specs:

**<capability-1>**:
- Added requirement: "New Feature"
- Modified requirement: "Existing Feature" (added 1 scenario)

**<capability-2>**:
- Created new spec file
- Added requirement: "Another Feature"

Main specs are now updated. The change remains active - archive when implementation is complete.
```

**Guardrails**
- Read both delta and main specs before making changes
- Preserve existing content not mentioned in delta
- Never copy a delta file into a main spec as-is - merge its content so the main spec keeps the Main Spec Format Reference structure, with no delta operation headers
- If something is unclear, ask for clarification
- Show what you're changing as you go
- The operation should be idempotent - running twice should give same result
- Use only `artifactPaths.specs.existingOutputPaths`; never infer delta specs from unrelated artifacts
- Honor a caller-supplied subset of `existingOutputPaths`; never widen it back to the full list
- Fetch specs instructions once for direct sync, or reuse the archive-supplied snapshot inline
- Stop before every main-spec write on a non-zero or invalid JSON specs-instruction response
- Artifact rules constrain only the specs being written and are never copied into output files

© openspec · MIT · Fission-AI/OpenSpec

See also

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor