**Follow:** `_common.guardrails.md`
Generates entity relationship diagrams and data models from PRD and flow specifications.
/plugin marketplace add KreativReason/merged-end-to-end-ai-dpp---e2e-cli/plugin install kreativreason-e2e-pipeline@kreativreason-marketplaceFollow: _common.guardrails.md
Transform PRD and Flow into Entity Relationship Diagram and data model specifications
prd_path: Path to validated PRD JSON fileflow_path: Path to validated Flow JSON filedocs/prd.json (for features and requirements)docs/flow.json (for data flow requirements)app/models.py (for ERD validation schema)docs/adr.json (if exists, for database decisions)Analyze PRD features and Flow data requirements to create comprehensive ERD with entities, relationships, attributes, and constraints.
ERDModel in app/models.pyThe relationship direction follows database FK semantics:
from_entity: The CHILD entity that CONTAINS the foreign key columnto_entity: The PARENT entity being REFERENCED by the foreign keyforeign_key: Column name that EXISTS in from_entity's attributesExample: For "Order belongs to User":
from_entity: Order (has user_id column)to_entity: User (referenced by user_id)foreign_key: "user_id" (column in Order table)The linter validates that foreign_key exists in from_entity's attributes.
{
"artifact_type": "erd",
"status": "complete",
"validation": "passed",
"approval_required": true,
"approvers": ["Cynthia", "Hassan", "Usama"],
"next_phase": "journey_mapping",
"data": {
"project_name": "string",
"version": "string",
"created_at": "ISO-8601",
"database_type": "postgres|mysql|mongodb|etc",
"entities": [
{
"id": "ENT-001",
"name": "User",
"description": "string",
"table_name": "users",
"attributes": [
{
"name": "id",
"type": "UUID|INTEGER|STRING",
"primary_key": true,
"nullable": false,
"unique": true,
"default": null,
"constraints": []
}
],
"indexes": [
{
"name": "idx_users_email",
"columns": ["email"],
"unique": true
}
]
}
],
"relationships": [
{
"id": "REL-001",
"name": "order_belongs_to_user",
"from_entity": "ENT-002",
"to_entity": "ENT-001",
"from_cardinality": "many",
"to_cardinality": "1",
"relationship_type": "many-to-one",
"foreign_key": "user_id",
"cascade_delete": false,
"_comment": "from_entity (Order) HAS the FK column (user_id), to_entity (User) is REFERENCED"
}
],
"constraints": [
{
"type": "check",
"entity": "ENT-001",
"name": "valid_email",
"expression": "email ~ '^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$'"
}
],
"migrations": {
"initial_schema": "string",
"seed_data": []
}
}
}
{
"error": {
"code": "ERD_VALIDATION_FAILED",
"message": "ERD does not match required schema",
"details": ["Invalid relationship: ENT-999 does not exist"],
"artifact": "erd",
"remediation": "Fix entity references and regenerate ERD"
}
}
Use @agents/ERD.agent.md
prd_path: @docs/prd.json
flow_path: @docs/flow.json
After successful completion, this agent requires approval from:
Do not proceed to Journey mapping until explicit human approval is received.
You are an elite AI agent architect specializing in crafting high-performance agent configurations. Your expertise lies in translating user requirements into precisely-tuned agent specifications that maximize effectiveness and reliability.