API Reference¶
Complete API reference for structured-requirements packages.
Package Overview¶
github.com/grokify/structured-plan/
├── prd/ # Product Requirements Document
├── mrd/ # Market Requirements Document
├── trd/ # Technical Requirements Document
PRD Package¶
Document Operations¶
New¶
Creates a new PRD with required fields initialized.
GenerateID¶
Generates a PRD ID based on current date: PRD-YYYY-DDD.
GenerateIDWithPrefix¶
Generates an ID with custom prefix: PREFIX-YYYY-DDD.
Load¶
Reads a PRD from a JSON file.
Save¶
Writes a PRD to a JSON file.
Validation¶
Validate¶
Checks PRD for structural and content issues.
Scoring¶
Score¶
Evaluates PRD quality and returns scoring results.
DefaultWeights¶
Returns standard category weights for scoring.
Views¶
GeneratePMView¶
Creates a PM-friendly view of the PRD.
RenderPMMarkdown¶
Generates markdown output for PM view.
GenerateExecView¶
Creates an executive-friendly view.
RenderExecMarkdown¶
Generates markdown output for exec view.
GenerateSixPagerView¶
Creates Amazon-style 6-pager view.
RenderSixPagerMarkdown¶
Generates markdown output for 6-pager.
GeneratePRFAQView¶
Creates PR/FAQ view (subset of 6-pager).
RenderPRFAQMarkdown¶
Generates markdown output for PR/FAQ.
Slide Renderers¶
NewPRDRenderer¶
Creates a new PRD Marp slide renderer.
NewPRDGoalsRenderer¶
Creates a new PRD+Goals Marp slide renderer with expanded V2MOM and OKR sections.
Renderer Interface¶
type Renderer interface {
Format() string
FileExtension() string
Render(doc *prd.Document, opts *render.Options) ([]byte, error)
}
Render Options¶
type Options struct {
Theme string // "default", "corporate", "minimal"
IncludeGoals bool // Include goals alignment section
IncludeRoadmap bool // Include roadmap slide
IncludeRisks bool // Include risks slide
IncludeRequirements bool // Include requirements slide
MaxPersonas int // Limit personas shown (0 = all)
MaxRequirements int // Limit requirements shown (0 = all)
CustomCSS string // Custom CSS for Marp
Metadata map[string]string // Additional metadata
}
DefaultOptions¶
Returns sensible default rendering options.
ExecutiveOptions¶
Returns options for executive-focused slides (fewer details).
Persona Library¶
NewPersonaLibrary¶
Creates a new empty persona library.
LoadPersonaLibrary¶
Reads a persona library from JSON file.
PersonaLibrary Methods¶
func (lib *PersonaLibrary) Add(persona LibraryPersona) error
func (lib *PersonaLibrary) Get(id string) (*LibraryPersona, bool)
func (lib *PersonaLibrary) GetByName(name string) (*LibraryPersona, bool)
func (lib *PersonaLibrary) List() []LibraryPersona
func (lib *PersonaLibrary) ListByTag(tag string) []LibraryPersona
func (lib *PersonaLibrary) Update(persona LibraryPersona) error
func (lib *PersonaLibrary) Remove(id string) error
func (lib *PersonaLibrary) Save(path string) error
func (lib *PersonaLibrary) ImportTo(doc *Document, ids ...string) error
func (lib *PersonaLibrary) ExportFrom(doc *Document, id string) error
func (lib *PersonaLibrary) ExportAllFrom(doc *Document) error
func (lib *PersonaLibrary) SyncFromLibrary(doc *Document) error
Core Types¶
Document¶
type Document struct {
Metadata Metadata
ExecutiveSummary ExecutiveSummary
Objectives Objectives
Personas []Persona
UserStories []UserStory
Requirements Requirements
Roadmap Roadmap
Assumptions *AssumptionsConstraints
OutOfScope []string
TechArchitecture *TechnicalArchitecture
UXRequirements *UXRequirements
Risks []Risk
Glossary []GlossaryTerm
CustomSections []CustomSection
Problem *ProblemDefinition
Market *MarketDefinition
Solution *SolutionDefinition
Decisions *DecisionsDefinition
Reviews *ReviewsDefinition
RevisionHistory []RevisionRecord
Goals *GoalsAlignment
}
Metadata¶
type Metadata struct {
ID string
Title string
Version string
Status Status
CreatedAt time.Time
UpdatedAt time.Time
Authors []Person
Reviewers []Person
Approvers []Approver
Tags []string
}
Person¶
Persona¶
type Persona struct {
ID string
Name string
Role string
IsPrimary bool
Description string
Goals []string
PainPoints []string
TechnicalProficiency TechnicalProficiency
Demographics *Demographics
}
Requirements¶
type Requirements struct {
Functional []FunctionalRequirement
NonFunctional []NonFunctionalRequirement
}
type FunctionalRequirement struct {
ID string
Title string
Description string
Priority Priority
MoSCoW MoSCoW
AcceptanceCriteria []string
PersonaIDs []string
}
type NonFunctionalRequirement struct {
ID string
Category NFRCategory
Description string
Target string
Priority Priority
}
GoalsAlignment¶
type GoalsAlignment struct {
V2MOMRef *GoalReference
V2MOM *v2mom.V2MOM
OKRRef *GoalReference
OKR *okr.OKRDocument
AlignedObjectives map[string]string
}
type GoalReference struct {
ID string
Path string
URL string
Version string
}
Constants¶
Status¶
const (
StatusDraft Status = "draft"
StatusInReview Status = "in_review"
StatusApproved Status = "approved"
StatusDeprecated Status = "deprecated"
)
Priority¶
const (
PriorityCritical Priority = "critical"
PriorityHigh Priority = "high"
PriorityMedium Priority = "medium"
PriorityLow Priority = "low"
)
MoSCoW¶
const (
MoSCoWMust MoSCoW = "must"
MoSCoWShould MoSCoW = "should"
MoSCoWCould MoSCoW = "could"
MoSCoWWont MoSCoW = "wont"
)
NFR Categories¶
const (
NFRPerformance NFRCategory = "performance"
NFRScalability NFRCategory = "scalability"
NFRReliability NFRCategory = "reliability"
NFRAvailability NFRCategory = "availability"
NFRSecurity NFRCategory = "security"
NFRMultiTenancy NFRCategory = "multi_tenancy"
NFRObservability NFRCategory = "observability"
NFRMaintainability NFRCategory = "maintainability"
NFRUsability NFRCategory = "usability"
NFRCompatibility NFRCategory = "compatibility"
NFRCompliance NFRCategory = "compliance"
)
Review Decisions¶
const (
ReviewApprove ReviewDecision = "approve"
ReviewRevise ReviewDecision = "revise"
ReviewReject ReviewDecision = "reject"
ReviewHumanReview ReviewDecision = "human_review"
)
MRD Package¶
See MRD Documentation for types and functions.
TRD Package¶
See TRD Documentation for types and functions.
Structured Goals Package¶
See Goals Integration for V2MOM and OKR types.
Error Handling¶
All functions that can fail return an error:
doc, err := prd.Load("file.prd.json")
if err != nil {
log.Fatalf("Failed to load PRD: %v", err)
}
if err := prd.Save(doc, "output.prd.json"); err != nil {
log.Fatalf("Failed to save PRD: %v", err)
}