ss-reverse-spec
Skill2 starsChanged 5 months agoApache-2.0View on GitHub
Reverse-engineers OpenSpec source-of-truth capability specs from an existing (brownfield) codebase, either as a full baseline sweep or for a single capability. Bootstraps the openspec/ skeleton first if the project doesn't have one yet. Use this to give a legacy repository a meaningful starting spec instead of an empty openspec/specs/ directory.
In this repository21 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- ss-archiveSkill
- ss-cleanupSkill
- ss-code-reviewSkill
- ss-codingSkill
- ss-coding-workflowSkill
- ss-create-branchSkill
- ss-create-prSkill
- ss-feature-workflowSkill
- ss-guardrailsSkill
- ss-inspectSkill
- ss-list-changesSkill
- ss-multi-repo-workflowSkill
- ss-planSkill
- ss-proposalSkill
- ss-referencesSkill
- ss-show-specSkill
- ss-trace-specSkill
- ss-troubleshooting-workflowSkill
- ss-write-specSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 23
Check whether openspec/specs/ and openspec/changes/ already exist.
- Distinctive: line 65
Write observable behavior only.
- Distinctive: line 95
Every Requirement MUST have at least one Scenario and direct evidence in code.
- Very specific: line 108
If openspec/specs/<capability>/spec.md already exists, ask the user to choose one of:
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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
Reverse OpenSpec Baseline
Generate source-of-truth specs under openspec/specs/ from existing code. This is how a
brownfield repository gets a meaningful capability snapshot instead of starting from an
empty openspec/specs/ directory.
Inputs
One of:
--baseline— scan the whole repository and generate specs for every capability found- a single capability name — generate or update just that one spec
Optional: --include <path> / --exclude <path> to scope the scan.
Step 0: Ensure the OpenSpec Skeleton Exists
Check whether openspec/specs/ and openspec/changes/ already exist. If this repository
has no OpenSpec structure yet, create it first by following
../ss-references/openspec-skeleton.md, then continue below. If the skeleton already
exists, skip straight to the requested mode.
Modes
| Mode | Trigger | Output |
| Baseline | --baseline | scan the repo, generate specs for every capability found |
| Single capability | a capability name | generate or update one capability spec |
Process: Baseline Mode
Step 1: Discover Capability Candidates
Collect signals from:
README.md, an application-overview doc, anddocs/- controller / handler / route files
- service / domain layer names
- OpenAPI paths
- database migration or DDL table names
Cluster the candidates into kebab-case business noun phrases. For each candidate, list the evidence files that back it.
Step 2: User Confirmation Gate
Show the candidate list with evidence and ask the user to confirm merges, splits, renames, or removals. Do not generate baseline specs until capability ownership is confirmed.
Step 3: Reverse-Engineer Requirements
For each confirmed capability, inspect only the relevant files:
- public API / controller / handler behavior
- service or domain behavior
- DTO / schema validation
- error handling visible to callers
- relevant tests
Write observable behavior only. Do not include implementation details — cache choice, table names, internal algorithms — unless callers can actually observe them.
Step 4: Write Source-of-Truth Specs
Write openspec/specs/<capability>/spec.md:
# Capability: <capability>
> Baseline - reverse-engineered by the `ss-reverse-spec` skill.
> Generated at commit: <sha>
> Date: <YYYY-MM-DD>
> This baseline may be incomplete. It gets corrected over time through Phase 0 deltas
> generated by the `ss-plan` skill.
## Purpose
<one paragraph>
## Requirements
### Requirement: <name>
The system SHALL ...
#### Scenario: <name>
- **WHEN** ...
- **THEN** ...Every Requirement MUST have at least one Scenario and direct evidence in code.
Step 5: Self-Review
Check for:
- duplicate Requirements across capabilities
- orphan code paths that don't belong to any capability
- Requirements that read like historical bugs rather than intended behavior
- missing edge cases that are visible in code or tests
Single Capability Mode
If openspec/specs/<capability>/spec.md already exists, ask the user to choose one of:
- overwrite it, keeping a
.bakbackup - output a diff for manual merge
- stop
Output
Report:
- number of capabilities generated
- Requirement count
- orphan code list, if any
- files written
- a reminder that baseline specs are AI-reverse-engineered and need human review before commit
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.

