SkillGild
Development

OpenSpec Compact

Compact a project's OpenSpec main specs: find requirements specified twice, scenarios pasted under several requirements and leftovers from archive, then write the cleanup as one reviewable OpenSpec change.

  • 25 free runs a month
  • Runs in your agent, private tools on SkillGild
  • v1.0.0
  • SkillGild
skillgild install openspec-compact
Works with
  • Claude Code
  • Codex
  • Cursor
  • Gemini CLI
and any MCP client

Created by SkillGild

What you get

  • A scan of every main spec for requirements specified twice, in one capability or across several
  • Scenarios pasted under more than one requirement, and requirement names that clash
  • Leftovers from archive: placeholder Purposes, one-requirement capabilities and empty ones
  • Older requirements that would fail `openspec validate` today: no SHALL/MUST or no scenario
  • The cleanup written as one OpenSpec change (proposal, tasks, delta specs), so your team reviews it before anything changes
  • A validation pass on that change before you archive it

Is it a good fit?

Good for

  • Teams whose openspec/specs folder has grown to dozens or hundreds of capabilities
  • Projects where agents keep reading two versions of the same rule before proposing a change
  • Tidying specs before onboarding new people or agents to a codebase

Not for

  • Projects that do not use OpenSpec
  • Semantic contradiction checks: similarity is based on wording, so your agent reads each candidate before merging
  • Editing specs directly; every edit goes through an OpenSpec change

Requirements

  • A project with an openspec/specs directory
  • A coding agent connected to SkillGild: Claude Code, Codex, Cursor or Gemini CLI
  • The OpenSpec CLI to archive the change (optional for the scan itself)

Install the OpenSpec Compact skill

Pick your agent. The wrapper only tells your agent how to start a session. The skill's instructions arrive with each session, after your access is checked.

  1. Sign in once from your terminal.

    Terminal
    skillgild login
  2. Install this skill for Claude Code.

    Terminal
    skillgild install openspec-compact --agent claude-code
  3. Register the SkillGild MCP server with Claude Code.

    Terminal
    claude mcp add --scope user skillgild -- $(command -v skillgild) mcp

How it runs

  1. Your agent starts a session. SkillGild checks your access and allowance, counts one run, and sends the skill's instructions for this task.
  2. Your agent does the work with its own model and tools, in your project. SkillGild makes no AI model call.
  3. Private steps run on SkillGild. Your agent calls the server tools below and gets their results. The tool code never leaves SkillGild, and tool input is not stored.

Use it from code

Start a session, call its tools, then end it. Create an API key under Account and pass it as a bearer token.

Terminal
# Prints the session ID, its tools and the instructions for your agent
skillgild session openspec-compact
skillgild call <session-id> compact_specs --input '{"specs":[{"path":"specs/auth/spec.md","content":"# auth Specification\n\n## Purpose\nSign-in and account recovery.\n\n## Requirements\n\n### Requirement: Password reset\nThe system SHALL email a single-use reset link that expires after one hour.\n\n#### Scenario: Known address\n- **WHEN** a user requests a reset for a registered email address\n- **THEN** a reset link valid for one hour is emailed\n"},{"path":"specs/account-recovery/spec.md","content":"# account-recovery Specification\n\n## Purpose\nTBD - created by archiving change add-recovery. Update Purpose after archive.\n\n## Requirements\n\n### Requirement: Reset password by email\nThe system SHALL email a single-use reset link that expires after one hour.\n\n#### Scenario: Registered email\n- **WHEN** a user requests a reset for a registered email address\n- **THEN** a reset link valid for one hour is emailed\n"}]}'
skillgild end <session-id>

Server tools

Each call uses one of the session's tool calls.

compact_specsFind OpenSpec specs to compact

Reads a project's main specs (openspec/specs/**/spec.md) and lists compaction candidates: near-duplicate requirements across or within capabilities, scenarios repeated under several requirements, repeated requirement names, placeholder Purposes left by archive, one-requirement capabilities and oversized ones, and requirements missing SHALL/MUST or scenarios. Similarity is lexical, not semantic, so read each candidate before merging. It changes nothing: write the cleanup as an OpenSpec change (MODIFIED for the requirement you keep with every scenario you keep, REMOVED for the ones folded into it).

FieldTypeNotes
specsRequiredarrayNo extra rules.
max_findingsintegerMinimum 1. Maximum 500
similaritynumberMinimum 0.3. Maximum 0.95

validate_changeValidate an OpenSpec change

Checks a proposed OpenSpec change the way `openspec validate` does: change name, the proposal's Why and What Changes sections, delta spec sections (ADDED/MODIFIED/REMOVED/RENAMED Requirements), SHALL/MUST requirement text, scenarios and task checkboxes. Checks structure only; it does not read the project or judge whether the plan is right.

FieldTypeNotes
change_nameRequiredstringUp to 120 characters
specsRequiredarrayNo extra rules.
proposalstringUp to 60000 characters
skip_specsbooleanNo extra rules.
tasksstringUp to 60000 characters

Questions

Does OpenSpec Compact change my specs?

Not directly. It writes a normal OpenSpec change under openspec/changes/ with MODIFIED, REMOVED, ADDED and RENAMED deltas. Your specs change only when you review the change and run openspec archive.

How does it decide two requirements are duplicates?

It compares word pairs after removing the words every requirement shares, such as SHALL, WHEN and THEN. That catches copied and lightly edited requirements, but not two requirements that say the same thing in different words. Your agent reads every candidate and drops false positives before writing the change.

What leaves my machine?

Only the contents of openspec/specs/**/spec.md go to SkillGild's server tool, which runs code and makes no AI model call. Your source code is not sent.

How is this different from the OpenSpec CLI?

The CLI validates and archives one change at a time. It has no command that reads all main specs together to find duplicated requirements or leftover structure. OpenSpec Compact does that, then hands the result back as an ordinary OpenSpec change.

Related guides

Setup steps and worked examples for this kind of skill.