Reverse-engineer a frontend codebase into a PRD. Usage: /code-to-prd [path]
Reverse-engineer a frontend codebase into a complete Product Requirements Document.
/code-to-prd # Analyze current project
/code-to-prd ./src # Analyze specific directory
/code-to-prd /path/to/project # Analyze external project
codebase_analyzer.py to detect framework, routes, APIs, enums, and project structureprd_scaffolder.py to create prd/ directory with README.md, per-page stubs, and appendix filesDetermine the project path (default: current directory). Run the frontend analyzer:
python3 {skill_path}/scripts/codebase_analyzer.py {project_path} -o .code-to-prd-analysis.json
Display a summary of findings: framework, page count, API count, enum count.
Generate the PRD directory skeleton:
python3 {skill_path}/scripts/prd_scaffolder.py .code-to-prd-analysis.json -o prd/
For each page in the inventory, follow the SKILL.md Phase 2 workflow:
prd/pages/ stubWork in batches of 3-5 pages for large projects (>15 pages). Ask the user to confirm after each batch.
Complete the appendix files:
prd/appendix/enum-dictionary.md — all enums and status codes foundprd/appendix/api-inventory.md — consolidated API referenceprd/appendix/page-relationships.md — navigation and data coupling mapClean up the temporary analysis file:
rm .code-to-prd-analysis.json
A prd/ directory containing:
README.md — system overview, module map, page inventorypages/*.md — one file per page with fields, interactions, APIsappendix/*.md — enum dictionary, API inventory, page relationshipsproduct-team/code-to-prd/SKILL.mdproduct-team/code-to-prd/scripts/codebase_analyzer.pyproduct-team/code-to-prd/scripts/prd_scaffolder.pyproduct-team/code-to-prd/references/prd-quality-checklist.md