Summary
Add support for PRD templates that allow users to customize the structure and format of generated PRDs. Currently, cf prd generate produces a fixed markdown format. This enhancement would allow projects to define their own PRD structure, sections, and formatting requirements.
Motivation
Different organizations and projects have varying PRD formats:
- Enterprise teams may require specific compliance sections
- Startups might prefer lean canvas-style PRDs
- Regulated industries need detailed requirements traceability
- Some teams prefer user story maps vs. feature lists
A template system would make CodeFRAME's PRD generation adaptable to these diverse needs while maintaining the Socratic discovery process.
Proposed Design
Template Definition Language
Templates would be defined in a YAML or Markdown-based DSL:
# .codeframe/prd-template.yaml
name: "Enterprise PRD Template"
version: 1
sections:
- id: executive_summary
title: "Executive Summary"
required: true
source: problem # Maps to discovery category
format: |
## Executive Summary
### Problem Statement
{{ answers.problem_1 }}
### Business Justification
{{ answers.problem_2 | default: "Not specified" }}
- id: stakeholders
title: "Stakeholders & Users"
required: true
source: users
format: |
## Stakeholders
### Primary Users
{{ extracted.users | bullet_list }}
### User Personas
{% for user in extracted.users %}
- **{{ user }}**: {{ generate_persona(user) }}
{% endfor %}
- id: requirements
title: "Functional Requirements"
required: true
source: features
format: |
## Functional Requirements
| ID | Requirement | Priority | Source |
|----|-------------|----------|--------|
{% for feature in extracted.features %}
| FR-{{ loop.index }} | {{ feature }} | P1 | Discovery |
{% endfor %}
- id: constraints
title: "Technical Constraints"
required: false
source: constraints
- id: acceptance
title: "Acceptance Criteria"
required: true
auto_generate: true # AI generates from features
Template Variables
Available variables in templates:
| Variable |
Description |
answers.<question_id> |
Raw answer text for a specific question |
answers_by_category.<category> |
All answers in a category |
extracted.features |
Features extracted by AnswerCapture |
extracted.users |
User types extracted |
extracted.constraints |
Constraints dict |
metadata.project_name |
From workspace config |
metadata.generated_at |
Timestamp |
metadata.session_id |
Discovery session ID |
Template Functions
| Function |
Description |
bullet_list(items) |
Convert list to markdown bullets |
numbered_list(items) |
Convert list to numbered list |
table(items, columns) |
Generate markdown table |
generate_persona(user) |
AI-generate user persona |
generate_acceptance(feature) |
AI-generate acceptance criteria |
summarize(text, max_words) |
Summarize long text |
CLI Integration
# Use project template
cf prd generate
# Use specific template
cf prd generate --template enterprise
# List available templates
cf prd templates list
# Import template from URL/file
cf prd templates import https://example.com/template.yaml
cf prd templates import ./my-template.yaml
# Export current format as template
cf prd templates export > my-template.yaml
Built-in Templates
Ship with several default templates:
- standard (current default) - Balanced PRD for general use
- lean - Minimal viable PRD (problem, users, MVP features)
- enterprise - Full formal PRD with traceability
- user-story-map - Organized around user journeys
- technical-spec - Focused on technical requirements
Storage
- Global templates:
~/.codeframe/templates/
- Project templates:
.codeframe/templates/
- Template registry: Optional remote template sharing
Implementation Considerations
Discovery Question Mapping
Templates may require additional discovery questions beyond the current 5 required + 5 optional. The template system should:
- Define required discovery categories
- Allow custom questions per template
- Map questions to template sections
Backward Compatibility
- Default template matches current output format
- Existing PRDs remain valid
- Template field optional on PRD records
Validation
- Validate template syntax on import
- Ensure all required sections have data sources
- Warn about unmapped discovery answers
Tasks
Related
Labels
enhancement, phase-1, prd
Summary
Add support for PRD templates that allow users to customize the structure and format of generated PRDs. Currently,
cf prd generateproduces a fixed markdown format. This enhancement would allow projects to define their own PRD structure, sections, and formatting requirements.Motivation
Different organizations and projects have varying PRD formats:
A template system would make CodeFRAME's PRD generation adaptable to these diverse needs while maintaining the Socratic discovery process.
Proposed Design
Template Definition Language
Templates would be defined in a YAML or Markdown-based DSL:
Template Variables
Available variables in templates:
answers.<question_id>answers_by_category.<category>extracted.featuresextracted.usersextracted.constraintsmetadata.project_namemetadata.generated_atmetadata.session_idTemplate Functions
bullet_list(items)numbered_list(items)table(items, columns)generate_persona(user)generate_acceptance(feature)summarize(text, max_words)CLI Integration
Built-in Templates
Ship with several default templates:
Storage
~/.codeframe/templates/.codeframe/templates/Implementation Considerations
Discovery Question Mapping
Templates may require additional discovery questions beyond the current 5 required + 5 optional. The template system should:
Backward Compatibility
Validation
Tasks
_build_prd_content()to use templatescf prd templatessubcommandsRelated
Labels
enhancement,phase-1,prd