PRD Parsing Logic
Extracts machine-readable signals from the Factory standard PRD format.
Prerequisites
- A valid
knowledge/prd.mdfile following the Factory PRD template. - Target PRD must be in
READYstate.
Process
- Load PRD: Read
knowledge/prd.md. - Identify JSON Blocks: Locate all ```json blocks within the "Functional Requirements" section. These contain machine-executable acceptance criteria.
- Extract Metadata:
- Extract
project_namefrom H1. - Extract
descriptionfrom Executive Summary.
- Extract
- Extract AI Components: Parse Section 5 "AI Component Specifications" to identify model requirements and grounding strategies.
- Map to Config: Convert the extracted data into a
ProjectConfigschema.
Guidelines
- Regex Precision: Use robust regex to find the start and end of specific sections (Functional Requirements, NFRs, etc.).
- Validation: Ensure that every extracted JSON block is valid and follows the
story_id/acceptancestructure. - Error Handling: If a required section is missing, flag it as a warning but continue if possible.
Best Practices
- Schema Strictness: Validate extracted JSON blocks against
story_idandacceptancecriteria schemas. - Context Preservation: Ensure AI component specs include all necessary grounding and model parameters.
- Idempotency: Parsing the same PRD multiple times should yield identical
ProjectConfigobjects.
When to Use
- When a
knowledge/prd.mdexists and is marked as READY. - Before running the
automated-code-generationskill.