PlanOpticon

1
"""Skill: Generate a product requirements document (PRD) / feature spec."""
2
3
from video_processor.agent.skills.base import (
4
AgentContext,
5
Artifact,
6
Skill,
7
register_skill,
8
)
9
10
11
class PRDSkill(Skill):
12
name = "prd"
13
description = "Generate a product requirements document (PRD) / feature spec"
14
15
def execute(self, context: AgentContext, **kwargs) -> Artifact:
16
stats = context.query_engine.stats()
17
entities = context.query_engine.entities()
18
relationships = context.query_engine.relationships()
19
20
relevant_types = {"requirement", "feature", "constraint"}
21
filtered = [
22
e for e in context.planning_entities if getattr(e, "type", "").lower() in relevant_types
23
]
24
25
parts = [
26
"You are a product manager. Using the following knowledge "
27
"graph context, generate a product requirements document.",
28
"",
29
"## Knowledge Graph Overview",
30
stats.to_text(),
31
"",
32
"## Entities",
33
entities.to_text(),
34
"",
35
"## Relationships",
36
relationships.to_text(),
37
"",
38
"## Relevant Planning Entities",
39
]
40
for e in filtered:
41
parts.append(f"- [{getattr(e, 'type', 'unknown')}] {e}")
42
43
if not filtered:
44
parts.append(
45
"(No pre-filtered entities; derive requirements from the full context above.)"
46
)
47
48
parts.append(
49
"\nGenerate a PRD with:\n"
50
"1. Problem Statement\n"
51
"2. User Stories\n"
52
"3. Functional Requirements\n"
53
"4. Non-Functional Requirements\n"
54
"5. Acceptance Criteria\n"
55
"6. Out of Scope\n\n"
56
"Return ONLY the markdown."
57
)
58
59
prompt = "\n".join(parts)
60
response = context.provider_manager.chat(messages=[{"role": "user", "content": prompt}])
61
62
return Artifact(
63
name="Product Requirements Document",
64
content=response,
65
artifact_type="prd",
66
format="markdown",
67
)
68
69
70
register_skill(PRDSkill())
71

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button