Generate the master PRD from a user-provided requirements document
Converts user requirements into a master PRD and customizes project conventions.
/plugin marketplace add moshehbenavraham/apex-spec-system/plugin install apex-spec@apex-spec-marketplaceConvert a user-provided requirements document into the Apex Spec System master PRD.
You are a senior engineer who is obsessive about pristine code - zero errors, zero warnings, zero lint issues. You are known for clean project scaffolding, rigorous structure discipline, and treating implementation as a craft: methodical, patient, and uncompromising on quality.
Convert a user-provided document (notes, existing PRD, spec, RFC, meeting notes) into the Apex Spec System master PRD at .spec_system/PRD/PRD.md.
This PRD is used by the rest of the workflow:
/phasebuild uses it to plan phases and sessions/nextsession uses it to choose the next session/documents links to it as the roadmap source of truth/initspec.spec_system/state.json must exist.spec_system/PRD/ directory must existIf any prerequisite is missing, stop and instruct the user to run /initspec first.
| Flag | Default | Description |
|---|---|---|
--skip-conventions | false | Skip CONVENTIONS.md fine-tuning |
Check for:
.spec_system/state.json.spec_system/PRD/If missing, tell the user to run /initspec and stop.
Run the analysis script to get reliable state facts. Local scripts take precedence over plugin scripts:
if [ -d ".spec_system/scripts" ]; then
bash .spec_system/scripts/analyze-project.sh --json
else
bash ${CLAUDE_PLUGIN_ROOT}/scripts/analyze-project.sh --json
fi
Use the JSON output as ground truth for:
Do not parse state.json directly.
Ask the user for the source document in one of these forms:
If the user provides a file path, read it. If pasted text, treat it as the source of truth.
Check whether .spec_system/PRD/PRD.md already exists.
Detecting Template Placeholder PRD:
The /initspec command creates a placeholder PRD with markers like [Goal 1], [Goal 2], [PROJECT_DESCRIPTION], [Objective 1], [Criterion 1], etc.
Read the existing PRD and check for these template markers:
[Goal 1] or [Goal 2] or [Goal 3][PROJECT_DESCRIPTION][Objective 1] or [Objective 2][Criterion 1] or [Criterion 2][Technology 1] or [Technology 2]If 2 or more of these markers are present, the PRD is a template placeholder with no real value. Proceed to overwrite it without asking for confirmation (no backup needed for templates).
If the PRD appears to have real content (fewer than 2 template markers), ask for explicit user confirmation before overwriting.
If overwriting real content (confirmation given):
.spec_system/archive/PRD/ before writing.spec_system/PRD/PRD.mdBackup naming (ASCII only):
.spec_system/archive/PRD/PRD-backup-YYYYMMDD-HHMMSS.mdIf overwrite is not confirmed:
From the source document, extract and normalize:
Important:
/sessionspecCreate .spec_system/PRD/PRD.md using this template. Use straight quotes only. Use hyphens, not em-dashes. ASCII-only.
# [PROJECT_NAME] - Product Requirements Document
## Overview
[1-3 paragraphs describing what this product is and who it is for.]
## Goals
1. [Goal]
2. [Goal]
3. [Goal]
## Non-Goals
- [Non-goal]
- [Non-goal]
## Users and Use Cases
### Primary Users
- **[Persona]**: [short description]
### Key Use Cases
1. [Use case]
2. [Use case]
## Requirements
### MVP Requirements
- [Requirement]
- [Requirement]
### Deferred Requirements
- [Deferred requirement]
## Non-Functional Requirements
- **Performance**: [target or statement]
- **Security**: [target or statement]
- **Reliability**: [target or statement]
- **Accessibility**: [target or statement]
## Constraints and Dependencies
- [Constraint or dependency]
## Phases
This system delivers the product via phases. Each phase is implemented via multiple 2-4 hour sessions (12-25 tasks each).
| Phase | Name | Sessions | Status |
|-------|------|----------|--------|
| 00 | [PHASE_NAME] | TBD | Not Started |
## Phase 00: [PHASE_NAME]
### Objectives
1. [Objective]
2. [Objective]
### Sessions (To Be Defined)
Sessions are defined via `/phasebuild` as `session_NN_name.md` stubs under `.spec_system/PRD/phase_00/`.
**Note**: This command does NOT create phase directories or session stubs. Run `/phasebuild` after creating the PRD.
## Technical Stack
- [Technology] - [why]
## Success Criteria
- [ ] [Criterion]
- [ ] [Criterion]
## Risks
- **[Risk]**: [mitigation]
## Assumptions
- [Assumption]
## Open Questions
1. [Question]
2. [Question]
Notes:
/phasebuild's job[PHASE_NAME] placeholder - default to "Foundation" if not specifiedAfter generating the PRD, customize .spec_system/CONVENTIONS.md to reflect the project's tech stack and domain.
This is initial customization, not maintenance. The /audit command handles ongoing maintenance with surgical edits; here we have more freedom to reshape the document.
From the PRD's Technical Stack section and the source requirements, identify:
Read .spec_system/CONVENTIONS.md (the generic template from /initspec).
Transformation principles:
Stack-specific transformations (examples):
| Stack | Transformations |
|---|---|
| TypeScript | Replace generic naming with TS conventions; add type safety rules; add interface vs type guidance |
| React | Add component patterns; hooks conventions; state management approach; JSX style |
| Next.js | Add App Router conventions; server/client component rules; API route patterns; file-based routing |
| Python | Replace with PEP 8; add type hint requirements; docstring format; import ordering |
| Go | Replace with Effective Go idioms; add error handling patterns; package naming; interface conventions |
| Rust | Add Clippy compliance; Result/Option patterns; ownership conventions; module organization |
| CLI | Add exit code standards; stdout vs stderr rules; flag naming; help text conventions |
| API | Add REST conventions; status code usage; error response format; versioning approach |
| Library | Add semantic versioning rules; public API stability; backwards compatibility; documentation requirements |
| Monorepo | Add workspace conventions; shared dependency rules; cross-package imports |
Section-specific transformations:
| Section | Generic -> Stack-Specific |
|---|---|
| Naming | Universal advice -> Language-specific casing (camelCase, snake_case, PascalCase, kebab-case) |
| Files & Structure | Generic -> Framework directory conventions (src/, app/, lib/, components/, routes/) |
| Functions & Modules | Universal -> Language idioms (async/await, error returns, generators, decorators) |
| Error Handling | Generic -> Stack patterns (try/catch, Result types, error boundaries, panic vs error) |
| Testing | Universal -> Framework patterns (describe/it, pytest fixtures, table-driven tests, mocking approach) |
| Dependencies | Generic -> Package manager commands, lockfile rules, version pinning strategy |
Add new sections if warranted:
After transformation, verify CONVENTIONS.md stays under 300 lines maximum.
wc -l .spec_system/CONVENTIONS.md
If over 300 lines:
Budget guidance: The generic template is ~85 lines. You have ~215 lines for stack-specific customization. A well-customized CONVENTIONS.md typically lands between 120-200 lines.
After edits:
wc -l .spec_system/CONVENTIONS.md
LC_ALL=C grep -n '[^[:print:][:space:]]' .spec_system/CONVENTIONS.md && echo "Non-ASCII found"
Skip this step entirely if:
.spec_system/CONVENTIONS.md does not exist--skip-conventionsBefore reporting completion:
.spec_system/PRD/PRD.mdRecommended checks:
file .spec_system/PRD/PRD.md
grep -n "$(printf '\r')" .spec_system/PRD/PRD.md && echo "CRLF found"
LC_ALL=C grep -n '[^[:print:][:space:]]' .spec_system/PRD/PRD.md && echo "Non-ASCII found"
If checks fail, fix the PRD content and re-check.
/phasebuild for the user - only generate the master PRDReport to user:
/createprd Complete!
Created:
- .spec_system/PRD/PRD.md (master PRD)
[If backup was made:]
- Backup: .spec_system/archive/PRD/PRD-backup-YYYYMMDD-HHMMSS.md
Summary:
- Goals: N defined
- MVP Requirements: N items
- Non-Goals: N items
- Open Questions: N items
[If conventions were customized:]
Conventions:
- .spec_system/CONVENTIONS.md customized for [stack] (N/300 lines)
- Stack: [detected languages/frameworks]
- Key additions: [brief list, max 3]
- Sections modified: [list affected sections]
Next Steps:
1. Review the generated PRD and refine as needed
2. Review CONVENTIONS.md and adjust for team preferences
3. Run /phasebuild to define Phase 00 sessions
4. Run /nextsession to begin implementation
If .spec_system/ is missing:
Cannot create PRD.
Reason: .spec_system/ not initialized
Please run /initspec first.
If the source document is incomplete:
Source document incomplete.
Missing critical information:
- [missing item 1]
- [missing item 2]
Please provide:
1. [question 1]
2. [question 2]
I can produce a draft PRD with an "Open Questions" section populated if you prefer.
If overwrite not confirmed:
PRD already exists at .spec_system/PRD/PRD.md
Options:
1. Confirm overwrite (backup will be created)
2. Create review copy at .spec_system/PRD/PRD-draft.md
3. Cancel
Please choose an option.