원클릭으로
openspec-retrofit
Reverse-engineer OpenSpec specs from existing codebase with interactive confirmation.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Reverse-engineer OpenSpec specs from existing codebase with interactive confirmation.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | OpenSpec: Retrofit |
| description | Reverse-engineer OpenSpec specs from existing codebase with interactive confirmation. |
| category | OpenSpec |
| tags | ["openspec","retrofit","discovery"] |
Guardrails
openspec/AGENTS.md for OpenSpec conventions and spec format rules.Workflow
Track these phases as TODOs. Use parallel exploration where steps are independent.
Launch these tasks in parallel using the Task tool with subagent_type=Explore:
Detect Tech Stack - Check for marker files:
package.json → Node/JavaScript ecosystem
dependencies for: react, next, vue, angular, express, fastifydevDependencies for: typescript, tailwindcss, playwright, jestrequirements.txt or pyproject.toml → Python ecosystem
go.mod → Go ecosystemCargo.toml → Rust ecosystemGemfile → Ruby ecosystemcomposer.json → PHP ecosystemdocker-compose.yml → Container orchestrationIdentify Architecture Patterns - Analyze directory structure:
routers/, services/, repositories/, models/, handlers/app/, pages/, features/, components/, hooks/lib/, utils/, common/, shared/Discover Dev Commands - Extract from configuration files:
package.json scripts sectionMakefile targetspyproject.toml scriptsFind Existing Conventions - Look for documentation:
README.md - Project overview and setupCONTRIBUTING.md - Contribution guidelines.editorconfig - Code style settingsDetect Constraints - Identify from code patterns:
Compile findings into an in-memory Discovery Report.
Analyze routes, services, and features to identify logical capabilities.
User-Facing Features - Parse routes/pages:
@router.get, @router.post, etc.app.get, router.post, etc.urlpatterns, @api_viewapp/**/page.tsxpages/**/*.tsx/compliance/* → "compliance")Internal Capabilities - Analyze services/modules:
Group into Capability Boundaries - Apply naming conventions:
user-auth, jira-integration, compliance-reportingportal-core - Shell, routing, shared UI, infrastructure<integration>-integration - External API integrations<feature>-<domain> - Feature-specific capabilitiesRate Confidence - For each capability:
For each capability, note: name, purpose, key files, dependencies, confidence level.
Generate specs following OpenSpec format. Do NOT write files yet.
Generate project.md - Create project context document:
# Project Context
## Purpose
[Extracted from README or inferred from codebase]
## Tech Stack
### Frontend
- [Detected frontend technologies]
### Backend
- [Detected backend technologies]
### Infrastructure
- [Detected infrastructure components]
## Project Conventions
### Code Style
[Extracted from linter configs, .editorconfig]
### Architecture Patterns
[Detected from directory structure]
### Testing Strategy
[Inferred from test files and configs]
### Git Workflow
[If detected from .github, commit patterns]
## Important Constraints
[Rate limits, read-only, security requirements, etc.]
Generate capability specs - For each identified capability:
# <capability-name> Specification
## Purpose
[1-2 sentence description]
## Requirements
### Requirement: <Feature Name>
The system SHALL [behavior using normative language].
#### Scenario: <Happy path>
- **GIVEN** [precondition]
- **WHEN** [action]
- **THEN** [expected outcome]
#### Scenario: <Error case>
- **GIVEN** [error condition]
- **WHEN** [action attempted]
- **THEN** [error handling behavior]
Requirement extraction heuristics:
Scenario extraction heuristics:
Validate generated content (in memory):
#### Scenario:Store all generated content in memory.
Present findings and obtain user approval before writing.
Present Discovery Summary:
=== RETROFIT SUMMARY ===
Tech Stack Detected:
- Frontend: [e.g., Next.js 15, React 19, TypeScript, Tailwind CSS]
- Backend: [e.g., Python 3.11+, FastAPI, SQLAlchemy, PostgreSQL]
- Infrastructure: [e.g., Docker Compose, Redis]
Architecture Pattern: [e.g., Clean Architecture]
Dev Commands:
- Start: [command]
- Test: [command]
- Lint: [command]
Present Capability Summary:
Capabilities Identified: [N]
1. [capability-name] (confidence: high)
Purpose: [brief description]
Requirements: [N] | Scenarios: [N]
Key files: [2-3 key files]
2. [capability-name] (confidence: medium)
...
Interactive Confirmation - Use AskUserQuestion for decisions:
a. Check for existing openspec/:
openspec/.backup/)project.md if missingb. project.md confirmation:
c. Per-capability confirmation:
d. Low confidence capabilities:
Build Final Write Plan:
Only proceed after explicit user confirmation from Phase 4.
Create directory structure (if missing):
openspec/
├── project.md
└── specs/
├── [capability-1]/
│ └── spec.md
└── [capability-2]/
└── spec.md
Handle existing openspec/:
openspec/.backup/<timestamp>/ firstproject.mdWrite files in order:
a. Create openspec/ directory if needed
b. Write openspec/project.md
c. For each confirmed capability:
openspec/specs/<capability>/ directoryopenspec/specs/<capability>/spec.mdPost-write validation:
openspec validate --strictReport completion:
=== RETROFIT COMPLETE ===
Files created:
- openspec/project.md
- openspec/specs/[capability-1]/spec.md
- openspec/specs/[capability-2]/spec.md
Validation: [PASSED/FAILED with N issues]
Next steps:
1. Review generated specs and refine requirements
2. Run `openspec list --specs` to verify
3. Use `openspec validate --strict` to check format
NOTE: These specs are a starting point. Refine them
to reflect intended behavior, not implementation quirks.
Monorepo Detection: If multiple package.json/requirements.txt found:
api-auth, web-dashboard)Partial Existing Specs: If some specs exist but are incomplete:
Reference
openspec list --specs - Verify created specsopenspec validate --strict - Validate format complianceopenspec/AGENTS.md - OpenSpec conventions referencesubagent_type=Explore - Parallel codebase explorationmcp__plugin_context7_context7__resolve-library-id
mcp__plugin_context7_context7__query-docs