Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Code → PRD

Reverse-engineer a codebase into a Product Requirements Document (PRD) scaffold. The toolchain scans routes, HTTP APIs, models, and structure, then emits JSON you can turn into human-readable docs.

Quick start

# Analyze → JSON (default)
python3 scripts/codebase_analyzer.py /path/to/project -o analysis.json

# Human-readable summary
python3 scripts/codebase_analyzer.py /path/to/project -f markdown -o analysis.md

# Scaffold PRD directory from analysis
python3 scripts/prd_scaffolder.py analysis.json -o prd/ -n "My App"

In Cursor, the code-to-prd skill (SKILL.md) drives the full PRD workflow; /code-to-prd /path/to/project is the intended slash-command entry point.

Supported frameworks

Stack Frameworks
Frontend React, Vue, Angular, Svelte, Astro, Next.js, Nuxt, SvelteKit, Remix
Backend NestJS, Express, Fastify, Django, DRF, FastAPI, Flask, Spring Boot (Maven / Gradle)
Fullstack Next.js (pages + API routes), Nuxt (pages + server), Django (views + templates)

Both scripts use only the Python standard library (no pip install).

Spring Boot and Java support

The analyzer treats the project as Spring Boot when pom.xml or build.gradle / build.gradle.kts references Spring Boot (parent BOM, plugins, or spring-boot artifacts). It works for single-module and multi-module layouts (Maven <modules> / Gradle include).

What gets extracted

  • REST routes — Classes annotated with @RestController or @Controller. Paths combine the class-level @RequestMapping (or implicit prefix from stereotype annotations) with method-level @GetMapping, @PostMapping, @PutMapping, @DeleteMapping, @PatchMapping, or @RequestMapping(method=…). Each entry includes HTTP method and source file.
  • Domain models — JPA @Entity classes; DTO-style types named or matching *Dto, *Request, *Response, *Body (classes or record types).
  • Java / EE alignmentjava_version (major, from Maven/Gradle), spring_boot_version (from parent or plugin), and java_ee_namespace (javax | jakarta | both | unknown) from imports (with inference from Spring Boot 2.x vs 3.x when needed).
  • Layout hints — Under structure.spring_boot: Java source roots, application*.yml / .properties paths, inferred controller / entity / repository / DTO package directories, and a lombok flag when Lombok appears in build files (useful when fields are generated).

Ignored paths — Build output such as Maven target/ is skipped so analysis stays on sources.

Backend-only PRDs — For a service with no frontend routes, inventory items correspond to API resource groups (controllers/modules) rather than UI pages.

Single controller — For documenting one class in isolation, use prompt-engineering.md together with Spring Boot Controller PRD Mode in SKILL.md.

What the PRD scaffold contains

prd/
├── README.md                  # System overview stub
├── pages/
│   ├── 01-user-mgmt-list.md   # Per-page or per-endpoint stubs
│   └── ...
└── appendix/
    ├── enum-dictionary.md     # Enums and constants from analysis
    ├── api-inventory.md       # API / endpoint reference
    └── page-relationships.md  # Navigation and coupling notes

Scripts

Script Purpose
codebase_analyzer.py Walk the tree → routes, backend endpoints, client API usage, enums, models, stack metadata
prd_scaffolder.py Build prd/ from analysis JSON

CLI highlights for the analyzer: -o / --output, -f json|markdown (default json). Run --help on either script for full options.

References

  • references/framework-patterns.md — Conventions per framework (including Spring Boot)
  • references/prd-quality-checklist.md — Completeness and accuracy checks
  • SKILL.md — End-to-end PRD workflow and Spring Boot Controller PRD Mode

Attribution

Inspired by code-to-prd by @lihanglogan.

Also inspired by the Product Team — Code → PRD skill in claude-skills by @alirezarezvani.

License

MIT

About

Reverse-engineer a codebase into a PRD scaffold: scan routes, HTTP APIs, models, and structure; emit JSON or Markdown. Python stdlib only; strong Spring Boot / Java support. Works with the Cursor code-to-prd skill.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages