dx-driven 0.1.0

Professional AI-assisted development orchestrator with binary-first architecture
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
//! Built-in Workflow Definitions
//!
//! Provides 30+ guided workflows matching BMAD-METHOD capabilities.

use super::{Workflow, WorkflowPhase, WorkflowStep};

/// Get all built-in workflows
pub fn all_workflows() -> Vec<Workflow> {
    let mut workflows = Vec::new();

    // Analysis Phase (4)
    workflows.extend(analysis_workflows());

    // Planning Phase (4)
    workflows.extend(planning_workflows());

    // Solutioning Phase (4)
    workflows.extend(solutioning_workflows());

    // Implementation Phase (5)
    workflows.extend(implementation_workflows());

    // Quick Flow (3)
    workflows.extend(quick_flow_workflows());

    // Testing (3)
    workflows.extend(testing_workflows());

    // Documentation (2)
    workflows.extend(documentation_workflows());

    // DevOps (2)
    workflows.extend(devops_workflows());

    // Additional workflows (7+)
    workflows.extend(additional_workflows());

    workflows
}

/// Analysis phase workflows
pub fn analysis_workflows() -> Vec<Workflow> {
    vec![
        brainstorming(),
        research(),
        product_brief(),
        competitive_analysis(),
    ]
}

/// Planning phase workflows
pub fn planning_workflows() -> Vec<Workflow> {
    vec![prd(), ux_design(), tech_spec(), api_design()]
}

/// Solutioning phase workflows
pub fn solutioning_workflows() -> Vec<Workflow> {
    vec![
        architecture(),
        epics_and_stories(),
        implementation_readiness(),
        data_model(),
    ]
}

/// Implementation phase workflows
pub fn implementation_workflows() -> Vec<Workflow> {
    vec![
        sprint_planning(),
        dev_story(),
        code_review(),
        retrospective(),
        sprint_status(),
    ]
}

/// Quick Flow workflows
pub fn quick_flow_workflows() -> Vec<Workflow> {
    vec![quick_bug_fix(), quick_feature(), quick_refactor()]
}

/// Testing workflows
pub fn testing_workflows() -> Vec<Workflow> {
    vec![test_design(), test_automation(), test_review()]
}

/// Documentation workflows
pub fn documentation_workflows() -> Vec<Workflow> {
    vec![document_project(), api_documentation()]
}

/// DevOps workflows
pub fn devops_workflows() -> Vec<Workflow> {
    vec![ci_setup(), deployment()]
}

/// Additional workflows
pub fn additional_workflows() -> Vec<Workflow> {
    vec![
        security_review(),
        performance_review(),
        onboarding(),
        tech_debt(),
        migration(),
        incident_response(),
        release_planning(),
    ]
}

// ============ Analysis Phase ============

pub fn brainstorming() -> Workflow {
    Workflow::new(
        "brainstorming",
        "Brainstorming",
        WorkflowPhase::Analysis,
        "Generate and explore ideas for a new feature or product",
    )
    .with_step(
        WorkflowStep::new(
            "define-problem",
            "Define the Problem",
            "Clearly articulate the problem to solve",
            "analyst",
        )
        .with_actions(vec![
            "Identify the core problem".to_string(),
            "Define success criteria".to_string(),
            "List constraints and assumptions".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "generate-ideas",
            "Generate Ideas",
            "Brainstorm potential solutions",
            "analyst",
        )
        .with_actions(vec![
            "List all possible solutions".to_string(),
            "Encourage wild ideas".to_string(),
            "Build on others' ideas".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "evaluate-ideas",
            "Evaluate Ideas",
            "Assess and prioritize ideas",
            "analyst",
        )
        .with_actions(vec![
            "Score ideas against criteria".to_string(),
            "Identify pros and cons".to_string(),
            "Select top candidates".to_string(),
        ])
        .as_checkpoint(),
    )
    .as_builtin()
}

pub fn research() -> Workflow {
    Workflow::new(
        "research",
        "Research",
        WorkflowPhase::Analysis,
        "Conduct research to inform product decisions",
    )
    .with_step(
        WorkflowStep::new(
            "define-questions",
            "Define Research Questions",
            "Identify what we need to learn",
            "analyst",
        )
        .with_actions(vec![
            "List key questions".to_string(),
            "Prioritize by impact".to_string(),
            "Define research methods".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "gather-data",
            "Gather Data",
            "Collect relevant information",
            "analyst",
        )
        .with_actions(vec![
            "Review existing documentation".to_string(),
            "Analyze competitors".to_string(),
            "Interview stakeholders".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "synthesize",
            "Synthesize Findings",
            "Analyze and summarize research",
            "analyst",
        )
        .with_actions(vec![
            "Identify patterns and themes".to_string(),
            "Draw conclusions".to_string(),
            "Make recommendations".to_string(),
        ])
        .as_checkpoint(),
    )
    .as_builtin()
}

pub fn product_brief() -> Workflow {
    Workflow::new(
        "product-brief",
        "Product Brief",
        WorkflowPhase::Analysis,
        "Create a concise product brief",
    )
    .with_step(
        WorkflowStep::new(
            "vision",
            "Define Vision",
            "Articulate the product vision",
            "pm",
        )
        .with_actions(vec![
            "Write vision statement".to_string(),
            "Define target users".to_string(),
            "Identify key benefits".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "scope",
            "Define Scope",
            "Outline what's in and out of scope",
            "pm",
        )
        .with_actions(vec![
            "List core features".to_string(),
            "Define MVP boundaries".to_string(),
            "Identify future phases".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "success-metrics",
            "Define Success Metrics",
            "How we'll measure success",
            "pm",
        )
        .with_actions(vec![
            "Define KPIs".to_string(),
            "Set targets".to_string(),
            "Plan measurement approach".to_string(),
        ])
        .as_checkpoint(),
    )
    .as_builtin()
}

pub fn competitive_analysis() -> Workflow {
    Workflow::new(
        "competitive-analysis",
        "Competitive Analysis",
        WorkflowPhase::Analysis,
        "Analyze competitors and market positioning",
    )
    .with_step(
        WorkflowStep::new(
            "identify-competitors",
            "Identify Competitors",
            "List direct and indirect competitors",
            "analyst",
        )
        .with_actions(vec![
            "Research market landscape".to_string(),
            "Categorize competitors".to_string(),
            "Prioritize for analysis".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "analyze-features",
            "Analyze Features",
            "Compare feature sets",
            "analyst",
        )
        .with_actions(vec![
            "Create feature matrix".to_string(),
            "Identify gaps and opportunities".to_string(),
            "Note unique differentiators".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "positioning",
            "Define Positioning",
            "Determine market positioning",
            "pm",
        )
        .with_actions(vec![
            "Identify unique value proposition".to_string(),
            "Define competitive advantages".to_string(),
            "Create positioning statement".to_string(),
        ])
        .as_checkpoint(),
    )
    .as_builtin()
}

// ============ Planning Phase ============

pub fn prd() -> Workflow {
    Workflow::new(
        "prd",
        "Product Requirements Document",
        WorkflowPhase::Planning,
        "Create a comprehensive PRD",
    )
    .with_step(
        WorkflowStep::new(
            "overview",
            "Write Overview",
            "Document product overview",
            "pm",
        )
        .with_actions(vec![
            "Write executive summary".to_string(),
            "Define problem statement".to_string(),
            "List objectives".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "requirements",
            "Define Requirements",
            "Document functional requirements",
            "pm",
        )
        .with_actions(vec![
            "Write user stories".to_string(),
            "Define acceptance criteria".to_string(),
            "Prioritize requirements".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "non-functional",
            "Non-Functional Requirements",
            "Document NFRs",
            "architect",
        )
        .with_actions(vec![
            "Define performance requirements".to_string(),
            "Define security requirements".to_string(),
            "Define scalability requirements".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new("review", "Review PRD", "Get stakeholder approval", "pm")
            .with_actions(vec![
                "Share with stakeholders".to_string(),
                "Collect feedback".to_string(),
                "Finalize document".to_string(),
            ])
            .as_checkpoint(),
    )
    .as_builtin()
}

pub fn ux_design() -> Workflow {
    Workflow::new(
        "ux-design",
        "UX Design",
        WorkflowPhase::Planning,
        "Design user experience and interface",
    )
    .with_step(
        WorkflowStep::new(
            "user-research",
            "User Research",
            "Understand user needs",
            "ux-designer",
        )
        .with_actions(vec![
            "Create user personas".to_string(),
            "Map user journeys".to_string(),
            "Identify pain points".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "wireframes",
            "Create Wireframes",
            "Design low-fidelity wireframes",
            "ux-designer",
        )
        .with_actions(vec![
            "Sketch key screens".to_string(),
            "Define information architecture".to_string(),
            "Plan navigation flow".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "prototype",
            "Build Prototype",
            "Create interactive prototype",
            "ux-designer",
        )
        .with_actions(vec![
            "Build clickable prototype".to_string(),
            "Add interactions".to_string(),
            "Prepare for testing".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "validate",
            "Validate Design",
            "Test with users",
            "ux-designer",
        )
        .with_actions(vec![
            "Conduct usability testing".to_string(),
            "Gather feedback".to_string(),
            "Iterate on design".to_string(),
        ])
        .as_checkpoint(),
    )
    .as_builtin()
}

pub fn tech_spec() -> Workflow {
    Workflow::new(
        "tech-spec",
        "Technical Specification",
        WorkflowPhase::Planning,
        "Create detailed technical specification",
    )
    .with_step(
        WorkflowStep::new(
            "overview",
            "Technical Overview",
            "Document technical approach",
            "architect",
        )
        .with_actions(vec![
            "Describe solution approach".to_string(),
            "List technologies".to_string(),
            "Identify dependencies".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "design",
            "Detailed Design",
            "Document component design",
            "architect",
        )
        .with_actions(vec![
            "Design components".to_string(),
            "Define interfaces".to_string(),
            "Document data flow".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "risks",
            "Risk Assessment",
            "Identify and mitigate risks",
            "architect",
        )
        .with_actions(vec![
            "List technical risks".to_string(),
            "Define mitigation strategies".to_string(),
            "Plan contingencies".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "review",
            "Technical Review",
            "Get technical approval",
            "architect",
        )
        .with_actions(vec![
            "Review with team".to_string(),
            "Address concerns".to_string(),
            "Finalize spec".to_string(),
        ])
        .as_checkpoint(),
    )
    .as_builtin()
}

pub fn api_design() -> Workflow {
    Workflow::new(
        "api-design",
        "API Design",
        WorkflowPhase::Planning,
        "Design RESTful or GraphQL API",
    )
    .with_step(
        WorkflowStep::new(
            "resources",
            "Define Resources",
            "Identify API resources",
            "architect",
        )
        .with_actions(vec![
            "List resources".to_string(),
            "Define relationships".to_string(),
            "Plan URL structure".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "endpoints",
            "Design Endpoints",
            "Define API endpoints",
            "architect",
        )
        .with_actions(vec![
            "Define CRUD operations".to_string(),
            "Specify request/response formats".to_string(),
            "Document error handling".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "security",
            "Security Design",
            "Plan API security",
            "security",
        )
        .with_actions(vec![
            "Define authentication".to_string(),
            "Plan authorization".to_string(),
            "Document rate limiting".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "documentation",
            "API Documentation",
            "Create API docs",
            "tech-writer",
        )
        .with_actions(vec![
            "Write OpenAPI spec".to_string(),
            "Add examples".to_string(),
            "Generate documentation".to_string(),
        ])
        .as_checkpoint(),
    )
    .as_builtin()
}

// ============ Solutioning Phase ============

pub fn architecture() -> Workflow {
    Workflow::new(
        "architecture",
        "Architecture Design",
        WorkflowPhase::Solutioning,
        "Design system architecture",
    )
    .with_step(
        WorkflowStep::new(
            "context",
            "System Context",
            "Define system boundaries",
            "architect",
        )
        .with_actions(vec![
            "Identify external systems".to_string(),
            "Define integration points".to_string(),
            "Document data flows".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "containers",
            "Container Design",
            "Design high-level components",
            "architect",
        )
        .with_actions(vec![
            "Identify containers".to_string(),
            "Define responsibilities".to_string(),
            "Plan communication".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "components",
            "Component Design",
            "Design internal components",
            "architect",
        )
        .with_actions(vec![
            "Break down containers".to_string(),
            "Define interfaces".to_string(),
            "Plan dependencies".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "decisions",
            "Architecture Decisions",
            "Document ADRs",
            "architect",
        )
        .with_actions(vec![
            "Document key decisions".to_string(),
            "Explain rationale".to_string(),
            "Note alternatives considered".to_string(),
        ])
        .as_checkpoint(),
    )
    .as_builtin()
}

pub fn epics_and_stories() -> Workflow {
    Workflow::new(
        "epics-and-stories",
        "Epics and Stories",
        WorkflowPhase::Solutioning,
        "Break down work into epics and user stories",
    )
    .with_step(
        WorkflowStep::new("epics", "Define Epics", "Create high-level epics", "pm").with_actions(
            vec![
                "Identify major features".to_string(),
                "Group related functionality".to_string(),
                "Prioritize epics".to_string(),
            ],
        ),
    )
    .with_step(
        WorkflowStep::new(
            "stories",
            "Write User Stories",
            "Break epics into stories",
            "pm",
        )
        .with_actions(vec![
            "Write user stories".to_string(),
            "Define acceptance criteria".to_string(),
            "Estimate complexity".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "refine",
            "Refine Backlog",
            "Groom and prioritize",
            "scrum-master",
        )
        .with_actions(vec![
            "Review with team".to_string(),
            "Clarify requirements".to_string(),
            "Update estimates".to_string(),
        ])
        .as_checkpoint(),
    )
    .as_builtin()
}

pub fn implementation_readiness() -> Workflow {
    Workflow::new(
        "implementation-readiness",
        "Implementation Readiness",
        WorkflowPhase::Solutioning,
        "Ensure team is ready to implement",
    )
    .with_step(
        WorkflowStep::new(
            "checklist",
            "Readiness Checklist",
            "Verify prerequisites",
            "scrum-master",
        )
        .with_actions(vec![
            "Check requirements clarity".to_string(),
            "Verify design completeness".to_string(),
            "Confirm resource availability".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "environment",
            "Environment Setup",
            "Prepare development environment",
            "devops",
        )
        .with_actions(vec![
            "Set up repositories".to_string(),
            "Configure CI/CD".to_string(),
            "Prepare test environments".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "kickoff",
            "Sprint Kickoff",
            "Start implementation",
            "scrum-master",
        )
        .with_actions(vec![
            "Review sprint goals".to_string(),
            "Assign initial tasks".to_string(),
            "Set communication cadence".to_string(),
        ])
        .as_checkpoint(),
    )
    .as_builtin()
}

pub fn data_model() -> Workflow {
    Workflow::new(
        "data-model",
        "Data Model Design",
        WorkflowPhase::Solutioning,
        "Design database schema and data model",
    )
    .with_step(
        WorkflowStep::new(
            "entities",
            "Define Entities",
            "Identify data entities",
            "data-engineer",
        )
        .with_actions(vec![
            "List entities".to_string(),
            "Define attributes".to_string(),
            "Identify relationships".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "schema",
            "Design Schema",
            "Create database schema",
            "data-engineer",
        )
        .with_actions(vec![
            "Design tables".to_string(),
            "Define indexes".to_string(),
            "Plan partitioning".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "migration",
            "Migration Strategy",
            "Plan data migration",
            "data-engineer",
        )
        .with_actions(vec![
            "Design migration scripts".to_string(),
            "Plan rollback strategy".to_string(),
            "Test migration".to_string(),
        ])
        .as_checkpoint(),
    )
    .as_builtin()
}

// ============ Implementation Phase ============

pub fn sprint_planning() -> Workflow {
    Workflow::new(
        "sprint-planning",
        "Sprint Planning",
        WorkflowPhase::Implementation,
        "Plan sprint work and commitments",
    )
    .with_step(
        WorkflowStep::new(
            "review-backlog",
            "Review Backlog",
            "Review prioritized backlog",
            "scrum-master",
        )
        .with_actions(vec![
            "Review sprint goal".to_string(),
            "Discuss top priorities".to_string(),
            "Clarify requirements".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "capacity",
            "Assess Capacity",
            "Determine team capacity",
            "scrum-master",
        )
        .with_actions(vec![
            "Calculate available hours".to_string(),
            "Account for meetings".to_string(),
            "Consider PTO".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "commit",
            "Sprint Commitment",
            "Commit to sprint work",
            "scrum-master",
        )
        .with_actions(vec![
            "Select stories".to_string(),
            "Break into tasks".to_string(),
            "Confirm commitment".to_string(),
        ])
        .as_checkpoint(),
    )
    .as_builtin()
}

pub fn dev_story() -> Workflow {
    Workflow::new(
        "dev-story",
        "Development Story",
        WorkflowPhase::Implementation,
        "Implement a user story",
    )
    .with_step(
        WorkflowStep::new(
            "understand",
            "Understand Story",
            "Review requirements",
            "developer",
        )
        .with_actions(vec![
            "Read acceptance criteria".to_string(),
            "Ask clarifying questions".to_string(),
            "Plan approach".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new("implement", "Implement", "Write code", "developer").with_actions(vec![
            "Create feature branch".to_string(),
            "Write implementation".to_string(),
            "Write tests".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new("test", "Test", "Verify implementation", "developer").with_actions(vec![
            "Run unit tests".to_string(),
            "Manual testing".to_string(),
            "Fix issues".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new("pr", "Create PR", "Submit for review", "developer")
            .with_actions(vec![
                "Create pull request".to_string(),
                "Add description".to_string(),
                "Request review".to_string(),
            ])
            .as_checkpoint(),
    )
    .as_builtin()
}

pub fn code_review() -> Workflow {
    Workflow::new(
        "code-review",
        "Code Review",
        WorkflowPhase::Implementation,
        "Review code changes",
    )
    .with_step(
        WorkflowStep::new(
            "context",
            "Understand Context",
            "Review PR description",
            "reviewer",
        )
        .with_actions(vec![
            "Read PR description".to_string(),
            "Check linked issues".to_string(),
            "Understand goal".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new("review", "Review Code", "Examine changes", "reviewer").with_actions(
            vec![
                "Check correctness".to_string(),
                "Check security".to_string(),
                "Check performance".to_string(),
                "Check readability".to_string(),
            ],
        ),
    )
    .with_step(
        WorkflowStep::new(
            "feedback",
            "Provide Feedback",
            "Give constructive feedback",
            "reviewer",
        )
        .with_actions(vec![
            "Praise good patterns".to_string(),
            "Suggest improvements".to_string(),
            "Approve or request changes".to_string(),
        ])
        .as_checkpoint(),
    )
    .as_builtin()
}

pub fn retrospective() -> Workflow {
    Workflow::new(
        "retrospective",
        "Sprint Retrospective",
        WorkflowPhase::Implementation,
        "Reflect on sprint and improve",
    )
    .with_step(
        WorkflowStep::new(
            "gather",
            "Gather Feedback",
            "Collect team input",
            "scrum-master",
        )
        .with_actions(vec![
            "What went well".to_string(),
            "What didn't go well".to_string(),
            "What to improve".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new("discuss", "Discuss", "Analyze feedback", "scrum-master").with_actions(
            vec![
                "Group similar items".to_string(),
                "Identify root causes".to_string(),
                "Prioritize issues".to_string(),
            ],
        ),
    )
    .with_step(
        WorkflowStep::new(
            "actions",
            "Define Actions",
            "Create improvement actions",
            "scrum-master",
        )
        .with_actions(vec![
            "Define action items".to_string(),
            "Assign owners".to_string(),
            "Set deadlines".to_string(),
        ])
        .as_checkpoint(),
    )
    .as_builtin()
}

pub fn sprint_status() -> Workflow {
    Workflow::new(
        "sprint-status",
        "Sprint Status",
        WorkflowPhase::Implementation,
        "Report sprint progress",
    )
    .with_step(
        WorkflowStep::new(
            "metrics",
            "Gather Metrics",
            "Collect sprint data",
            "scrum-master",
        )
        .with_actions(vec![
            "Calculate velocity".to_string(),
            "Track burndown".to_string(),
            "Note blockers".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "report",
            "Create Report",
            "Summarize status",
            "scrum-master",
        )
        .with_actions(vec![
            "Write summary".to_string(),
            "Highlight risks".to_string(),
            "Note achievements".to_string(),
        ])
        .as_checkpoint(),
    )
    .as_builtin()
}

// ============ Quick Flow ============

pub fn quick_bug_fix() -> Workflow {
    Workflow::new(
        "quick-bug-fix",
        "Quick Bug Fix",
        WorkflowPhase::QuickFlow,
        "Rapidly fix a bug",
    )
    .with_step(
        WorkflowStep::new("reproduce", "Reproduce", "Confirm the bug", "developer").with_actions(
            vec![
                "Read bug report".to_string(),
                "Reproduce issue".to_string(),
                "Identify root cause".to_string(),
            ],
        ),
    )
    .with_step(
        WorkflowStep::new("fix", "Fix", "Implement fix", "developer").with_actions(vec![
            "Write failing test".to_string(),
            "Implement fix".to_string(),
            "Verify test passes".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new("verify", "Verify", "Confirm fix works", "developer")
            .with_actions(vec![
                "Run all tests".to_string(),
                "Manual verification".to_string(),
                "Create PR".to_string(),
            ])
            .as_checkpoint(),
    )
    .as_builtin()
}

pub fn quick_feature() -> Workflow {
    Workflow::new(
        "quick-feature",
        "Quick Feature",
        WorkflowPhase::QuickFlow,
        "Rapidly implement a small feature",
    )
    .with_step(
        WorkflowStep::new(
            "understand",
            "Understand",
            "Clarify requirements",
            "developer",
        )
        .with_actions(vec![
            "Review requirements".to_string(),
            "Ask questions".to_string(),
            "Plan approach".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new("implement", "Implement", "Build feature", "developer").with_actions(
            vec![
                "Write code".to_string(),
                "Write tests".to_string(),
                "Update docs".to_string(),
            ],
        ),
    )
    .with_step(
        WorkflowStep::new("ship", "Ship", "Deploy feature", "developer")
            .with_actions(vec![
                "Create PR".to_string(),
                "Get review".to_string(),
                "Merge and deploy".to_string(),
            ])
            .as_checkpoint(),
    )
    .as_builtin()
}

pub fn quick_refactor() -> Workflow {
    Workflow::new(
        "quick-refactor",
        "Quick Refactor",
        WorkflowPhase::QuickFlow,
        "Safely refactor code",
    )
    .with_step(
        WorkflowStep::new("tests", "Ensure Tests", "Verify test coverage", "developer")
            .with_actions(vec![
                "Check coverage".to_string(),
                "Add missing tests".to_string(),
                "Run baseline".to_string(),
            ]),
    )
    .with_step(
        WorkflowStep::new("refactor", "Refactor", "Make changes", "developer").with_actions(vec![
            "Small incremental changes".to_string(),
            "Run tests after each".to_string(),
            "Commit frequently".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "verify",
            "Verify",
            "Confirm behavior unchanged",
            "developer",
        )
        .with_actions(vec![
            "Run all tests".to_string(),
            "Compare before/after".to_string(),
            "Create PR".to_string(),
        ])
        .as_checkpoint(),
    )
    .as_builtin()
}

// ============ Testing ============

pub fn test_design() -> Workflow {
    Workflow::new(
        "test-design",
        "Test Design",
        WorkflowPhase::Testing,
        "Design test strategy and cases",
    )
    .with_step(
        WorkflowStep::new(
            "strategy",
            "Test Strategy",
            "Define testing approach",
            "test-architect",
        )
        .with_actions(vec![
            "Define test levels".to_string(),
            "Identify test types".to_string(),
            "Plan coverage".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new("cases", "Test Cases", "Write test cases", "test-architect")
            .with_actions(vec![
                "Write test scenarios".to_string(),
                "Define test data".to_string(),
                "Prioritize tests".to_string(),
            ])
            .as_checkpoint(),
    )
    .as_builtin()
}

pub fn test_automation() -> Workflow {
    Workflow::new(
        "test-automation",
        "Test Automation",
        WorkflowPhase::Testing,
        "Automate test execution",
    )
    .with_step(
        WorkflowStep::new(
            "framework",
            "Setup Framework",
            "Configure test framework",
            "test-architect",
        )
        .with_actions(vec![
            "Select framework".to_string(),
            "Configure environment".to_string(),
            "Set up CI integration".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "implement",
            "Implement Tests",
            "Write automated tests",
            "developer",
        )
        .with_actions(vec![
            "Write unit tests".to_string(),
            "Write integration tests".to_string(),
            "Write e2e tests".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "maintain",
            "Maintain",
            "Keep tests healthy",
            "test-architect",
        )
        .with_actions(vec![
            "Fix flaky tests".to_string(),
            "Update test data".to_string(),
            "Improve coverage".to_string(),
        ])
        .as_checkpoint(),
    )
    .as_builtin()
}

pub fn test_review() -> Workflow {
    Workflow::new(
        "test-review",
        "Test Review",
        WorkflowPhase::Testing,
        "Review test quality and coverage",
    )
    .with_step(
        WorkflowStep::new(
            "coverage",
            "Review Coverage",
            "Analyze test coverage",
            "test-architect",
        )
        .with_actions(vec![
            "Generate coverage report".to_string(),
            "Identify gaps".to_string(),
            "Prioritize additions".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "quality",
            "Review Quality",
            "Assess test quality",
            "test-architect",
        )
        .with_actions(vec![
            "Check test isolation".to_string(),
            "Review assertions".to_string(),
            "Identify improvements".to_string(),
        ])
        .as_checkpoint(),
    )
    .as_builtin()
}

// ============ Documentation ============

pub fn document_project() -> Workflow {
    Workflow::new(
        "document-project",
        "Document Project",
        WorkflowPhase::Documentation,
        "Create project documentation",
    )
    .with_step(
        WorkflowStep::new("readme", "README", "Write project README", "tech-writer").with_actions(
            vec![
                "Write overview".to_string(),
                "Add installation".to_string(),
                "Include examples".to_string(),
            ],
        ),
    )
    .with_step(
        WorkflowStep::new(
            "guides",
            "User Guides",
            "Write user documentation",
            "tech-writer",
        )
        .with_actions(vec![
            "Write getting started".to_string(),
            "Document features".to_string(),
            "Add tutorials".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "reference",
            "Reference",
            "Write reference docs",
            "tech-writer",
        )
        .with_actions(vec![
            "Document APIs".to_string(),
            "Add configuration".to_string(),
            "Include troubleshooting".to_string(),
        ])
        .as_checkpoint(),
    )
    .as_builtin()
}

pub fn api_documentation() -> Workflow {
    Workflow::new(
        "api-documentation",
        "API Documentation",
        WorkflowPhase::Documentation,
        "Document API endpoints",
    )
    .with_step(
        WorkflowStep::new("spec", "API Spec", "Write OpenAPI spec", "tech-writer").with_actions(
            vec![
                "Document endpoints".to_string(),
                "Define schemas".to_string(),
                "Add examples".to_string(),
            ],
        ),
    )
    .with_step(
        WorkflowStep::new(
            "generate",
            "Generate Docs",
            "Generate documentation",
            "tech-writer",
        )
        .with_actions(vec![
            "Generate from spec".to_string(),
            "Add descriptions".to_string(),
            "Include code samples".to_string(),
        ])
        .as_checkpoint(),
    )
    .as_builtin()
}

// ============ DevOps ============

pub fn ci_setup() -> Workflow {
    Workflow::new(
        "ci-setup",
        "CI Setup",
        WorkflowPhase::DevOps,
        "Set up continuous integration",
    )
    .with_step(
        WorkflowStep::new(
            "pipeline",
            "Define Pipeline",
            "Create CI pipeline",
            "devops",
        )
        .with_actions(vec![
            "Define stages".to_string(),
            "Configure triggers".to_string(),
            "Set up caching".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new("quality", "Quality Gates", "Add quality checks", "devops").with_actions(
            vec![
                "Add linting".to_string(),
                "Add testing".to_string(),
                "Add security scans".to_string(),
            ],
        ),
    )
    .with_step(
        WorkflowStep::new("artifacts", "Artifacts", "Configure artifacts", "devops")
            .with_actions(vec![
                "Build artifacts".to_string(),
                "Store artifacts".to_string(),
                "Version artifacts".to_string(),
            ])
            .as_checkpoint(),
    )
    .as_builtin()
}

pub fn deployment() -> Workflow {
    Workflow::new(
        "deployment",
        "Deployment",
        WorkflowPhase::DevOps,
        "Deploy to production",
    )
    .with_step(
        WorkflowStep::new("prepare", "Prepare", "Prepare for deployment", "devops").with_actions(
            vec![
                "Verify build".to_string(),
                "Check dependencies".to_string(),
                "Review changes".to_string(),
            ],
        ),
    )
    .with_step(
        WorkflowStep::new("deploy", "Deploy", "Execute deployment", "devops").with_actions(vec![
            "Deploy to staging".to_string(),
            "Run smoke tests".to_string(),
            "Deploy to production".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new("verify", "Verify", "Verify deployment", "devops")
            .with_actions(vec![
                "Check health".to_string(),
                "Monitor metrics".to_string(),
                "Confirm success".to_string(),
            ])
            .as_checkpoint(),
    )
    .as_builtin()
}

// ============ Additional ============

pub fn security_review() -> Workflow {
    Workflow::new(
        "security-review",
        "Security Review",
        WorkflowPhase::Implementation,
        "Review code for security issues",
    )
    .with_step(
        WorkflowStep::new("scan", "Security Scan", "Run security scanners", "security")
            .with_actions(vec![
                "Run SAST".to_string(),
                "Run dependency scan".to_string(),
                "Check secrets".to_string(),
            ]),
    )
    .with_step(
        WorkflowStep::new("review", "Manual Review", "Review findings", "security").with_actions(
            vec![
                "Triage findings".to_string(),
                "Verify vulnerabilities".to_string(),
                "Prioritize fixes".to_string(),
            ],
        ),
    )
    .with_step(
        WorkflowStep::new("remediate", "Remediate", "Fix issues", "developer")
            .with_actions(vec![
                "Fix vulnerabilities".to_string(),
                "Update dependencies".to_string(),
                "Verify fixes".to_string(),
            ])
            .as_checkpoint(),
    )
    .as_builtin()
}

pub fn performance_review() -> Workflow {
    Workflow::new(
        "performance-review",
        "Performance Review",
        WorkflowPhase::Implementation,
        "Review and optimize performance",
    )
    .with_step(
        WorkflowStep::new("profile", "Profile", "Profile application", "performance").with_actions(
            vec![
                "Run profiler".to_string(),
                "Identify hotspots".to_string(),
                "Measure baselines".to_string(),
            ],
        ),
    )
    .with_step(
        WorkflowStep::new(
            "optimize",
            "Optimize",
            "Implement optimizations",
            "performance",
        )
        .with_actions(vec![
            "Optimize algorithms".to_string(),
            "Reduce allocations".to_string(),
            "Improve caching".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new("verify", "Verify", "Verify improvements", "performance")
            .with_actions(vec![
                "Run benchmarks".to_string(),
                "Compare results".to_string(),
                "Document changes".to_string(),
            ])
            .as_checkpoint(),
    )
    .as_builtin()
}

pub fn onboarding() -> Workflow {
    Workflow::new(
        "onboarding",
        "Developer Onboarding",
        WorkflowPhase::Documentation,
        "Onboard new team members",
    )
    .with_step(
        WorkflowStep::new(
            "setup",
            "Environment Setup",
            "Set up development environment",
            "mentor",
        )
        .with_actions(vec![
            "Install tools".to_string(),
            "Clone repositories".to_string(),
            "Configure IDE".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "overview",
            "Project Overview",
            "Learn the codebase",
            "mentor",
        )
        .with_actions(vec![
            "Architecture overview".to_string(),
            "Key components".to_string(),
            "Development workflow".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "first-task",
            "First Task",
            "Complete first contribution",
            "mentor",
        )
        .with_actions(vec![
            "Pick starter task".to_string(),
            "Implement with guidance".to_string(),
            "Submit PR".to_string(),
        ])
        .as_checkpoint(),
    )
    .as_builtin()
}

pub fn tech_debt() -> Workflow {
    Workflow::new(
        "tech-debt",
        "Tech Debt Reduction",
        WorkflowPhase::Implementation,
        "Address technical debt",
    )
    .with_step(
        WorkflowStep::new(
            "identify",
            "Identify Debt",
            "Find technical debt",
            "architect",
        )
        .with_actions(vec![
            "Review code quality".to_string(),
            "Check dependencies".to_string(),
            "Assess architecture".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new("prioritize", "Prioritize", "Rank debt items", "architect").with_actions(
            vec![
                "Assess impact".to_string(),
                "Estimate effort".to_string(),
                "Create backlog".to_string(),
            ],
        ),
    )
    .with_step(
        WorkflowStep::new("address", "Address Debt", "Fix debt items", "developer")
            .with_actions(vec![
                "Refactor code".to_string(),
                "Update dependencies".to_string(),
                "Improve tests".to_string(),
            ])
            .as_checkpoint(),
    )
    .as_builtin()
}

pub fn migration() -> Workflow {
    Workflow::new(
        "migration",
        "System Migration",
        WorkflowPhase::Implementation,
        "Migrate to new system or version",
    )
    .with_step(
        WorkflowStep::new(
            "plan",
            "Plan Migration",
            "Create migration plan",
            "architect",
        )
        .with_actions(vec![
            "Assess current state".to_string(),
            "Define target state".to_string(),
            "Plan phases".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "execute",
            "Execute Migration",
            "Perform migration",
            "developer",
        )
        .with_actions(vec![
            "Migrate data".to_string(),
            "Update code".to_string(),
            "Test thoroughly".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "validate",
            "Validate",
            "Verify migration success",
            "test-architect",
        )
        .with_actions(vec![
            "Run validation tests".to_string(),
            "Compare data".to_string(),
            "Confirm functionality".to_string(),
        ])
        .as_checkpoint(),
    )
    .as_builtin()
}

pub fn incident_response() -> Workflow {
    Workflow::new(
        "incident-response",
        "Incident Response",
        WorkflowPhase::DevOps,
        "Respond to production incidents",
    )
    .with_step(
        WorkflowStep::new("triage", "Triage", "Assess incident severity", "devops").with_actions(
            vec![
                "Identify impact".to_string(),
                "Assign severity".to_string(),
                "Notify stakeholders".to_string(),
            ],
        ),
    )
    .with_step(
        WorkflowStep::new("mitigate", "Mitigate", "Reduce impact", "devops").with_actions(vec![
            "Implement workaround".to_string(),
            "Scale resources".to_string(),
            "Communicate status".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new("resolve", "Resolve", "Fix root cause", "developer").with_actions(vec![
            "Identify root cause".to_string(),
            "Implement fix".to_string(),
            "Deploy fix".to_string(),
        ]),
    )
    .with_step(
        WorkflowStep::new(
            "postmortem",
            "Postmortem",
            "Learn from incident",
            "scrum-master",
        )
        .with_actions(vec![
            "Document timeline".to_string(),
            "Identify improvements".to_string(),
            "Create action items".to_string(),
        ])
        .as_checkpoint(),
    )
    .as_builtin()
}

pub fn release_planning() -> Workflow {
    Workflow::new(
        "release-planning",
        "Release Planning",
        WorkflowPhase::Planning,
        "Plan product release",
    )
    .with_step(
        WorkflowStep::new("scope", "Define Scope", "Determine release scope", "pm").with_actions(
            vec![
                "Review backlog".to_string(),
                "Select features".to_string(),
                "Define milestones".to_string(),
            ],
        ),
    )
    .with_step(
        WorkflowStep::new("schedule", "Create Schedule", "Plan release timeline", "pm")
            .with_actions(vec![
                "Set release date".to_string(),
                "Plan sprints".to_string(),
                "Identify dependencies".to_string(),
            ]),
    )
    .with_step(
        WorkflowStep::new("communicate", "Communicate", "Share release plan", "pm")
            .with_actions(vec![
                "Create release notes".to_string(),
                "Notify stakeholders".to_string(),
                "Update roadmap".to_string(),
            ])
            .as_checkpoint(),
    )
    .as_builtin()
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_all_workflows_count() {
        let workflows = all_workflows();
        assert!(
            workflows.len() >= 30,
            "Expected at least 30 workflows, got {}",
            workflows.len()
        );
    }

    #[test]
    fn test_all_workflows_have_unique_ids() {
        let workflows = all_workflows();
        let mut ids: Vec<&str> = workflows.iter().map(|w| w.id.as_str()).collect();
        ids.sort();
        let original_len = ids.len();
        ids.dedup();
        assert_eq!(ids.len(), original_len, "Duplicate workflow IDs found");
    }

    #[test]
    fn test_all_workflows_are_builtin() {
        let workflows = all_workflows();
        for workflow in workflows {
            assert!(
                workflow.builtin,
                "Workflow {} should be marked as builtin",
                workflow.id
            );
        }
    }

    #[test]
    fn test_all_workflows_have_steps() {
        let workflows = all_workflows();
        for workflow in workflows {
            assert!(
                !workflow.steps.is_empty(),
                "Workflow {} has no steps",
                workflow.id
            );
        }
    }

    #[test]
    fn test_all_workflows_have_checkpoints() {
        let workflows = all_workflows();
        for workflow in workflows {
            assert!(
                !workflow.checkpoints.is_empty(),
                "Workflow {} has no checkpoints",
                workflow.id
            );
        }
    }
}