```xml
The workflow execution engine is governed by: {project_root}/bmad/core/tasks/workflow.xml
You MUST have already loaded and processed: {installed_path}/workflow.yaml
Communicate all responses in {communication_language}
This workflow generates a comprehensive Technical Specification from PRD and Architecture, including detailed design, NFRs, acceptance criteria, and traceability mapping.
If required inputs cannot be auto-discovered HALT with a clear message listing missing documents, allow user to provide them to proceed.
Identify PRD and Architecture documents from recommended_inputs. Attempt to auto-discover at default paths.
ask the user for file paths. HALT and wait for docs to proceed
MUST read COMPLETE sprint-status.yaml file to discover next epic
Load the FULL file: {{output_folder}}/sprint-status.yaml
Read ALL development_status entries
Find all epics with status "backlog" (not yet contexted)
Identify the FIRST backlog epic as the suggested default
Use this epic?
- [y] Yes, use {{suggested_epic_id}}
- [n] No, let me specify a different epic_id
Enter the epic_id you want to context
Store user-provided epic_id as {{epic_id}}
Use {{suggested_epic_id}} as {{epic_id}}
Do you want to re-context an existing epic? Enter epic_id or [q] to quit:
Store as {{epic_id}}
HALT - No work needed
Extract {{epic_title}} from PRD based on {{epic_id}}.
Resolve output file path using workflow variables and initialize by writing the template.
Look for epic key "epic-{{epic_id}}" in development_status (already loaded from step 1)
Get current status value if epic exists
HALT
Read COMPLETE found {recommended_inputs}.
Replace {{overview}} with a concise 1-2 paragraph summary referencing PRD context and goals
Replace {{objectives_scope}} with explicit in-scope and out-of-scope bullets
Replace {{system_arch_alignment}} with a short alignment summary to the architecture (components referenced, constraints)
Derive concrete implementation specifics from all {recommended_inputs} (CRITICAL: NO invention). If a epic tech spec precedes this one and exists, maintain consistency where appropriate.
Replace {{services_modules}} with a table or bullets listing services/modules with responsibilities, inputs/outputs, and owners
Replace {{data_models}} with normalized data model definitions (entities, fields, types, relationships); include schema snippets where available
Replace {{apis_interfaces}} with API endpoint specs or interface signatures (method, path, request/response models, error codes)
Replace {{workflows_sequencing}} with sequence notes or diagrams-as-text (steps, actors, data flow)
Replace {{nfr_performance}} with measurable targets (latency, throughput); link to any performance requirements in PRD/Architecture
Replace {{nfr_security}} with authn/z requirements, data handling, threat notes; cite source sections
Replace {{nfr_reliability}} with availability, recovery, and degradation behavior
Replace {{nfr_observability}} with logging, metrics, tracing requirements; name required signals
Scan repository for dependency manifests (e.g., package.json, pyproject.toml, go.mod, Unity Packages/manifest.json).
Replace {{dependencies_integrations}} with a structured list of dependencies and integration points with version or commit constraints when known
Extract acceptance criteria from PRD; normalize into atomic, testable statements.
Replace {{acceptance_criteria}} with a numbered list of testable acceptance criteria
Replace {{traceability_mapping}} with a table mapping: AC â Spec Section(s) â Component(s)/API(s) â Test Idea
Replace {{risks_assumptions_questions}} with explicit list (each item labeled as Risk/Assumption/Question) with mitigation or next step
Replace {{test_strategy}} with a brief plan (test levels, frameworks, coverage of ACs, edge cases)
Validate against checklist at {installed_path}/checklist.md using bmad/core/tasks/validate-workflow.xml
Load the FULL file: {{output_folder}}/sprint-status.yaml
Find development_status key "epic-{{epic_id}}"
Verify current status is "backlog" (expected previous state)
Update development_status["epic-{{epic_id}}"] = "contexted"
Save file, preserving ALL comments and structure including STATUS DEFINITIONS
```