[Proposal] spec-gen: Reverse-engineer OpenSpec specifications from existing codebases #634
Replies: 2 comments 1 reply
-
|
it would be nice , if this is official |
Beta Was this translation helpful? Give feedback.
-
|
I'm still new to OpenSpec, but this feels like a valuable capability for anyone kicking off true spec-driven development from brownfield. The project seems to be thinking about this as well because they have an FAQ on the OpenSpec website that says:
I can see where they're coming from, but I still think there's a valid use case for generating reverse-engineered specs and documentation for existing codebases in addition to go-forward specs. @clay-good, how many codebases have you run spec-gen on and how happy are you with the results? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
I've built spec-gen, an open-source CLI tool that reverse-engineers OpenSpec-compatible specifications from existing codebases. It addresses the "cold start" problem for teams wanting to adopt OpenSpec on established projects.
Repository: https://github.com/clay-good/spec-gen
The Problem
OpenSpec excels at spec-driven development, but adoption faces a significant barrier for existing projects:
openspec initcreates empty scaffolding — Projects with thousands of lines of code still need to manually write every specificationTeams end up choosing between:
The Solution: spec-gen
spec-gen automates the reverse-engineering process through a combination of static analysis and LLM-based extraction:
Key Features
openspec/specs/*/spec.mdwith RFC 2119 keywords4 Usage Options
spec-gen provides multiple ways to reverse-engineer specifications:
.claude/skills/spec-gen.mdfor natural language useskills/openspec-skill.mdfor OpenSpec's skill systemHow It Works
Phase 1: Static Analysis (No API Key)
.gitignorePhase 2: LLM Generation
Phase 3: Verification
Output Format
Generated specs follow OpenSpec conventions exactly:
Example: OpenSpec CLI Analysis
I ran spec-gen against the OpenSpec CLI itself:
Full example output: https://github.com/clay-good/spec-gen/tree/main/examples
How This Complements OpenSpec
spec-gen is designed to feed into the OpenSpec ecosystem, not replace it:
openspec runwith accurate contextIntegration Points
openspec/specs/*/spec.md— the exact structure OpenSpec expectsTechnical Details
Install and Try
Questions for the Community
openspec reverse-engineer)?--validateflag that runsopenspec validateon generated specs?Links
Beta Was this translation helpful? Give feedback.
All reactions