openspec-generate-baseline
Skill0 starsChanged 2 months agoMITView on GitHub
Generates an OpenSpec baseline by reverse-engineering the code (src/, README.md, AGENTS.md) and archives it directly. Use when the project has code but no OpenSpec specifications.
In this repository20 other files it gives its agents.
- AGENTS.mdAGENTS.md
- code-backend-nestjsSkill
- code-frontend-library-reactSkill
- doc-changelog-generationSkill
- doc-design-generationSkill
- doc-domain-generationSkill
- doc-guardrail-generationSkill
- doc-policy-generationSkill
- doc-readme-generationSkill
- git-tbd-for-sddSkill
- git-worktrees-useSkill
- openspec-init-configSkill
- security-auditSkill
- skill-masterSkill
- skill-test-evalsSkill
- test-cypress-cucumberSkill
- test-nestjs-jest-testing-moduleSkill
- test-nestjs-supertestSkill
- test-playwright-cucumberSkill
- test-react-testing-librarySkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. About 0 are common, 3 are distinctive, and 10 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 24
Does not run /opsx:apply — it does not plan new work, it only documents the current state.
- Very specific: line 38
Check whether the src/ directory exists at the project root:
- Very specific: line 39
If src/ exists → use it as the main source directory and continue
- Very specific: line 40
If src/ does not exist → list all directories at the project root and ask the user: *"The src/ directory was not found.
- Very specific: line 44
Check whether openspec/changes/baseline/ exists:
- Distinctive: line 45
If it does not exist → continue to step 3
- Distinctive: line 46
If it exists → ask the user with two options:
- Very specific: line 47
Overwrite: delete the existing change and create a new one named baseline
- Very specific: line 48
Date suffix: create the new change with the name baseline-YYYY-MM-DD (using the current date)
- Distinctive: line 50
Use the chosen name in all subsequent steps.
- Very specific: line 54
Use the /opsx:propose skill, passing the following reverse-engineering prompt as the change description:
- Very specific: line 67
Wait for /opsx:propose to complete all artifacts (proposal.md, design.md, specs/, tasks.md).
- Very specific: line 79
When /opsx:archive requests confirmation about incomplete tasks in tasks.md, confirm that you want to archive anyway: in a baseline, tasks …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
OpenSpec Baseline Generation
Overview
Generates a baseline set of OpenSpec specifications by reverse-engineering the existing code (src/, README.md, AGENTS.md) and archives it as a historical reference point of the system's state when adopting OpenSpec.
Flow: /opsx:propose baseline (reverse engineering) → /opsx:archive (without apply)
Capabilities:
- Reverse-engineers the code to deduce behavior, business rules, flows, and existing capabilities.
- Creates the
baselinechange (orbaseline-YYYY-MM-DD) and archives it directly, without an apply phase.
Limitations:
- Does not run
/opsx:apply— it does not plan new work, it only documents the current state. - The generated artifacts are an initial approximation that requires manual review for anything that cannot be inferred from the code.
Prerequisites
- The project has source code but does not yet have OpenSpec specifications.
- OpenSpec is initialized (the
openspec/directory exists). - A source code directory exists (
src/by default; otherwise the user indicates which one). - The
/opsx:proposeand/opsx:archiveskills are available.
Execution
Verify the source code directory
Check whether the
src/directory exists at the project root:- If
src/exists → use it as the main source directory and continue - If
src/does not exist → list all directories at the project root and ask the user: "Thesrc/directory was not found. Which of these directories contains the source code?". Use the directory the user indicates.
- If
Check whether a
baselinechange already existsCheck whether
openspec/changes/baseline/exists:- If it does not exist → continue to step 3
- If it exists → ask the user with two options:
- Overwrite: delete the existing change and create a new one named
baseline - Date suffix: create the new change with the name
baseline-YYYY-MM-DD(using the current date)
- Overwrite: delete the existing change and create a new one named
Use the chosen name in all subsequent steps.
Invoke
/opsx:proposewith a reverse-engineering instructionUse the
/opsx:proposeskill, passing the following reverse-engineering prompt as the change description:Change name:
baseline(or the one chosen in step 2)Instruction for the proposal: Please read exhaustively the source code in the
<source-directory>/directory and theREADME.mdandAGENTS.mdfiles (if present), and generate in reverse (by reverse-engineering the code for retrofitting and deducing implemented features) the OpenSpec specification artifacts that describe:- The current behavior of the system (what it does today, how it does it)
- The implemented business rules (validations, conditions, constraints)
- The main user or data flows (happy paths and detected error cases)
- The existing capabilities, grouped by functional domain
The generated artifacts are an initial approximation based on the current code. They must be reviewed manually to complete whatever cannot be inferred from the code (business intent, design decisions not expressed in code).
Wait for
/opsx:proposeto complete all artifacts (proposal.md, design.md, specs/, tasks.md).Skip the apply phase
Do not run
/opsx:apply.The code already exists — there is no pending implementation. The baseline change documents the current state of the system; it does not plan new work.
Archive the change directly
Invoke the
/opsx:archiveskill with the change name (baselineor the one chosen in step 2).When
/opsx:archiverequests confirmation about incomplete tasks intasks.md, confirm that you want to archive anyway: in a baseline, tasks do not represent work to be done.
Output
- A
baselinechange (orbaseline-YYYY-MM-DD) archived inopenspec/changes/archive/YYYY-MM-DD-baseline/. - Capability specs generated in
openspec/specs/<capability>/spec.md. A final summary shown to the user:
## Baseline generated and archived **Archived change:** openspec/changes/archive/YYYY-MM-DD-baseline/ **Specs generated in:** openspec/specs/<capability>/spec.md The baseline reflects the state of the system at the time of adopting OpenSpec. Review the generated specs and manually complete any section marked as low-confidence inference or with placeholders. For the next real change, use `/opsx:propose` normally.
Examples
Manual invocation:
/openspec-generate-baseline
→ Detects src/, invokes /opsx:propose baseline with a reverse-engineering instruction, skips apply, and archives the change with /opsx:archive, showing the final summary.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

