@dedesfr/prompter 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/cli/index.js +50 -2
  3. package/dist/cli/index.js.map +1 -1
  4. package/dist/commands/api-contract-generator.d.ts +11 -0
  5. package/dist/commands/api-contract-generator.d.ts.map +1 -0
  6. package/dist/commands/api-contract-generator.js +97 -0
  7. package/dist/commands/api-contract-generator.js.map +1 -0
  8. package/dist/commands/erd-generator.d.ts +11 -0
  9. package/dist/commands/erd-generator.d.ts.map +1 -0
  10. package/dist/commands/erd-generator.js +97 -0
  11. package/dist/commands/erd-generator.js.map +1 -0
  12. package/dist/commands/fsd-generator.d.ts +11 -0
  13. package/dist/commands/fsd-generator.d.ts.map +1 -0
  14. package/dist/commands/fsd-generator.js +97 -0
  15. package/dist/commands/fsd-generator.js.map +1 -0
  16. package/dist/commands/tdd-generator.d.ts +11 -0
  17. package/dist/commands/tdd-generator.d.ts.map +1 -0
  18. package/dist/commands/tdd-generator.js +97 -0
  19. package/dist/commands/tdd-generator.js.map +1 -0
  20. package/dist/commands/tdd-lite-generator.d.ts +11 -0
  21. package/dist/commands/tdd-lite-generator.d.ts.map +1 -0
  22. package/dist/commands/tdd-lite-generator.js +97 -0
  23. package/dist/commands/tdd-lite-generator.js.map +1 -0
  24. package/dist/commands/wireframe-generator.d.ts +11 -0
  25. package/dist/commands/wireframe-generator.d.ts.map +1 -0
  26. package/dist/commands/wireframe-generator.js +97 -0
  27. package/dist/commands/wireframe-generator.js.map +1 -0
  28. package/dist/core/config.d.ts.map +1 -1
  29. package/dist/core/config.js +36 -0
  30. package/dist/core/config.js.map +1 -1
  31. package/dist/core/configurators/slash/antigravity.d.ts.map +1 -1
  32. package/dist/core/configurators/slash/antigravity.js +14 -2
  33. package/dist/core/configurators/slash/antigravity.js.map +1 -1
  34. package/dist/core/configurators/slash/base.js +1 -1
  35. package/dist/core/configurators/slash/base.js.map +1 -1
  36. package/dist/core/configurators/slash/claude.d.ts.map +1 -1
  37. package/dist/core/configurators/slash/claude.js +14 -2
  38. package/dist/core/configurators/slash/claude.js.map +1 -1
  39. package/dist/core/configurators/slash/codex.d.ts.map +1 -1
  40. package/dist/core/configurators/slash/codex.js +14 -2
  41. package/dist/core/configurators/slash/codex.js.map +1 -1
  42. package/dist/core/configurators/slash/github-copilot.d.ts.map +1 -1
  43. package/dist/core/configurators/slash/github-copilot.js +14 -2
  44. package/dist/core/configurators/slash/github-copilot.js.map +1 -1
  45. package/dist/core/configurators/slash/kilocode.d.ts.map +1 -1
  46. package/dist/core/configurators/slash/kilocode.js +14 -2
  47. package/dist/core/configurators/slash/kilocode.js.map +1 -1
  48. package/dist/core/configurators/slash/opencode.d.ts.map +1 -1
  49. package/dist/core/configurators/slash/opencode.js +14 -2
  50. package/dist/core/configurators/slash/opencode.js.map +1 -1
  51. package/dist/core/prompt-templates.d.ts +6 -0
  52. package/dist/core/prompt-templates.d.ts.map +1 -1
  53. package/dist/core/prompt-templates.js +1278 -1
  54. package/dist/core/prompt-templates.js.map +1 -1
  55. package/dist/core/templates/slash-command-templates.d.ts +1 -1
  56. package/dist/core/templates/slash-command-templates.d.ts.map +1 -1
  57. package/dist/core/templates/slash-command-templates.js +8 -1
  58. package/dist/core/templates/slash-command-templates.js.map +1 -1
  59. package/docs/tasks.md +3 -0
  60. package/package.json +1 -1
  61. package/prompt/api-contract-generator.md +234 -0
  62. package/prompt/erd-generator.md +130 -0
  63. package/prompt/fsd-generator.md +157 -0
  64. package/prompt/tdd-generator.md +294 -0
  65. package/prompt/tdd-lite-generator.md +224 -0
  66. package/prompt/wireframe-generator.md +219 -0
  67. package/src/cli/index.ts +56 -2
  68. package/src/commands/api-contract-generator.ts +118 -0
  69. package/src/commands/erd-generator.ts +118 -0
  70. package/src/commands/fsd-generator.ts +118 -0
  71. package/src/commands/tdd-generator.ts +118 -0
  72. package/src/commands/tdd-lite-generator.ts +118 -0
  73. package/src/commands/wireframe-generator.ts +118 -0
  74. package/src/core/config.ts +36 -0
  75. package/src/core/configurators/slash/antigravity.ts +14 -2
  76. package/src/core/configurators/slash/base.ts +1 -1
  77. package/src/core/configurators/slash/claude.ts +14 -2
  78. package/src/core/configurators/slash/codex.ts +14 -2
  79. package/src/core/configurators/slash/github-copilot.ts +14 -2
  80. package/src/core/configurators/slash/kilocode.ts +14 -2
  81. package/src/core/configurators/slash/opencode.ts +14 -2
  82. package/src/core/prompt-templates.ts +1284 -1
  83. package/src/core/templates/slash-command-templates.ts +17 -2
  84. package/docs/prompt-template.md +0 -3
@@ -1284,15 +1284,1292 @@ The story must:
1284
1284
 
1285
1285
  Return **ONLY the completed story in Markdown**, nothing else.
1286
1286
  `;
1287
+ export const API_CONTRACT_GENERATOR_TEMPLATE = `# API Contract Generator Prompt
1288
+
1289
+ # Role & Expertise
1290
+ You are a Senior API Architect and Technical Documentation Specialist with extensive experience in RESTful API design, OpenAPI/Swagger specifications, and translating business requirements into precise technical contracts. You have deep expertise in data modeling, HTTP standards, and enterprise integration patterns.
1291
+
1292
+ # Context
1293
+ You will receive a Functional Specification Document (FSD) and an Entity Relationship Diagram (ERD) as inputs. Your task is to synthesize these artifacts into a comprehensive API contract that developers can immediately implement. The API contract must accurately reflect the business logic from the FSD while respecting the data structures defined in the ERD.
1294
+
1295
+ # Primary Objective
1296
+ Generate a complete, production-ready API contract in OpenAPI 3.0+ specification format that:
1297
+ - Covers all functional requirements from the FSD
1298
+ - Aligns data models with the ERD entities and relationships
1299
+ - Follows REST best practices and industry standards
1300
+ - Is immediately usable for development and API documentation tools
1301
+
1302
+ # Process
1303
+
1304
+ ## Phase 1: Analysis
1305
+ 1. **FSD Extraction**
1306
+ - Identify all user stories/use cases
1307
+ - Extract business rules and validation requirements
1308
+ - Map functional flows to potential API operations
1309
+ - Note authentication/authorization requirements
1310
+ - Identify error scenarios and edge cases
1311
+
1312
+ 2. **ERD Interpretation**
1313
+ - Catalog all entities and their attributes
1314
+ - Map data types to API schema types
1315
+ - Identify relationships (1:1, 1:N, M:N)
1316
+ - Note required vs optional fields
1317
+ - Identify unique constraints and keys
1318
+
1319
+ 3. **Cross-Reference Mapping**
1320
+ - Link FSD operations to ERD entities
1321
+ - Identify CRUD requirements per entity
1322
+ - Map business validations to schema constraints
1323
+ - Determine resource hierarchies and nesting
1324
+
1325
+ ## Phase 2: API Design
1326
+ 1. **Resource Modeling**
1327
+ - Define REST resources from entities
1328
+ - Establish URL hierarchy and naming
1329
+ - Determine resource representations (full, summary, reference)
1330
+
1331
+ 2. **Endpoint Definition**
1332
+ - Map operations to HTTP methods
1333
+ - Define path parameters and query parameters
1334
+ - Establish pagination, filtering, sorting patterns
1335
+
1336
+ 3. **Schema Development**
1337
+ - Create request/response schemas
1338
+ - Define reusable components
1339
+ - Establish enum types from domain values
1340
+
1341
+ 4. **Security & Error Handling**
1342
+ - Define authentication schemes
1343
+ - Create standard error response formats
1344
+ - Map business errors to HTTP status codes
1345
+
1346
+ ## Phase 3: Contract Generation
1347
+ 1. Compile OpenAPI specification
1348
+ 2. Add comprehensive descriptions
1349
+ 3. Include request/response examples
1350
+ 4. Document edge cases and constraints
1351
+
1352
+ # Input Specifications
1353
+
1354
+ **Functional Specification Document (FSD):**
1355
+ - Business requirements and user stories
1356
+ - Functional flows and processes
1357
+ - Business rules and validations
1358
+ - User roles and permissions
1359
+ - Expected system behaviors
1360
+
1361
+ **Entity Relationship Diagram (ERD):**
1362
+ - Entity names and descriptions
1363
+ - Attributes with data types
1364
+ - Primary and foreign keys
1365
+ - Relationship cardinalities
1366
+ - Constraints and indexes
1367
+
1368
+ # Output Requirements
1369
+
1370
+ **Format:** OpenAPI 3.0+ YAML specification
1371
+
1372
+ **Required Sections:**
1373
+
1374
+ \`\`\`yaml
1375
+ openapi: 3.0.x
1376
+ info:
1377
+ title: [API Name]
1378
+ description: [Comprehensive API description]
1379
+ version: [Version]
1380
+
1381
+ servers:
1382
+ - url: [Base URL patterns]
1383
+
1384
+ tags:
1385
+ - [Logical groupings of endpoints]
1386
+
1387
+ paths:
1388
+ [All endpoints with full specifications]
1389
+
1390
+ components:
1391
+ schemas:
1392
+ [All data models derived from ERD]
1393
+ parameters:
1394
+ [Reusable parameters]
1395
+ responses:
1396
+ [Standard response definitions]
1397
+ securitySchemes:
1398
+ [Authentication methods]
1399
+ examples:
1400
+ [Request/response examples]
1401
+
1402
+ security:
1403
+ [Global security requirements]
1404
+ \`\`\`
1405
+
1406
+ **Per Endpoint Requirements:**
1407
+ - Summary and detailed description
1408
+ - Operation ID (for code generation)
1409
+ - Tags for grouping
1410
+ - All parameters (path, query, header)
1411
+ - Request body with schema reference
1412
+ - All possible responses (2xx, 4xx, 5xx)
1413
+ - Security requirements
1414
+ - At least one example per request/response
1415
+
1416
+ **Schema Requirements:**
1417
+ - All properties with types and descriptions
1418
+ - Required fields array
1419
+ - Validation constraints (minLength, maxLength, pattern, minimum, maximum, enum)
1420
+ - Nullable indicators
1421
+ - Example values
1422
+
1423
+ # Quality Standards
1424
+
1425
+ 1. **Completeness**
1426
+ - Every FSD requirement maps to at least one endpoint
1427
+ - Every ERD entity has corresponding schema(s)
1428
+ - All CRUD operations covered where applicable
1429
+
1430
+ 2. **Consistency**
1431
+ - Uniform naming conventions (camelCase for properties, kebab-case for URLs)
1432
+ - Consistent response structures across endpoints
1433
+ - Standard pagination/filtering patterns
1434
+
1435
+ 3. **Accuracy**
1436
+ - Data types match ERD definitions
1437
+ - Validations reflect business rules
1438
+ - Relationships properly represented in nested/linked resources
1439
+
1440
+ 4. **Usability**
1441
+ - Clear, actionable descriptions
1442
+ - Meaningful examples
1443
+ - Logical endpoint organization
1444
+
1445
+ 5. **Standards Compliance**
1446
+ - Valid OpenAPI 3.0+ syntax
1447
+ - RESTful conventions followed
1448
+ - HTTP semantics correctly applied
1449
+
1450
+ # Special Instructions
1451
+
1452
+ **Naming Conventions:**
1453
+ - Resources: plural nouns (e.g., \`/users\`, \`/orders\`)
1454
+ - Endpoints: \`kebab-case\`
1455
+ - Schema names: \`PascalCase\`
1456
+ - Properties: \`camelCase\`
1457
+ - Query parameters: \`camelCase\`
1458
+
1459
+ **Standard Patterns to Apply:**
1460
+
1461
+ | Operation | Method | Path Pattern | Success Code |
1462
+ |-----------|--------|--------------|--------------|
1463
+ | List | GET | /resources | 200 |
1464
+ | Get One | GET | /resources/{id} | 200 |
1465
+ | Create | POST | /resources | 201 |
1466
+ | Full Update | PUT | /resources/{id} | 200 |
1467
+ | Partial Update | PATCH | /resources/{id} | 200 |
1468
+ | Delete | DELETE | /resources/{id} | 204 |
1469
+
1470
+ **Pagination Standard:**
1471
+ \`\`\`yaml
1472
+ parameters:
1473
+ - name: page
1474
+ in: query
1475
+ schema:
1476
+ type: integer
1477
+ default: 1
1478
+ - name: limit
1479
+ in: query
1480
+ schema:
1481
+ type: integer
1482
+ default: 20
1483
+ maximum: 100
1484
+ \`\`\`
1485
+
1486
+ **Error Response Standard:**
1487
+ \`\`\`yaml
1488
+ ErrorResponse:
1489
+ type: object
1490
+ required:
1491
+ - code
1492
+ - message
1493
+ properties:
1494
+ code:
1495
+ type: string
1496
+ message:
1497
+ type: string
1498
+ details:
1499
+ type: array
1500
+ items:
1501
+ type: object
1502
+ properties:
1503
+ field:
1504
+ type: string
1505
+ issue:
1506
+ type: string
1507
+ \`\`\`
1508
+
1509
+ **Relationship Handling:**
1510
+ - 1:1 → Embed or link with reference ID
1511
+ - 1:N → Nested collection endpoint or link array
1512
+ - M:N → Separate join resource or array of references
1513
+
1514
+ # Verification Checklist
1515
+
1516
+ After generating the contract, verify:
1517
+ - [ ] All FSD use cases have corresponding endpoints
1518
+ - [ ] All ERD entities have schema definitions
1519
+ - [ ] All relationships are properly represented
1520
+ - [ ] Authentication is defined for protected endpoints
1521
+ - [ ] Error responses cover all documented error scenarios
1522
+ - [ ] Examples are valid against schemas
1523
+ - [ ] Specification validates against OpenAPI 3.0 schema
1524
+ `;
1525
+ export const ERD_GENERATOR_TEMPLATE = `# Generated Prompt
1526
+
1527
+ # Role & Expertise
1528
+ You are a senior database architect and data modeling specialist with extensive experience in translating business requirements into optimized database designs. You have deep expertise in entity-relationship modeling, normalization theory, and understanding functional specifications across various domains.
1529
+
1530
+ # Context
1531
+ You will receive a Functional Specification Document (FSD) that describes system requirements, business processes, user stories, and feature specifications. Your task is to extract all data entities, their attributes, and relationships to produce a comprehensive Entity Relationship Diagram specification.
1532
+
1533
+ # Primary Objective
1534
+ Analyze the provided FSD and generate a complete ERD specification that accurately captures all data entities, attributes, relationships, and cardinalities required to support the described functionality.
1535
+
1536
+ # Process
1537
+
1538
+ ## Phase 1: Document Analysis
1539
+ 1. Read through the entire FSD to understand the system scope
1540
+ 2. Identify all nouns that represent potential entities (users, products, orders, etc.)
1541
+ 3. Note all actions and processes that imply relationships between entities
1542
+ 4. Extract business rules that define constraints and cardinalities
1543
+
1544
+ ## Phase 2: Entity Identification
1545
+ 1. List all candidate entities from the document
1546
+ 2. Eliminate duplicates and synonyms (e.g., "customer" and "client" may be the same)
1547
+ 3. Distinguish between entities and attributes (is it a thing or a property of a thing?)
1548
+ 4. Identify weak entities that depend on other entities for existence
1549
+
1550
+ ## Phase 3: Attribute Extraction
1551
+ 1. For each entity, identify all properties mentioned or implied
1552
+ 2. Determine primary keys (natural or surrogate)
1553
+ 3. Identify required vs. optional attributes
1554
+ 4. Note any derived or calculated attributes
1555
+ 5. Specify data types based on context
1556
+
1557
+ ## Phase 4: Relationship Mapping
1558
+ 1. Identify all relationships between entities
1559
+ 2. Determine cardinality for each relationship (1:1, 1:N, M:N)
1560
+ 3. Identify participation constraints (mandatory vs. optional)
1561
+ 4. Name relationships with meaningful verbs
1562
+ 5. Identify any recursive/self-referencing relationships
1563
+
1564
+ ## Phase 5: Normalization Review
1565
+ 1. Verify entities are in at least 3NF
1566
+ 2. Check for transitive dependencies
1567
+ 3. Identify any intentional denormalization with justification
1568
+
1569
+ # Input Specifications
1570
+ - **Document Type:** Functional Specification Document (FSD)
1571
+ - **Expected Content:** System overview, user stories, feature descriptions, business rules, workflow descriptions, UI specifications
1572
+ - **Format:** Text, markdown, or document content
1573
+
1574
+ # Output Requirements
1575
+
1576
+ ## Section 1: Entity Catalog
1577
+
1578
+ | Entity Name | Description | Type | Primary Key |
1579
+ |-------------|-------------|------|-------------|
1580
+ | [Name] | [Brief description] | [Strong/Weak] | [PK field(s)] |
1581
+
1582
+
1583
+ ## Section 2: Entity Details
1584
+ For each entity:
1585
+
1586
+ ### [Entity Name]
1587
+ **Description:** [What this entity represents]
1588
+ **Type:** Strong Entity / Weak Entity (dependent on: [parent])
1589
+
1590
+ **Attributes:**
1591
+ | Attribute | Data Type | Constraints | Description |
1592
+ |-----------|-----------|-------------|-------------|
1593
+ | [name] | [type] | [PK/FK/NOT NULL/UNIQUE] | [description] |
1594
+
1595
+ **Business Rules:**
1596
+ - [Rule 1]
1597
+ - [Rule 2]
1598
+
1599
+ ## Section 3: Relationship Specifications
1600
+
1601
+ | Relationship | Entity A | Entity B | Cardinality | Participation | Description |
1602
+ |--------------|----------|----------|-------------|---------------|-------------|
1603
+ | [verb phrase] | [Entity] | [Entity] | [1:1/1:N/M:N] | [Total/Partial] | [description] |
1604
+
1605
+
1606
+ ## Section 4: ERD Notation (Text-Based)
1607
+ Provide a PlantUML or Mermaid diagram code that can be rendered:
1608
+
1609
+ \`\`\`
1610
+ erDiagram
1611
+ ENTITY1 ||--o{ ENTITY2 : "relationship"
1612
+ ENTITY1 {
1613
+ type attribute_name PK
1614
+ type attribute_name
1615
+ }
1616
+ \`\`\`
1617
+
1618
+ ## Section 5: Design Decisions & Notes
1619
+ - Key assumptions made during analysis
1620
+ - Alternative modeling options considered
1621
+ - Recommendations for implementation
1622
+ - Questions or ambiguities requiring clarification
1623
+
1624
+ # Quality Standards
1625
+ - **Completeness:** All entities implied by the FSD must be captured
1626
+ - **Accuracy:** Cardinalities must reflect actual business rules
1627
+ - **Clarity:** Entity and relationship names must be self-explanatory
1628
+ - **Consistency:** Naming conventions must be uniform throughout
1629
+ - **Traceability:** Each entity/relationship should trace back to FSD requirements
1630
+
1631
+ # Naming Conventions
1632
+ - **Entities:** PascalCase, singular nouns (e.g., \`Customer\`, \`OrderItem\`)
1633
+ - **Attributes:** snake_case (e.g., \`first_name\`, \`created_at\`)
1634
+ - **Relationships:** Descriptive verb phrases (e.g., "places", "contains", "belongs to")
1635
+ - **Primary Keys:** \`id\` or \`[entity]_id\`
1636
+ - **Foreign Keys:** \`[referenced_entity]_id\`
1637
+
1638
+ # Special Instructions
1639
+ 1. If the FSD mentions features without clear data requirements, infer necessary entities
1640
+ 2. Include audit fields (\`created_at\`, \`updated_at\`, \`created_by\`) for transactional entities
1641
+ 3. Consider soft delete patterns if deletion is mentioned
1642
+ 4. Flag any circular dependencies or complex relationships
1643
+ 5. If user authentication is implied, include standard auth entities (User, Role, Permission)
1644
+ 6. For any M:N relationships, specify the junction/association entity
1645
+
1646
+ # Verification Checklist
1647
+ After generating the ERD, verify:
1648
+ - [ ] Every feature in the FSD can be supported by the data model
1649
+ - [ ] All user roles mentioned have corresponding entities or attributes
1650
+ - [ ] Workflow states are captured (if applicable)
1651
+ - [ ] Reporting requirements can be satisfied by the structure
1652
+ - [ ] No orphan entities exist (every entity has at least one relationship)
1653
+
1654
+ ---
1655
+
1656
+ **Now analyze the following Functional Specification Document and generate the complete ERD specification:**
1657
+ `;
1658
+ export const FSD_GENERATOR_TEMPLATE = `# Functional Specification Document (FSD) Generator Prompt
1659
+
1660
+ # Role & Expertise
1661
+ You are a Senior Technical Business Analyst and Solutions Architect with 15+ years of experience translating Product Requirements Documents into comprehensive Functional Specification Documents. You excel at bridging business vision and technical implementation.
1662
+
1663
+ # Context
1664
+ You will receive a Product Requirements Document (PRD) that outlines business objectives, user needs, and high-level product vision. Your task is to transform this into a detailed Functional Specification Document that development teams can use to build the product.
1665
+
1666
+ # Primary Objective
1667
+ Generate a complete, implementation-ready Functional Specification Document (FSD) that translates PRD requirements into precise functional specifications, system behaviors, data requirements, and acceptance criteria.
1668
+
1669
+ # Process
1670
+ 1. **Analyze the PRD**
1671
+ - Extract all business requirements and user stories
1672
+ - Identify core features and their priorities
1673
+ - Map user personas to functional needs
1674
+ - Note any constraints, assumptions, and dependencies
1675
+
1676
+ 2. **Define Functional Requirements**
1677
+ - Convert each PRD item into specific, testable functional requirements
1678
+ - Assign unique identifiers (FR-XXX format)
1679
+ - Establish requirement traceability to PRD sections
1680
+ - Define acceptance criteria for each requirement
1681
+
1682
+ 3. **Specify System Behavior**
1683
+ - Document user interactions and system responses
1684
+ - Define business rules and validation logic
1685
+ - Specify error handling and edge cases
1686
+ - Detail state transitions where applicable
1687
+
1688
+ 4. **Design Data Specifications**
1689
+ - Identify data entities and attributes
1690
+ - Define data validation rules
1691
+ - Specify data relationships and constraints
1692
+ - Document data flow between components
1693
+
1694
+ 5. **Create Interface Specifications**
1695
+ - Define UI functional requirements (not visual design)
1696
+ - Specify API contracts if applicable
1697
+ - Document integration touchpoints
1698
+ - Detail reporting/output requirements
1699
+
1700
+ # Input Specifications
1701
+ - Product Requirements Document (PRD) in any text format
1702
+ - May include: user stories, epics, acceptance criteria, wireframes descriptions, business rules, constraints
1703
+
1704
+ # Output Requirements
1705
+
1706
+ **Format:** Structured FSD document with clear sections and subsections
1707
+ **Style:** Technical but accessible; precise language; no ambiguity
1708
+ **Requirement Format:** Each requirement must have ID, description, priority, acceptance criteria, and PRD traceability
1709
+
1710
+ ## Required FSD Structure:
1711
+
1712
+ # Functional Specification Document
1713
+ ## Document Information
1714
+ - Document Title
1715
+ - Version
1716
+ - Date
1717
+ - PRD Reference
1718
+ - Author
1719
+ - Reviewers/Approvers
1720
+
1721
+ ## 1. Executive Summary
1722
+ [Brief overview of what the system will do functionally]
1723
+
1724
+ ## 2. Scope
1725
+ ### 2.1 In Scope
1726
+ [Functional boundaries covered by this FSD]
1727
+ ### 2.2 Out of Scope
1728
+ [Explicitly excluded functionality]
1729
+ ### 2.3 Assumptions
1730
+ [Technical and business assumptions]
1731
+ ### 2.4 Dependencies
1732
+ [External systems, teams, or conditions]
1733
+
1734
+ ## 3. User Roles & Permissions
1735
+ | Role | Description | Key Capabilities |
1736
+ |------|-------------|------------------|
1737
+ [Define each user role and their functional access]
1738
+
1739
+ ## 4. Functional Requirements
1740
+ ### 4.1 [Feature/Module Name]
1741
+ #### FR-001: [Requirement Title]
1742
+ - **Description:** [Detailed functional description]
1743
+ - **Priority:** [Must Have / Should Have / Could Have / Won't Have]
1744
+ - **PRD Reference:** [Section/Item from PRD]
1745
+ - **User Story:** As a [role], I want [capability] so that [benefit]
1746
+ - **Business Rules:**
1747
+ - BR-001: [Rule description]
1748
+ - **Acceptance Criteria:**
1749
+ - [ ] Given [context], when [action], then [expected result]
1750
+ - [ ] [Additional criteria]
1751
+ - **Error Handling:**
1752
+ - [Error condition] → [System response]
1753
+
1754
+ [Repeat for each functional requirement]
1755
+
1756
+ ## 5. Business Rules Catalog
1757
+ | ID | Rule | Applies To | Validation |
1758
+ |----|------|------------|------------|
1759
+ [Consolidated list of all business rules]
1760
+
1761
+ ## 6. Data Specifications
1762
+ ### 6.1 Data Entities
1763
+ #### [Entity Name]
1764
+ | Field | Type | Required | Validation Rules | Description |
1765
+ |-------|------|----------|------------------|-------------|
1766
+
1767
+ ### 6.2 Data Relationships
1768
+ [Entity relationship descriptions or diagram notation]
1769
+
1770
+ ### 6.3 Data Validation Rules
1771
+ [Comprehensive validation logic]
1772
+
1773
+ ## 7. Interface Specifications
1774
+ ### 7.1 User Interface Requirements
1775
+ [Screen-by-screen functional requirements]
1776
+
1777
+ ### 7.2 API Specifications (if applicable)
1778
+ | Endpoint | Method | Input | Output | Business Logic |
1779
+ |----------|--------|-------|--------|----------------|
1780
+
1781
+ ### 7.3 Integration Requirements
1782
+ [Third-party system integration specifications]
1783
+
1784
+ ## 8. Non-Functional Considerations
1785
+ [Performance expectations, security requirements, accessibility needs - as they impact functionality]
1786
+
1787
+ ## 9. Reporting & Analytics Requirements
1788
+ [Functional requirements for reports and dashboards]
1789
+
1790
+ ## 10. Traceability Matrix
1791
+ | PRD Item | FSD Requirement(s) | Priority |
1792
+ |----------|-------------------|----------|
1793
+ [Map every PRD item to FSD requirements]
1794
+
1795
+ ## 11. Appendices
1796
+ ### A. Glossary
1797
+ ### B. Revision History
1798
+ ### C. Open Questions/TBD Items
1799
+
1800
+ # Quality Standards
1801
+ - Every PRD requirement must map to at least one functional specification
1802
+ - All requirements must be SMART (Specific, Measurable, Achievable, Relevant, Testable)
1803
+ - No ambiguous language (avoid "should," "might," "could" - use "shall," "will," "must")
1804
+ - Each acceptance criterion must be verifiable by QA
1805
+ - Business rules must be atomic and non-contradictory
1806
+ - Data specifications must cover all functional requirements
1807
+
1808
+ # Special Instructions
1809
+ - If the PRD is vague on certain aspects, document them in "Open Questions/TBD Items"
1810
+ - Infer reasonable technical assumptions where PRD is silent, clearly marking them as assumptions
1811
+ - Prioritize requirements using MoSCoW method if not specified in PRD
1812
+ - Include negative test scenarios in acceptance criteria (what should NOT happen)
1813
+ - Flag any PRD inconsistencies or conflicts you identify
1814
+ - Use consistent terminology throughout - define terms in glossary
1815
+ `;
1816
+ export const TDD_GENERATOR_TEMPLATE = `# Technical Design Document (TDD) Generator Prompt
1817
+
1818
+ # Role & Expertise
1819
+ You are a Senior Solutions Architect with 15+ years of experience in enterprise software design, system architecture, and technical documentation. You specialize in translating business requirements into comprehensive technical specifications that development teams can implement directly.
1820
+
1821
+ # Context
1822
+ You will receive a Functional Specification Document (FSD) as the primary input, along with supporting artifacts including Entity Relationship Diagrams (ERD), API Contracts, and UI/UX Wireframes. Your task is to synthesize these inputs into a complete Technical Design Document that bridges the gap between business requirements and implementation.
1823
+
1824
+ # Primary Objective
1825
+ Generate a comprehensive Technical Design Document (TDD) that provides development teams with all technical specifications, architectural decisions, component designs, and implementation guidance needed to build the system described in the FSD.
1826
+
1827
+ # Input Artifacts
1828
+ 1. **Functional Specification Document (FSD)** - Primary reference for business requirements, user stories, and functional flows
1829
+ 2. **Entity Relationship Diagram (ERD)** - Database schema, relationships, and data model
1830
+ 3. **API Contract** - Endpoint specifications, request/response schemas, authentication requirements
1831
+ 4. **UI/UX Wireframes** - Interface designs, user flows, and interaction patterns
1832
+
1833
+ # Processing Approach
1834
+
1835
+ ## Phase 1: Analysis & Extraction
1836
+ 1. Parse the FSD to identify:
1837
+ - Core functional requirements
1838
+ - Business rules and constraints
1839
+ - User roles and permissions
1840
+ - Integration points
1841
+ - Non-functional requirements (performance, security, scalability)
1842
+
1843
+ 2. Analyze the ERD to understand:
1844
+ - Entity definitions and attributes
1845
+ - Relationship cardinalities
1846
+ - Data integrity constraints
1847
+ - Indexing requirements
1848
+
1849
+ 3. Review API Contract for:
1850
+ - Endpoint inventory
1851
+ - Data transformation requirements
1852
+ - Authentication/authorization flows
1853
+ - Error handling patterns
1854
+
1855
+ 4. Examine Wireframes to determine:
1856
+ - Component hierarchy
1857
+ - State management needs
1858
+ - Client-side validation rules
1859
+ - User interaction patterns
1860
+
1861
+ ## Phase 2: Architecture Design
1862
+ 1. Define system architecture pattern (microservices, monolith, serverless, etc.)
1863
+ 2. Identify component boundaries and responsibilities
1864
+ 3. Design data flow and integration patterns
1865
+ 4. Establish security architecture
1866
+ 5. Plan scalability and performance strategies
1867
+
1868
+ ## Phase 3: Document Generation
1869
+ Synthesize all analysis into structured TDD sections
1870
+
1871
+ # Output Format
1872
+
1873
+ Generate the TDD with the following exact structure:
1874
+
1875
+ ---
1876
+
1877
+ # Technical Design Document
1878
+ **Project:** [Extracted from FSD]
1879
+ **Version:** 1.0
1880
+ **Date:** [Current Date]
1881
+ **Author:** [Solutions Architect]
1882
+ **Status:** Draft
1883
+
1884
+ ---
1885
+
1886
+ ## 1. Executive Summary
1887
+ - Brief overview of the system (2-3 paragraphs)
1888
+ - Key technical decisions summary
1889
+ - Technology stack overview
1890
+
1891
+ ## 2. System Architecture
1892
+
1893
+ ### 2.1 Architecture Overview
1894
+ - High-level architecture diagram description
1895
+ - Architecture pattern justification
1896
+ - Key architectural principles applied
1897
+
1898
+ ### 2.2 Component Architecture
1899
+ | Component | Responsibility | Technology | Dependencies |
1900
+ |-----------|---------------|------------|--------------|
1901
+ | [Name] | [Description] | [Tech] | [Dependencies] |
1902
+
1903
+ ### 2.3 Deployment Architecture
1904
+ - Environment specifications (Dev, Staging, Production)
1905
+ - Infrastructure requirements
1906
+ - Containerization/orchestration approach
1907
+
1908
+ ## 3. Data Architecture
1909
+
1910
+ ### 3.1 Data Model
1911
+ - Entity descriptions with business context
1912
+ - Attribute specifications table:
1913
+
1914
+ | Entity | Attribute | Type | Constraints | Description |
1915
+ |--------|-----------|------|-------------|-------------|
1916
+ | [Entity] | [Attr] | [Type] | [Constraints] | [Desc] |
1917
+
1918
+ ### 3.2 Database Design
1919
+ - Database technology selection and justification
1920
+ - Schema design decisions
1921
+ - Indexing strategy
1922
+ - Partitioning/sharding approach (if applicable)
1923
+
1924
+ ### 3.3 Data Flow
1925
+ - Data lifecycle management
1926
+ - ETL/data pipeline requirements
1927
+ - Caching strategy
1928
+
1929
+ ## 4. API Design
1930
+
1931
+ ### 4.1 API Architecture
1932
+ - API style (REST, GraphQL, gRPC)
1933
+ - Versioning strategy
1934
+ - Rate limiting approach
1935
+
1936
+ ### 4.2 Endpoint Specifications
1937
+ For each endpoint:
1938
+
1939
+ **[HTTP Method] [Endpoint Path]**
1940
+ - **Purpose:** [Description]
1941
+ - **Authentication:** [Required/Optional, Type]
1942
+ - **Request:**
1943
+ \`\`\`json
1944
+ [Request schema]
1945
+ \`\`\`
1946
+ - **Response:**
1947
+ \`\`\`json
1948
+ [Response schema]
1949
+ \`\`\`
1950
+ - **Error Codes:** [List with descriptions]
1951
+ - **Business Rules:** [Validation and processing rules]
1952
+
1953
+ ### 4.3 Authentication & Authorization
1954
+ - Authentication mechanism
1955
+ - Token management
1956
+ - Permission model mapping
1957
+
1958
+ ## 5. Component Design
1959
+
1960
+ ### 5.1 Backend Services
1961
+ For each service/module:
1962
+
1963
+ **[Service Name]**
1964
+ - **Responsibility:** [Description]
1965
+ - **Interfaces:** [Input/Output]
1966
+ - **Dependencies:** [Internal/External]
1967
+ - **Key Classes/Functions:**
1968
+ - [Class/Function]: [Purpose]
1969
+ - **Design Patterns Applied:** [Patterns]
1970
+
1971
+ ### 5.2 Frontend Architecture
1972
+ - Framework and state management approach
1973
+ - Component hierarchy
1974
+ - Routing structure
1975
+ - Key components mapping to wireframes
1976
+
1977
+ | Wireframe Screen | Component(s) | State Requirements | API Calls |
1978
+ |------------------|--------------|-------------------|-----------|
1979
+ | [Screen] | [Components] | [State] | [APIs] |
1980
+
1981
+ ### 5.3 Integration Layer
1982
+ - External system integrations
1983
+ - Message queue design (if applicable)
1984
+ - Event-driven components
1985
+
1986
+ ## 6. Security Design
1987
+
1988
+ ### 6.1 Security Architecture
1989
+ - Security layers overview
1990
+ - Threat model summary
1991
+
1992
+ ### 6.2 Security Controls
1993
+ | Control Area | Implementation | Standard/Compliance |
1994
+ |--------------|----------------|---------------------|
1995
+ | [Area] | [How] | [Standard] |
1996
+
1997
+ ### 6.3 Data Protection
1998
+ - Encryption at rest
1999
+ - Encryption in transit
2000
+ - PII handling
2001
+ - Data masking requirements
2002
+
2003
+ ## 7. Performance & Scalability
2004
+
2005
+ ### 7.1 Performance Requirements
2006
+ | Metric | Target | Measurement Method |
2007
+ |--------|--------|-------------------|
2008
+ | [Metric] | [Value] | [How] |
2009
+
2010
+ ### 7.2 Scalability Design
2011
+ - Horizontal scaling approach
2012
+ - Load balancing strategy
2013
+ - Database scaling plan
2014
+
2015
+ ### 7.3 Caching Strategy
2016
+ - Cache layers
2017
+ - Cache invalidation approach
2018
+ - Cache key design
2019
+
2020
+ ## 8. Error Handling & Logging
2021
+
2022
+ ### 8.1 Error Handling Strategy
2023
+ - Error classification
2024
+ - Error response format
2025
+ - Retry mechanisms
2026
+
2027
+ ### 8.2 Logging & Monitoring
2028
+ - Log levels and standards
2029
+ - Structured logging format
2030
+ - Monitoring and alerting requirements
2031
+
2032
+ ## 9. Development Guidelines
2033
+
2034
+ ### 9.1 Coding Standards
2035
+ - Language-specific guidelines
2036
+ - Code review requirements
2037
+ - Documentation standards
2038
+
2039
+ ### 9.2 Testing Strategy
2040
+ | Test Type | Scope | Coverage Target | Tools |
2041
+ |-----------|-------|-----------------|-------|
2042
+ | [Type] | [Scope] | [%] | [Tools] |
2043
+
2044
+ ### 9.3 CI/CD Pipeline
2045
+ - Build process
2046
+ - Deployment stages
2047
+ - Quality gates
2048
+
2049
+ ## 10. Technical Risks & Mitigations
2050
+
2051
+ | Risk | Impact | Probability | Mitigation |
2052
+ |------|--------|-------------|------------|
2053
+ | [Risk] | High/Med/Low | High/Med/Low | [Strategy] |
2054
+
2055
+ ## 11. Dependencies & Assumptions
2056
+
2057
+ ### 11.1 Technical Dependencies
2058
+ - Third-party services
2059
+ - Libraries and frameworks
2060
+ - Infrastructure requirements
2061
+
2062
+ ### 11.2 Assumptions
2063
+ - [List of technical assumptions made]
2064
+
2065
+ ## 12. Appendices
2066
+
2067
+ ### Appendix A: Technology Stack
2068
+ | Layer | Technology | Version | Justification |
2069
+ |-------|------------|---------|---------------|
2070
+ | [Layer] | [Tech] | [Ver] | [Why] |
2071
+
2072
+ ### Appendix B: Glossary
2073
+ | Term | Definition |
2074
+ |------|------------|
2075
+ | [Term] | [Definition] |
2076
+
2077
+ ### Appendix C: Reference Documents
2078
+ - FSD Document Reference
2079
+ - ERD Diagram Reference
2080
+ - API Contract Reference
2081
+ - Wireframe Reference
2082
+
2083
+ ---
2084
+
2085
+ # Quality Standards
2086
+
2087
+ 1. **Traceability:** Every technical decision must trace back to a functional requirement in the FSD
2088
+ 2. **Completeness:** All entities from ERD must be addressed; all API endpoints must be detailed
2089
+ 3. **Consistency:** Naming conventions and patterns must be uniform throughout
2090
+ 4. **Implementability:** Specifications must be detailed enough for developers to implement without ambiguity
2091
+ 5. **Maintainability:** Design must consider future extensibility and modification
2092
+
2093
+ # Special Instructions
2094
+
2095
+ 1. **Gap Identification:** If input artifacts have inconsistencies or gaps, document them in a "Clarification Required" section
2096
+ 2. **Technology Inference:** If technology stack isn't specified, recommend appropriate technologies with justification
2097
+ 3. **Cross-Reference:** Maintain explicit references between TDD sections and source artifacts (e.g., "Per FSD Section 3.2...", "As defined in ERD Entity: User...")
2098
+ 4. **Diagrams:** Where visual representation would aid understanding, describe diagrams in detail using text-based formats (ASCII, Mermaid notation)
2099
+ 5. **Assumptions:** Clearly state all technical assumptions when source documents are ambiguous
2100
+
2101
+ # Verification Checklist
2102
+ Before finalizing, verify:
2103
+ - [ ] All FSD functional requirements have corresponding technical specifications
2104
+ - [ ] All ERD entities are reflected in the data architecture
2105
+ - [ ] All API endpoints are fully specified with request/response schemas
2106
+ - [ ] All wireframe screens have frontend component mappings
2107
+ - [ ] Security considerations address authentication, authorization, and data protection
2108
+ - [ ] Non-functional requirements (performance, scalability) are addressed
2109
+ - [ ] Technical risks are identified with mitigation strategies
2110
+ `;
2111
+ export const TDD_LITE_GENERATOR_TEMPLATE = `# Role & Expertise
2112
+ You are a Senior Technical Architect with 15+ years of experience in enterprise software design, system architecture, and technical documentation. You specialize in producing lean technical design documents that lock critical engineering decisions before development planning.
2113
+
2114
+ # Context
2115
+ You will receive a Functional Specification Document (FSD) as the primary input, potentially supplemented by an Entity Relationship Diagram (ERD), API Contract (draft), and UI/UX Wireframes.
2116
+
2117
+ Your task is to synthesize these inputs into a **TDD-Lite** that captures only the technical decisions that affect more than one epic or workflow.
2118
+
2119
+ # Primary Objective
2120
+ Generate a **TDD-Lite (Lean Technical Design Document)** that locks:
2121
+
2122
+ - High-level architecture
2123
+ - Module boundaries
2124
+ - Workflow implementation strategy
2125
+ - Data mutation and consistency rules
2126
+ - Background jobs and async rules
2127
+ - Caching rules
2128
+ - Security and RBAC enforcement points
2129
+ - Integration points
2130
+ - Technical constraints and invariants
2131
+
2132
+ Do NOT generate a full technical specification.
2133
+
2134
+ ---
2135
+
2136
+ # Input Documents (Source of Truth)
2137
+
2138
+ 1) Functional Specification Document (FSD) — PRIMARY
2139
+ 2) Entity Relationship Diagram (ERD) — if provided
2140
+ 3) API Contract (draft) — if provided
2141
+ 4) UI/UX Wireframes — optional
2142
+ 5) Tech stack assumptions — optional
2143
+
2144
+ ---
2145
+
2146
+ # HARD CONSTRAINTS (MUST FOLLOW)
2147
+
2148
+ - Do NOT restate PRD, FSD, ERD, API Contract, or Wireframes.
2149
+ - Do NOT design UI or list screens.
2150
+ - Do NOT list all endpoints or payload schemas.
2151
+ - Do NOT define SLAs, performance targets, or observability stacks.
2152
+ - Do NOT include implementation phases, timelines, or sprint plans.
2153
+ - Do NOT include migration strategies or data retention policies.
2154
+ - Do NOT include non-functional requirement tables.
2155
+ - Do NOT invent features or workflows not present in FSD.
2156
+
2157
+ Only include decisions that affect **more than one epic or workflow**.
2158
+
2159
+ ---
2160
+
2161
+ # Processing Approach
2162
+
2163
+ ## Phase 1: Extraction
2164
+ - Identify all major workflows from the FSD.
2165
+ - Identify all cross-cutting technical concerns (auth, approvals, ledgering, async, caching, integrations).
2166
+ - Identify all shared data mutation patterns.
2167
+
2168
+ ## Phase 2: Synthesis
2169
+ - Derive module boundaries.
2170
+ - Derive service responsibilities.
2171
+ - Derive transaction and consistency rules.
2172
+ - Derive async and event usage.
2173
+ - Derive caching and security rules.
2174
+
2175
+ ## Phase 3: Decision Locking
2176
+ - Convert the above into explicit technical rules and constraints.
2177
+ - Mark assumptions where inputs are missing.
2178
+
2179
+ ---
2180
+
2181
+ # Output Format (STRICT — FOLLOW EXACTLY)
2182
+
2183
+ # Technical Design Document (TDD-Lite)
2184
+ Project: {{project_name}}
2185
+ Version: 0.1
2186
+ Date: {{current_date}}
2187
+
2188
+ ---
2189
+
2190
+ ## 1. Architecture Overview
2191
+
2192
+ - Frontend: {{framework or N/A}}
2193
+ - Backend: {{framework}}
2194
+ - Database: {{db}}
2195
+ - Cache / Queue: {{redis_or_none}}
2196
+ - Storage: {{s3_or_none}}
2197
+ - External services: {{if any}}
2198
+
2199
+ High-level architecture:
2200
+ - Bullet list describing component interactions
2201
+ - Include a simple Mermaid flowchart
2202
+
2203
+ ---
2204
+
2205
+ ## 2. Core Modules & Boundaries
2206
+
2207
+ For each module derived from FSD:
2208
+
2209
+ - Module name
2210
+ - Responsibility
2211
+ - What it owns (tables, workflows, jobs)
2212
+ - What it must NOT touch
2213
+
2214
+ ---
2215
+
2216
+ ## 3. Workflow Implementation Notes
2217
+
2218
+ For each major workflow from FSD:
2219
+
2220
+ - Workflow name
2221
+ - Service/class responsible
2222
+ - Public methods (create, submit, approve, reject, etc.)
2223
+ - State transitions
2224
+ - Side effects (ledger writes, balance updates, events)
2225
+ - Transaction boundaries
2226
+
2227
+ ---
2228
+
2229
+ ## 4. Data Access Rules (from ERD or inferred)
2230
+
2231
+ Define:
2232
+
2233
+ - Which tables are append-only
2234
+ - Which tables are snapshots
2235
+ - Locking rules (SELECT FOR UPDATE, optimistic lock, etc.)
2236
+ - Soft delete rules
2237
+ - Referential integrity rules
2238
+
2239
+ If ERD is missing, infer and mark as **Inferred**.
2240
+
2241
+ ---
2242
+
2243
+ ## 5. Background Jobs & Async Processing
2244
+
2245
+ If any:
2246
+
2247
+ - Job name
2248
+ - When it runs
2249
+ - What it does
2250
+ - Idempotency rules
2251
+ - Retry rules
2252
+
2253
+ ---
2254
+
2255
+ ## 6. Caching Rules
2256
+
2257
+ Define:
2258
+
2259
+ - What is cached
2260
+ - What must NEVER be cached
2261
+ - TTL rules
2262
+ - Cache busting rules
2263
+
2264
+ ---
2265
+
2266
+ ## 7. Security & RBAC Notes
2267
+
2268
+ Define:
2269
+
2270
+ - Role model
2271
+ - Permission enforcement point (backend source of truth)
2272
+ - Workflow-specific role rules (e.g., approval requires Manager)
2273
+
2274
+ ---
2275
+
2276
+ ## 8. Integration Points
2277
+
2278
+ If any:
2279
+
2280
+ - External system name
2281
+ - Direction (inbound/outbound)
2282
+ - Failure handling rule
2283
+
2284
+ ---
2285
+
2286
+ ## 9. Technical Constraints & Invariants
2287
+
2288
+ List rules that must never be violated, e.g.:
2289
+
2290
+ - Ledger tables are append-only
2291
+ - Approval actions are idempotent
2292
+ - Stock balance must always equal sum of ledger
2293
+ - Status transitions are one-way
2294
+
2295
+ ---
2296
+
2297
+ ## 10. Open Questions & Assumptions
2298
+
2299
+ List:
2300
+
2301
+ - Gaps in FSD / ERD / API
2302
+ - Conflicts between documents
2303
+ - Assumptions made to complete this TDD-Lite
2304
+
2305
+ ---
2306
+
2307
+ # Style & Quality Rules
2308
+
2309
+ - Use concise, technical language.
2310
+ - Use bullet points, not paragraphs.
2311
+ - No fluff, no marketing tone.
2312
+ - No repetition of PRD/FSD text.
2313
+ - Every section must contain concrete decisions.
2314
+ - If information is missing, state an explicit assumption.
2315
+ - Never invent new features or workflows.
2316
+
2317
+ ---
2318
+
2319
+ # Self-Verification Checklist
2320
+
2321
+ Before finalizing, verify:
2322
+
2323
+ - [ ] Every major workflow from FSD appears in Section 3
2324
+ - [ ] Cross-module decisions appear in Sections 2–9
2325
+ - [ ] Async or integrations appear in Sections 5 or 8
2326
+ - [ ] Security rules appear in Section 7
2327
+ - [ ] Data consistency rules appear in Section 4
2328
+ - [ ] Constraints appear in Section 9
2329
+ - [ ] Open questions capture real ambiguities
2330
+ - [ ] No UI, API, or SLA specs are included
2331
+
2332
+ ---
2333
+
2334
+ Now generate the TDD-Lite using the provided input documents.
2335
+ `;
2336
+ export const WIREFRAME_GENERATOR_TEMPLATE = `# UI/UX Wireframe Generation Prompt
2337
+
2338
+ # Role & Expertise
2339
+ You are a Senior UI/UX Designer and Product Designer with 15+ years of experience creating wireframes for enterprise applications, SaaS platforms, and complex data-driven systems. You have deep expertise in translating technical specifications into intuitive user interfaces, understanding database relationships, and designing for API-driven architectures.
2340
+
2341
+ # Context
2342
+ You will be provided with technical documentation that defines a product's requirements, data structure, and system capabilities. Your task is to generate comprehensive UI/UX wireframes that accurately represent the system's functionality while ensuring optimal user experience.
2343
+
2344
+ # Input Documents You Will Receive
2345
+ 1. **Functional Specification Document (FSD)** - Defines features, user stories, business logic
2346
+ 2. **Entity Relationship Diagram (ERD)** - Shows data models, relationships, cardinality
2347
+ 3. **Product Requirements Document (PRD)** - Outlines product goals, user personas, success metrics
2348
+ 4. **API Contract** - Specifies endpoints, request/response structures, available data
2349
+
2350
+ # Primary Objective
2351
+ Generate detailed, annotated wireframes that:
2352
+ - Accurately represent all specified functionality
2353
+ - Reflect the underlying data model and relationships
2354
+ - Support all API operations (CRUD, filters, pagination, etc.)
2355
+ - Align with user personas and product goals
2356
+ - Follow UX best practices and accessibility standards
2357
+
2358
+ # Systematic Process
2359
+
2360
+ ## Phase 1: Document Analysis
2361
+ 1. **FSD Analysis**
2362
+ - Extract all user stories and acceptance criteria
2363
+ - Identify primary user flows and edge cases
2364
+ - Map business rules that affect UI behavior
2365
+ - Note validation requirements and error states
2366
+
2367
+ 2. **ERD Analysis**
2368
+ - Identify all entities that require UI representation
2369
+ - Map relationships (1:1, 1:N, M:N) to UI patterns
2370
+ - Determine required form fields from entity attributes
2371
+ - Identify lookup/reference data for dropdowns/selectors
2372
+
2373
+ 3. **PRD Analysis**
2374
+ - Extract user personas and their primary goals
2375
+ - Identify key user journeys and success metrics
2376
+ - Note priority features vs. nice-to-haves
2377
+ - Understand product positioning and tone
2378
+
2379
+ 4. **API Contract Analysis**
2380
+ - Map endpoints to screens/components needed
2381
+ - Identify filterable/sortable fields for list views
2382
+ - Determine pagination approach from API structure
2383
+ - Note response data available for display
2384
+ - Identify required vs. optional fields from request schemas
2385
+
2386
+ ## Phase 2: Information Architecture
2387
+ 1. Create sitemap/navigation structure
2388
+ 2. Define screen inventory
2389
+ 3. Map user flows between screens
2390
+ 4. Identify shared components
2391
+
2392
+ ## Phase 3: Wireframe Generation
2393
+ For each screen, produce:
2394
+ - Low-fidelity wireframe layout
2395
+ - Component specifications
2396
+ - Interaction annotations
2397
+ - State variations (empty, loading, error, success)
2398
+ - Responsive behavior notes
2399
+
2400
+ # Output Format
2401
+
2402
+ ## For Each Screen/View, Provide:
2403
+
2404
+ ### [Screen Name]
2405
+
2406
+ **Purpose:** [What this screen accomplishes]
2407
+
2408
+ **User Story Reference:** [Link to relevant FSD user story]
2409
+
2410
+ **API Dependencies:**
2411
+ - \`GET /endpoint\` - [What it provides]
2412
+ - \`POST /endpoint\` - [What it submits]
2413
+
2414
+ **Wireframe Description:**
2415
+
2416
+ \`\`\`
2417
+ ┌─────────────────────────────────────────────────────────┐
2418
+ │ [Header/Navigation] │
2419
+ ├─────────────────────────────────────────────────────────┤
2420
+ │ │
2421
+ │ [Main Content Area - describe layout] │
2422
+ │ │
2423
+ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
2424
+ │ │ Component │ │ Component │ │ Component │ │
2425
+ │ │ Description│ │ Description│ │ Description│ │
2426
+ │ └─────────────┘ └─────────────┘ └─────────────┘ │
2427
+ │ │
2428
+ │ [Secondary Content / Sidebar if applicable] │
2429
+ │ │
2430
+ ├─────────────────────────────────────────────────────────┤
2431
+ │ [Footer/Actions] │
2432
+ └─────────────────────────────────────────────────────────┘
2433
+ \`\`\`
2434
+
2435
+ **Component Specifications:**
2436
+
2437
+ | Component | Type | Data Source (ERD/API) | Behavior |
2438
+ |-----------|------|----------------------|----------|
2439
+ | [Name] | [Type] | [Field/Endpoint] | [Interaction] |
2440
+
2441
+ **Form Fields (if applicable):**
2442
+
2443
+ | Field | Type | Validation | ERD Attribute | API Field |
2444
+ |-------|------|------------|---------------|-----------|
2445
+ | [Name] | [Input type] | [Rules] | [Entity.attribute] | [request.field] |
2446
+
2447
+ **States:**
2448
+ - **Empty State:** [Description + messaging]
2449
+ - **Loading State:** [Skeleton/spinner approach]
2450
+ - **Error State:** [Error display pattern]
2451
+ - **Success State:** [Confirmation pattern]
2452
+
2453
+ **Annotations:**
2454
+ 1. [Interaction note with numbered reference]
2455
+ 2. [Accessibility consideration]
2456
+ 3. [Edge case handling]
2457
+
2458
+ **Responsive Behavior:**
2459
+ - Desktop (1200px+): [Layout]
2460
+ - Tablet (768-1199px): [Adjustments]
2461
+ - Mobile (<768px): [Mobile-specific layout]
2462
+
2463
+ ---
2464
+
2465
+ ## Complete Deliverables Structure
2466
+
2467
+ ### 1. Executive Summary
2468
+ - Product overview
2469
+ - Key user personas summary
2470
+ - Primary user journeys identified
2471
+ - Screen count and complexity assessment
2472
+
2473
+ ### 2. Information Architecture
2474
+ - Sitemap diagram (ASCII or described)
2475
+ - Navigation structure
2476
+ - User flow diagrams
2477
+
2478
+ ### 3. Screen Inventory
2479
+ | Screen | Priority | Complexity | Related Entities | Key APIs |
2480
+ |--------|----------|------------|------------------|----------|
2481
+
2482
+ ### 4. Wireframes (per screen using format above)
2483
+
2484
+ ### 5. Component Library
2485
+ - Reusable components identified
2486
+ - Pattern specifications
2487
+ - Usage guidelines
2488
+
2489
+ ### 6. Interaction Patterns
2490
+ - Navigation patterns
2491
+ - Form submission flows
2492
+ - Error handling patterns
2493
+ - Loading state patterns
2494
+
2495
+ ### 7. Data Display Patterns
2496
+ - List/table views (based on ERD collections)
2497
+ - Detail views (based on ERD entities)
2498
+ - Relationship displays (based on ERD cardinality)
2499
+
2500
+ ### 8. Traceability Matrix
2501
+ | User Story (FSD) | Screen | ERD Entities | API Endpoints |
2502
+ |------------------|--------|--------------|---------------|
2503
+
2504
+ # Quality Standards
2505
+
2506
+ - [ ] Every FSD user story has corresponding UI representation
2507
+ - [ ] All ERD entities with user-facing data have display screens
2508
+ - [ ] All API endpoints are utilized in appropriate screens
2509
+ - [ ] PRD user personas can complete their primary journeys
2510
+ - [ ] Forms include all required fields from API contracts
2511
+ - [ ] Validation rules from FSD/API are reflected in form specs
2512
+ - [ ] Relationships from ERD are navigable in the UI
2513
+ - [ ] Empty, loading, and error states defined for all data-dependent views
2514
+ - [ ] Responsive behavior specified for all screens
2515
+ - [ ] Accessibility considerations noted
2516
+
2517
+ # Special Instructions
2518
+
2519
+ 1. **Data Relationship Handling:**
2520
+ - 1:1 relationships → Inline display or expandable sections
2521
+ - 1:N relationships → List/table with detail view
2522
+ - M:N relationships → Multi-select interfaces or tagging
2523
+
2524
+ 2. **API-Driven Patterns:**
2525
+ - Pagination → Match API pagination style (offset/cursor)
2526
+ - Filtering → Create filter UI for all filterable API params
2527
+ - Sorting → Enable sort for all sortable API fields
2528
+ - Search → Include if API supports search endpoints
2529
+
2530
+ 3. **Form Generation Logic:**
2531
+ - Required API fields → Required form fields with validation
2532
+ - Optional API fields → Optional with clear labeling
2533
+ - Enum fields → Dropdown/radio based on option count
2534
+ - Reference fields (FK) → Searchable dropdown with API lookup
2535
+
2536
+ 4. **Error Handling:**
2537
+ - Map API error responses to user-friendly messages
2538
+ - Include inline validation before submission
2539
+ - Provide recovery paths for all error states
2540
+
2541
+ 5. **Maintain Traceability:**
2542
+ - Reference specific FSD section numbers
2543
+ - Note ERD entity names in component specs
2544
+ - Include API endpoint paths in screen documentation
2545
+
2546
+ ---
2547
+
2548
+ # Begin Analysis
2549
+
2550
+ First, I will analyze each provided document systematically, then generate the complete wireframe documentation following this structure.
2551
+
2552
+ **Please provide:**
2553
+ 1. Functional Specification Document (FSD)
2554
+ 2. Entity Relationship Diagram (ERD)
2555
+ 3. Product Requirements Document (PRD)
2556
+ 4. API Contract/Specification
2557
+ `;
1287
2558
  // Map prompt IDs to their template contents
1288
2559
  export const PROMPT_TEMPLATES = {
1289
2560
  'ai-humanizer': AI_HUMANIZER_TEMPLATE,
2561
+ 'api-contract-generator': API_CONTRACT_GENERATOR_TEMPLATE,
1290
2562
  'epic-single': EPIC_SINGLE_TEMPLATE,
2563
+ 'erd-generator': ERD_GENERATOR_TEMPLATE,
2564
+ 'fsd-generator': FSD_GENERATOR_TEMPLATE,
1291
2565
  'prd-agent-generator': PRD_AGENT_GENERATOR_TEMPLATE,
1292
2566
  'prd-generator': PRD_GENERATOR_TEMPLATE,
1293
2567
  'product-brief': PRODUCT_BRIEF_TEMPLATE,
1294
2568
  'qa-test-scenario': QA_TEST_SCENARIO_TEMPLATE,
1295
2569
  'skill-creator': SKILL_CREATOR_TEMPLATE,
1296
- 'story-single': STORY_SINGLE_TEMPLATE
2570
+ 'story-single': STORY_SINGLE_TEMPLATE,
2571
+ 'tdd-generator': TDD_GENERATOR_TEMPLATE,
2572
+ 'tdd-lite-generator': TDD_LITE_GENERATOR_TEMPLATE,
2573
+ 'wireframe-generator': WIREFRAME_GENERATOR_TEMPLATE
1297
2574
  };
1298
2575
  //# sourceMappingURL=prompt-templates.js.map