tech-hub-skills 1.5.1 → 1.5.2

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 (197) hide show
  1. package/.claude/LICENSE +21 -21
  2. package/.claude/README.md +291 -291
  3. package/.claude/bin/cli.js +266 -266
  4. package/.claude/bin/copilot.js +182 -182
  5. package/.claude/bin/postinstall.js +42 -42
  6. package/.claude/commands/README.md +336 -336
  7. package/.claude/commands/ai-engineer.md +104 -104
  8. package/.claude/commands/aws.md +143 -143
  9. package/.claude/commands/azure.md +149 -149
  10. package/.claude/commands/backend-developer.md +108 -108
  11. package/.claude/commands/code-review.md +399 -399
  12. package/.claude/commands/compliance-automation.md +747 -747
  13. package/.claude/commands/compliance-officer.md +108 -108
  14. package/.claude/commands/data-engineer.md +113 -113
  15. package/.claude/commands/data-governance.md +102 -102
  16. package/.claude/commands/data-scientist.md +123 -123
  17. package/.claude/commands/database-admin.md +109 -109
  18. package/.claude/commands/devops.md +160 -160
  19. package/.claude/commands/docker.md +160 -160
  20. package/.claude/commands/enterprise-dashboard.md +613 -613
  21. package/.claude/commands/finops.md +184 -184
  22. package/.claude/commands/frontend-developer.md +108 -108
  23. package/.claude/commands/gcp.md +143 -143
  24. package/.claude/commands/ml-engineer.md +115 -115
  25. package/.claude/commands/mlops.md +187 -187
  26. package/.claude/commands/network-engineer.md +109 -109
  27. package/.claude/commands/optimization-advisor.md +329 -329
  28. package/.claude/commands/orchestrator.md +623 -623
  29. package/.claude/commands/platform-engineer.md +102 -102
  30. package/.claude/commands/process-automation.md +226 -226
  31. package/.claude/commands/process-changelog.md +184 -184
  32. package/.claude/commands/process-documentation.md +484 -484
  33. package/.claude/commands/process-kanban.md +324 -324
  34. package/.claude/commands/process-versioning.md +214 -214
  35. package/.claude/commands/product-designer.md +104 -104
  36. package/.claude/commands/project-starter.md +443 -443
  37. package/.claude/commands/qa-engineer.md +109 -109
  38. package/.claude/commands/security-architect.md +135 -135
  39. package/.claude/commands/sre.md +109 -109
  40. package/.claude/commands/system-design.md +126 -126
  41. package/.claude/commands/technical-writer.md +101 -101
  42. package/.claude/package.json +46 -46
  43. package/.claude/roles/ai-engineer/skills/01-prompt-engineering/README.md +252 -252
  44. package/.claude/roles/ai-engineer/skills/01-prompt-engineering/prompt_ab_tester.py +356 -356
  45. package/.claude/roles/ai-engineer/skills/01-prompt-engineering/prompt_template_manager.py +274 -274
  46. package/.claude/roles/ai-engineer/skills/01-prompt-engineering/token_cost_estimator.py +324 -324
  47. package/.claude/roles/ai-engineer/skills/02-rag-pipeline/README.md +448 -448
  48. package/.claude/roles/ai-engineer/skills/02-rag-pipeline/document_chunker.py +336 -336
  49. package/.claude/roles/ai-engineer/skills/02-rag-pipeline/rag_pipeline.sql +213 -213
  50. package/.claude/roles/ai-engineer/skills/03-agent-orchestration/README.md +599 -599
  51. package/.claude/roles/ai-engineer/skills/04-llm-guardrails/README.md +735 -735
  52. package/.claude/roles/ai-engineer/skills/05-vector-embeddings/README.md +711 -711
  53. package/.claude/roles/ai-engineer/skills/06-llm-evaluation/README.md +777 -777
  54. package/.claude/roles/azure/skills/01-infrastructure-fundamentals/README.md +264 -264
  55. package/.claude/roles/azure/skills/02-data-factory/README.md +264 -264
  56. package/.claude/roles/azure/skills/03-synapse-analytics/README.md +264 -264
  57. package/.claude/roles/azure/skills/04-databricks/README.md +264 -264
  58. package/.claude/roles/azure/skills/05-functions/README.md +264 -264
  59. package/.claude/roles/azure/skills/06-kubernetes-service/README.md +264 -264
  60. package/.claude/roles/azure/skills/07-openai-service/README.md +264 -264
  61. package/.claude/roles/azure/skills/08-machine-learning/README.md +264 -264
  62. package/.claude/roles/azure/skills/09-storage-adls/README.md +264 -264
  63. package/.claude/roles/azure/skills/10-networking/README.md +264 -264
  64. package/.claude/roles/azure/skills/11-sql-cosmos/README.md +264 -264
  65. package/.claude/roles/azure/skills/12-event-hubs/README.md +264 -264
  66. package/.claude/roles/code-review/skills/01-automated-code-review/README.md +394 -394
  67. package/.claude/roles/code-review/skills/02-pr-review-workflow/README.md +427 -427
  68. package/.claude/roles/code-review/skills/03-code-quality-gates/README.md +518 -518
  69. package/.claude/roles/code-review/skills/04-reviewer-assignment/README.md +504 -504
  70. package/.claude/roles/code-review/skills/05-review-analytics/README.md +540 -540
  71. package/.claude/roles/data-engineer/skills/01-lakehouse-architecture/README.md +550 -550
  72. package/.claude/roles/data-engineer/skills/01-lakehouse-architecture/bronze_ingestion.py +337 -337
  73. package/.claude/roles/data-engineer/skills/01-lakehouse-architecture/medallion_queries.sql +300 -300
  74. package/.claude/roles/data-engineer/skills/02-etl-pipeline/README.md +580 -580
  75. package/.claude/roles/data-engineer/skills/03-data-quality/README.md +579 -579
  76. package/.claude/roles/data-engineer/skills/04-streaming-pipelines/README.md +608 -608
  77. package/.claude/roles/data-engineer/skills/05-performance-optimization/README.md +547 -547
  78. package/.claude/roles/data-governance/skills/01-data-catalog/README.md +112 -112
  79. package/.claude/roles/data-governance/skills/02-data-lineage/README.md +129 -129
  80. package/.claude/roles/data-governance/skills/03-data-quality-framework/README.md +182 -182
  81. package/.claude/roles/data-governance/skills/04-access-control/README.md +39 -39
  82. package/.claude/roles/data-governance/skills/05-master-data-management/README.md +40 -40
  83. package/.claude/roles/data-governance/skills/06-compliance-privacy/README.md +46 -46
  84. package/.claude/roles/data-scientist/skills/01-eda-automation/README.md +230 -230
  85. package/.claude/roles/data-scientist/skills/01-eda-automation/eda_generator.py +446 -446
  86. package/.claude/roles/data-scientist/skills/02-statistical-modeling/README.md +264 -264
  87. package/.claude/roles/data-scientist/skills/03-feature-engineering/README.md +264 -264
  88. package/.claude/roles/data-scientist/skills/04-predictive-modeling/README.md +264 -264
  89. package/.claude/roles/data-scientist/skills/05-customer-analytics/README.md +264 -264
  90. package/.claude/roles/data-scientist/skills/06-campaign-analysis/README.md +264 -264
  91. package/.claude/roles/data-scientist/skills/07-experimentation/README.md +264 -264
  92. package/.claude/roles/data-scientist/skills/08-data-visualization/README.md +264 -264
  93. package/.claude/roles/devops/skills/01-cicd-pipeline/README.md +264 -264
  94. package/.claude/roles/devops/skills/02-container-orchestration/README.md +264 -264
  95. package/.claude/roles/devops/skills/03-infrastructure-as-code/README.md +264 -264
  96. package/.claude/roles/devops/skills/04-gitops/README.md +264 -264
  97. package/.claude/roles/devops/skills/05-environment-management/README.md +264 -264
  98. package/.claude/roles/devops/skills/06-automated-testing/README.md +264 -264
  99. package/.claude/roles/devops/skills/07-release-management/README.md +264 -264
  100. package/.claude/roles/devops/skills/08-monitoring-alerting/README.md +264 -264
  101. package/.claude/roles/devops/skills/09-devsecops/README.md +265 -265
  102. package/.claude/roles/finops/skills/01-cost-visibility/README.md +264 -264
  103. package/.claude/roles/finops/skills/02-resource-tagging/README.md +264 -264
  104. package/.claude/roles/finops/skills/03-budget-management/README.md +264 -264
  105. package/.claude/roles/finops/skills/04-reserved-instances/README.md +264 -264
  106. package/.claude/roles/finops/skills/05-spot-optimization/README.md +264 -264
  107. package/.claude/roles/finops/skills/06-storage-tiering/README.md +264 -264
  108. package/.claude/roles/finops/skills/07-compute-rightsizing/README.md +264 -264
  109. package/.claude/roles/finops/skills/08-chargeback/README.md +264 -264
  110. package/.claude/roles/ml-engineer/skills/01-mlops-pipeline/README.md +566 -566
  111. package/.claude/roles/ml-engineer/skills/02-feature-engineering/README.md +655 -655
  112. package/.claude/roles/ml-engineer/skills/03-model-training/README.md +704 -704
  113. package/.claude/roles/ml-engineer/skills/04-model-serving/README.md +845 -845
  114. package/.claude/roles/ml-engineer/skills/05-model-monitoring/README.md +874 -874
  115. package/.claude/roles/mlops/skills/01-ml-pipeline-orchestration/README.md +264 -264
  116. package/.claude/roles/mlops/skills/02-experiment-tracking/README.md +264 -264
  117. package/.claude/roles/mlops/skills/03-model-registry/README.md +264 -264
  118. package/.claude/roles/mlops/skills/04-feature-store/README.md +264 -264
  119. package/.claude/roles/mlops/skills/05-model-deployment/README.md +264 -264
  120. package/.claude/roles/mlops/skills/06-model-observability/README.md +264 -264
  121. package/.claude/roles/mlops/skills/07-data-versioning/README.md +264 -264
  122. package/.claude/roles/mlops/skills/08-ab-testing/README.md +264 -264
  123. package/.claude/roles/mlops/skills/09-automated-retraining/README.md +264 -264
  124. package/.claude/roles/platform-engineer/skills/01-internal-developer-platform/README.md +153 -153
  125. package/.claude/roles/platform-engineer/skills/02-self-service-infrastructure/README.md +57 -57
  126. package/.claude/roles/platform-engineer/skills/03-slo-sli-management/README.md +59 -59
  127. package/.claude/roles/platform-engineer/skills/04-developer-experience/README.md +57 -57
  128. package/.claude/roles/platform-engineer/skills/05-incident-management/README.md +73 -73
  129. package/.claude/roles/platform-engineer/skills/06-capacity-management/README.md +59 -59
  130. package/.claude/roles/product-designer/skills/01-requirements-discovery/README.md +407 -407
  131. package/.claude/roles/product-designer/skills/02-user-research/README.md +382 -382
  132. package/.claude/roles/product-designer/skills/03-brainstorming-ideation/README.md +437 -437
  133. package/.claude/roles/product-designer/skills/04-ux-design/README.md +496 -496
  134. package/.claude/roles/product-designer/skills/05-product-market-fit/README.md +376 -376
  135. package/.claude/roles/product-designer/skills/06-stakeholder-management/README.md +412 -412
  136. package/.claude/roles/security-architect/skills/01-pii-detection/README.md +319 -319
  137. package/.claude/roles/security-architect/skills/02-threat-modeling/README.md +264 -264
  138. package/.claude/roles/security-architect/skills/03-infrastructure-security/README.md +264 -264
  139. package/.claude/roles/security-architect/skills/04-iam/README.md +264 -264
  140. package/.claude/roles/security-architect/skills/05-application-security/README.md +264 -264
  141. package/.claude/roles/security-architect/skills/06-secrets-management/README.md +264 -264
  142. package/.claude/roles/security-architect/skills/07-security-monitoring/README.md +264 -264
  143. package/.claude/roles/system-design/skills/01-architecture-patterns/README.md +337 -337
  144. package/.claude/roles/system-design/skills/02-requirements-engineering/README.md +264 -264
  145. package/.claude/roles/system-design/skills/03-scalability/README.md +264 -264
  146. package/.claude/roles/system-design/skills/04-high-availability/README.md +264 -264
  147. package/.claude/roles/system-design/skills/05-cost-optimization-design/README.md +264 -264
  148. package/.claude/roles/system-design/skills/06-api-design/README.md +264 -264
  149. package/.claude/roles/system-design/skills/07-observability-architecture/README.md +264 -264
  150. package/.claude/roles/system-design/skills/08-process-automation/PROCESS_TEMPLATE.md +336 -336
  151. package/.claude/roles/system-design/skills/08-process-automation/README.md +521 -521
  152. package/.claude/roles/system-design/skills/08-process-automation/ai_prompt_generator.py +744 -744
  153. package/.claude/roles/system-design/skills/08-process-automation/automation_recommender.py +688 -688
  154. package/.claude/roles/system-design/skills/08-process-automation/plan_generator.py +679 -679
  155. package/.claude/roles/system-design/skills/08-process-automation/process_analyzer.py +528 -528
  156. package/.claude/roles/system-design/skills/08-process-automation/process_parser.py +684 -684
  157. package/.claude/roles/system-design/skills/08-process-automation/role_matcher.py +615 -615
  158. package/.claude/skills/README.md +336 -336
  159. package/.claude/skills/ai-engineer.md +104 -104
  160. package/.claude/skills/aws.md +143 -143
  161. package/.claude/skills/azure.md +149 -149
  162. package/.claude/skills/backend-developer.md +108 -108
  163. package/.claude/skills/code-review.md +399 -399
  164. package/.claude/skills/compliance-automation.md +747 -747
  165. package/.claude/skills/compliance-officer.md +108 -108
  166. package/.claude/skills/data-engineer.md +113 -113
  167. package/.claude/skills/data-governance.md +102 -102
  168. package/.claude/skills/data-scientist.md +123 -123
  169. package/.claude/skills/database-admin.md +109 -109
  170. package/.claude/skills/devops.md +160 -160
  171. package/.claude/skills/docker.md +160 -160
  172. package/.claude/skills/enterprise-dashboard.md +613 -613
  173. package/.claude/skills/finops.md +184 -184
  174. package/.claude/skills/frontend-developer.md +108 -108
  175. package/.claude/skills/gcp.md +143 -143
  176. package/.claude/skills/ml-engineer.md +115 -115
  177. package/.claude/skills/mlops.md +187 -187
  178. package/.claude/skills/network-engineer.md +109 -109
  179. package/.claude/skills/optimization-advisor.md +329 -329
  180. package/.claude/skills/orchestrator.md +623 -623
  181. package/.claude/skills/platform-engineer.md +102 -102
  182. package/.claude/skills/process-automation.md +226 -226
  183. package/.claude/skills/process-changelog.md +184 -184
  184. package/.claude/skills/process-documentation.md +484 -484
  185. package/.claude/skills/process-kanban.md +324 -324
  186. package/.claude/skills/process-versioning.md +214 -214
  187. package/.claude/skills/product-designer.md +104 -104
  188. package/.claude/skills/project-starter.md +443 -443
  189. package/.claude/skills/qa-engineer.md +109 -109
  190. package/.claude/skills/security-architect.md +135 -135
  191. package/.claude/skills/sre.md +109 -109
  192. package/.claude/skills/system-design.md +126 -126
  193. package/.claude/skills/technical-writer.md +101 -101
  194. package/.gitattributes +2 -2
  195. package/GITHUB_COPILOT.md +106 -106
  196. package/README.md +192 -184
  197. package/package.json +16 -8
@@ -1,679 +1,679 @@
1
- """
2
- Plan Generator - Generates comprehensive automation implementation plans.
3
-
4
- Part of the Tech Hub Skills Library (sd-08: Process Automation).
5
- """
6
-
7
- from dataclasses import dataclass, field
8
- from typing import List, Dict, Optional
9
- from datetime import datetime
10
- import json
11
-
12
- from process_analyzer import ProcessAnalysis, ProcessComplexity
13
- from automation_recommender import AutomationStrategy, AutomationApproach
14
- from role_matcher import TeamComposition, RoleAssignment
15
-
16
-
17
- @dataclass
18
- class Milestone:
19
- """A project milestone."""
20
- name: str
21
- phase: int
22
- deliverables: List[str]
23
- success_criteria: List[str]
24
- dependencies: List[str] = field(default_factory=list)
25
-
26
-
27
- @dataclass
28
- class RiskMitigation:
29
- """Risk mitigation strategy."""
30
- risk: str
31
- probability: str # low, medium, high
32
- impact: str # low, medium, high
33
- mitigation: str
34
- owner: str
35
- contingency: str
36
-
37
-
38
- @dataclass
39
- class AutomationPlan:
40
- """Complete automation implementation plan."""
41
- # Header
42
- name: str
43
- version: str
44
- created_date: str
45
-
46
- # Summary
47
- executive_summary: Dict
48
-
49
- # Analysis
50
- process_analysis: Dict
51
- automation_strategy: Dict
52
- team_composition: Dict
53
-
54
- # Implementation
55
- phases: List[Dict]
56
- milestones: List[Milestone]
57
-
58
- # Risk & Governance
59
- risks: List[RiskMitigation]
60
- success_metrics: List[Dict]
61
- governance: Dict
62
-
63
- # Documentation
64
- adr_template: str
65
- prd_outline: str
66
- technical_spec_outline: str
67
-
68
- def to_markdown(self) -> str:
69
- """Convert plan to markdown document."""
70
- md = []
71
-
72
- # Title
73
- md.append(f"# Automation Plan: {self.name}")
74
- md.append(f"\n**Version**: {self.version}")
75
- md.append(f"**Created**: {self.created_date}")
76
- md.append("")
77
-
78
- # Executive Summary
79
- md.append("## Executive Summary")
80
- md.append("")
81
- summary = self.executive_summary
82
- md.append(f"- **Automation Potential**: {summary.get('automation_score', 'N/A')}/100")
83
- md.append(f"- **Complexity**: {summary.get('complexity', 'N/A')}")
84
- md.append(f"- **Estimated Effort**: {summary.get('effort_weeks', 'N/A')} weeks")
85
- md.append(f"- **Primary Approach**: {summary.get('approach', 'N/A')}")
86
- md.append(f"- **Confidence**: {summary.get('confidence', 'N/A')}%")
87
- md.append("")
88
-
89
- # Current State
90
- md.append("## Current State Analysis")
91
- md.append("")
92
- analysis = self.process_analysis
93
- md.append(f"**Process**: {analysis.get('name', 'N/A')}")
94
- md.append(f"\n{analysis.get('description', '')}")
95
- md.append("")
96
- md.append(f"- **Frequency**: {analysis.get('frequency', 'N/A')}")
97
- md.append(f"- **Total Time**: {analysis.get('total_time_minutes', 0)} minutes")
98
- md.append(f"- **Stakeholders**: {', '.join(analysis.get('stakeholders', []))}")
99
- md.append("")
100
-
101
- # Bottlenecks
102
- if analysis.get('bottlenecks'):
103
- md.append("### Identified Bottlenecks")
104
- for bn in analysis.get('bottlenecks', []):
105
- md.append(f"- {bn}")
106
- md.append("")
107
-
108
- # Team Composition
109
- md.append("## Recommended Team")
110
- md.append("")
111
- md.append("| Role | Effort | Key Skills | Primary |")
112
- md.append("|------|--------|------------|---------|")
113
- for assignment in self.team_composition.get('assignments', []):
114
- skills = ', '.join(assignment.get('skills', [])[:3])
115
- primary = "Yes" if assignment.get('is_primary') else ""
116
- md.append(f"| {assignment.get('role_name', '')} | {assignment.get('effort_pct', 0)}% | {skills} | {primary} |")
117
- md.append("")
118
-
119
- # Skill Gaps
120
- if self.team_composition.get('skill_gaps'):
121
- md.append("### Skill Gaps")
122
- for gap in self.team_composition.get('skill_gaps', []):
123
- md.append(f"- **{gap.get('area', '')}**: {gap.get('recommendation', '')}")
124
- md.append("")
125
-
126
- # Recommended Tools
127
- md.append("## Recommended Tools & Technologies")
128
- md.append("")
129
- strategy = self.automation_strategy
130
- md.append("| Tool | Category | Fit Score | Azure Service |")
131
- md.append("|------|----------|-----------|---------------|")
132
- for tool in strategy.get('recommended_tools', [])[:6]:
133
- azure = tool.get('azure_service', '-')
134
- md.append(f"| {tool.get('name', '')} | {tool.get('category', '')} | {tool.get('fit_score', 0)}% | {azure} |")
135
- md.append("")
136
-
137
- # Implementation Phases
138
- md.append("## Implementation Phases")
139
- md.append("")
140
- for phase in self.phases:
141
- md.append(f"### Phase {phase.get('phase', '')}: {phase.get('name', '')}")
142
- md.append(f"**Duration**: {phase.get('duration_weeks', '')} weeks")
143
- md.append("")
144
- md.append("**Activities**:")
145
- for activity in phase.get('activities', []):
146
- md.append(f"- {activity}")
147
- md.append("")
148
- md.append("**Deliverables**:")
149
- for deliverable in phase.get('deliverables', []):
150
- md.append(f"- {deliverable}")
151
- md.append("")
152
- md.append(f"**Skills Needed**: {', '.join(phase.get('skills_needed', []))}")
153
- md.append("")
154
-
155
- # Milestones
156
- md.append("## Key Milestones")
157
- md.append("")
158
- md.append("| Milestone | Phase | Deliverables | Success Criteria |")
159
- md.append("|-----------|-------|--------------|------------------|")
160
- for milestone in self.milestones:
161
- deliverables = "; ".join(milestone.deliverables[:2])
162
- criteria = "; ".join(milestone.success_criteria[:2])
163
- md.append(f"| {milestone.name} | {milestone.phase} | {deliverables} | {criteria} |")
164
- md.append("")
165
-
166
- # Risk Assessment
167
- md.append("## Risk Assessment")
168
- md.append("")
169
- md.append("| Risk | Probability | Impact | Mitigation | Owner |")
170
- md.append("|------|-------------|--------|------------|-------|")
171
- for risk in self.risks:
172
- md.append(f"| {risk.risk} | {risk.probability} | {risk.impact} | {risk.mitigation} | {risk.owner} |")
173
- md.append("")
174
-
175
- # Success Metrics
176
- md.append("## Success Metrics")
177
- md.append("")
178
- md.append("| Metric | Current | Target | Measurement |")
179
- md.append("|--------|---------|--------|-------------|")
180
- for metric in self.success_metrics:
181
- md.append(f"| {metric.get('name', '')} | {metric.get('current', '-')} | {metric.get('target', '')} | {metric.get('measurement', '')} |")
182
- md.append("")
183
-
184
- # Governance
185
- md.append("## Governance")
186
- md.append("")
187
- gov = self.governance
188
- md.append(f"- **Review Cadence**: {gov.get('review_cadence', 'Weekly')}")
189
- md.append(f"- **Escalation Path**: {gov.get('escalation_path', 'Project Lead → Manager → Director')}")
190
- md.append(f"- **Change Control**: {gov.get('change_control', 'ADR for significant changes')}")
191
- md.append("")
192
-
193
- # ADR Template
194
- md.append("## Appendix A: Architecture Decision Record Template")
195
- md.append("")
196
- md.append("```markdown")
197
- md.append(self.adr_template)
198
- md.append("```")
199
- md.append("")
200
-
201
- # PRD Outline
202
- md.append("## Appendix B: PRD Outline")
203
- md.append("")
204
- md.append(self.prd_outline)
205
- md.append("")
206
-
207
- return "\n".join(md)
208
-
209
- def to_dict(self) -> Dict:
210
- """Convert plan to dictionary."""
211
- return {
212
- "name": self.name,
213
- "version": self.version,
214
- "created_date": self.created_date,
215
- "executive_summary": self.executive_summary,
216
- "process_analysis": self.process_analysis,
217
- "automation_strategy": self.automation_strategy,
218
- "team_composition": self.team_composition,
219
- "phases": self.phases,
220
- "milestones": [
221
- {
222
- "name": m.name,
223
- "phase": m.phase,
224
- "deliverables": m.deliverables,
225
- "success_criteria": m.success_criteria
226
- }
227
- for m in self.milestones
228
- ],
229
- "risks": [
230
- {
231
- "risk": r.risk,
232
- "probability": r.probability,
233
- "impact": r.impact,
234
- "mitigation": r.mitigation,
235
- "owner": r.owner
236
- }
237
- for r in self.risks
238
- ],
239
- "success_metrics": self.success_metrics,
240
- "governance": self.governance
241
- }
242
-
243
- def to_json(self) -> str:
244
- """Convert plan to JSON."""
245
- return json.dumps(self.to_dict(), indent=2)
246
-
247
-
248
- class PlanGenerator:
249
- """
250
- Generates comprehensive automation implementation plans.
251
-
252
- Combines process analysis, automation strategy, and team composition
253
- into actionable implementation plans with documentation templates.
254
- """
255
-
256
- def __init__(self):
257
- """Initialize plan generator."""
258
- self.version = "1.0"
259
-
260
- def generate_plan(
261
- self,
262
- analysis: ProcessAnalysis,
263
- recommendations: AutomationStrategy,
264
- team_composition: TeamComposition,
265
- project_name: Optional[str] = None
266
- ) -> AutomationPlan:
267
- """
268
- Generate complete automation implementation plan.
269
-
270
- Args:
271
- analysis: Process analysis
272
- recommendations: Automation strategy
273
- team_composition: Team composition
274
-
275
- Returns:
276
- Complete AutomationPlan
277
- """
278
- name = project_name or f"{analysis.name} Automation"
279
-
280
- # Build executive summary
281
- executive_summary = {
282
- "automation_score": round(analysis.automation_score, 1),
283
- "complexity": analysis.complexity.value,
284
- "effort_weeks": recommendations.estimated_effort_weeks,
285
- "approach": recommendations.primary_approach.value,
286
- "confidence": recommendations.confidence_score,
287
- "roi_potential": "High" if analysis.automation_score > 70 else "Medium"
288
- }
289
-
290
- # Convert analysis to dict
291
- process_analysis = analysis.to_dict()
292
-
293
- # Convert strategy to dict
294
- automation_strategy = recommendations.to_dict()
295
-
296
- # Convert team to dict
297
- team_dict = team_composition.to_dict()
298
-
299
- # Generate milestones
300
- milestones = self._generate_milestones(recommendations.implementation_phases)
301
-
302
- # Generate risks
303
- risks = self._generate_risks(analysis, recommendations, team_composition)
304
-
305
- # Generate success metrics
306
- success_metrics = self._generate_metrics(analysis)
307
-
308
- # Generate governance
309
- governance = self._generate_governance(analysis)
310
-
311
- # Generate documentation templates
312
- adr_template = self._generate_adr_template(name)
313
- prd_outline = self._generate_prd_outline(analysis)
314
- tech_spec = self._generate_tech_spec_outline(analysis, recommendations)
315
-
316
- return AutomationPlan(
317
- name=name,
318
- version=self.version,
319
- created_date=datetime.now().strftime("%Y-%m-%d"),
320
- executive_summary=executive_summary,
321
- process_analysis=process_analysis,
322
- automation_strategy=automation_strategy,
323
- team_composition=team_dict,
324
- phases=recommendations.implementation_phases,
325
- milestones=milestones,
326
- risks=risks,
327
- success_metrics=success_metrics,
328
- governance=governance,
329
- adr_template=adr_template,
330
- prd_outline=prd_outline,
331
- technical_spec_outline=tech_spec
332
- )
333
-
334
- def _generate_milestones(self, phases: List[Dict]) -> List[Milestone]:
335
- """Generate milestones from phases."""
336
- milestones = []
337
-
338
- for phase in phases:
339
- phase_num = phase.get('phase', 0)
340
- phase_name = phase.get('name', f'Phase {phase_num}')
341
-
342
- milestones.append(Milestone(
343
- name=f"M{phase_num}: {phase_name} Complete",
344
- phase=phase_num,
345
- deliverables=phase.get('deliverables', []),
346
- success_criteria=[
347
- f"All {phase_name.lower()} activities completed",
348
- "Stakeholder sign-off obtained",
349
- "Documentation updated"
350
- ],
351
- dependencies=[f"M{phase_num - 1}"] if phase_num > 1 else []
352
- ))
353
-
354
- # Add final milestone
355
- milestones.append(Milestone(
356
- name="Project Complete",
357
- phase=len(phases) + 1,
358
- deliverables=[
359
- "Production deployment",
360
- "User training complete",
361
- "Runbooks delivered"
362
- ],
363
- success_criteria=[
364
- "All success metrics achieved",
365
- "No critical issues open",
366
- "Handover to operations complete"
367
- ],
368
- dependencies=[f"M{len(phases)}"]
369
- ))
370
-
371
- return milestones
372
-
373
- def _generate_risks(
374
- self,
375
- analysis: ProcessAnalysis,
376
- strategy: AutomationStrategy,
377
- team: TeamComposition
378
- ) -> List[RiskMitigation]:
379
- """Generate risk register."""
380
- risks = []
381
-
382
- # Technical risks
383
- if analysis.complexity in [ProcessComplexity.COMPLEX, ProcessComplexity.ENTERPRISE]:
384
- risks.append(RiskMitigation(
385
- risk="Technical complexity exceeds estimates",
386
- probability="medium",
387
- impact="high",
388
- mitigation="Break into smaller increments, add technical spikes",
389
- owner="Tech Lead",
390
- contingency="Descope non-essential features"
391
- ))
392
-
393
- # Integration risks
394
- if len(analysis.data_sources_involved) > 2:
395
- risks.append(RiskMitigation(
396
- risk="Data integration issues",
397
- probability="medium",
398
- impact="medium",
399
- mitigation="Early integration testing, mock services",
400
- owner="Data Engineer",
401
- contingency="Manual data entry fallback"
402
- ))
403
-
404
- # Resource risks
405
- if team.recommended_team_size > 4:
406
- risks.append(RiskMitigation(
407
- risk="Resource availability constraints",
408
- probability="medium",
409
- impact="high",
410
- mitigation="Identify backup resources, cross-training",
411
- owner="Project Manager",
412
- contingency="Extend timeline, prioritize features"
413
- ))
414
-
415
- # Skill gap risks
416
- if team.skill_gaps:
417
- risks.append(RiskMitigation(
418
- risk="Team skill gaps",
419
- probability="low",
420
- impact="medium",
421
- mitigation="Training plan, expert consultation",
422
- owner="Tech Lead",
423
- contingency="External contractor support"
424
- ))
425
-
426
- # Adoption risks
427
- risks.append(RiskMitigation(
428
- risk="User adoption resistance",
429
- probability="medium",
430
- impact="medium",
431
- mitigation="Early stakeholder engagement, training program",
432
- owner="Product Owner",
433
- contingency="Phased rollout, additional change management"
434
- ))
435
-
436
- # Security/Compliance risks
437
- if analysis.compliance_requirements:
438
- risks.append(RiskMitigation(
439
- risk="Compliance requirements not met",
440
- probability="low",
441
- impact="critical",
442
- mitigation="Security review gates, compliance checklist",
443
- owner="Security Architect",
444
- contingency="Halt deployment until resolved"
445
- ))
446
-
447
- return risks
448
-
449
- def _generate_metrics(self, analysis: ProcessAnalysis) -> List[Dict]:
450
- """Generate success metrics."""
451
- metrics = [
452
- {
453
- "name": "Process Time Reduction",
454
- "current": f"{analysis.total_time_minutes} min",
455
- "target": f"<{int(analysis.total_time_minutes * 0.2)} min",
456
- "measurement": "Time from start to completion"
457
- },
458
- {
459
- "name": "Manual Effort",
460
- "current": "100%",
461
- "target": "<20%",
462
- "measurement": "Human intervention required"
463
- },
464
- {
465
- "name": "Error Rate",
466
- "current": "Unknown",
467
- "target": "<5%",
468
- "measurement": "Errors per 100 executions"
469
- },
470
- {
471
- "name": "Automation Reliability",
472
- "current": "N/A",
473
- "target": ">99%",
474
- "measurement": "Successful runs / Total runs"
475
- }
476
- ]
477
-
478
- # Add stakeholder-specific metrics
479
- if "Finance" in analysis.stakeholders or "CFO" in str(analysis.stakeholders):
480
- metrics.append({
481
- "name": "Cost Savings",
482
- "current": "Baseline",
483
- "target": ">$50K/year",
484
- "measurement": "Reduced labor + efficiency gains"
485
- })
486
-
487
- if "Customer" in str(analysis.stakeholders).lower():
488
- metrics.append({
489
- "name": "Customer Impact",
490
- "current": "Baseline",
491
- "target": "NPS +5",
492
- "measurement": "Customer satisfaction surveys"
493
- })
494
-
495
- return metrics
496
-
497
- def _generate_governance(self, analysis: ProcessAnalysis) -> Dict:
498
- """Generate governance structure."""
499
- # More governance for complex processes
500
- if analysis.complexity == ProcessComplexity.ENTERPRISE:
501
- return {
502
- "review_cadence": "Weekly steering committee",
503
- "escalation_path": "Tech Lead → Project Manager → Director → VP",
504
- "change_control": "Change Advisory Board for scope changes",
505
- "documentation": "ADRs, PRDs, Technical Specs required",
506
- "approvals": ["Security", "Compliance", "Architecture", "Business"]
507
- }
508
- elif analysis.complexity == ProcessComplexity.COMPLEX:
509
- return {
510
- "review_cadence": "Weekly team standup + bi-weekly stakeholder sync",
511
- "escalation_path": "Tech Lead → Manager → Director",
512
- "change_control": "ADR for architectural changes, team consensus for others",
513
- "documentation": "ADRs for major decisions, technical design doc",
514
- "approvals": ["Security", "Architecture"]
515
- }
516
- else:
517
- return {
518
- "review_cadence": "Weekly team standup",
519
- "escalation_path": "Tech Lead → Manager",
520
- "change_control": "Team consensus, ADR for major decisions",
521
- "documentation": "README, inline documentation",
522
- "approvals": ["Tech Lead"]
523
- }
524
-
525
- def _generate_adr_template(self, project_name: str) -> str:
526
- """Generate ADR template."""
527
- return f"""# ADR-001: [Decision Title]
528
-
529
- ## Status
530
- Proposed | Accepted | Deprecated | Superseded
531
-
532
- ## Context
533
- What is the issue we're trying to solve?
534
- What constraints do we have?
535
-
536
- ## Decision
537
- What decision did we make and why?
538
-
539
- ## Consequences
540
- ### Positive
541
- - Benefit 1
542
- - Benefit 2
543
-
544
- ### Negative
545
- - Tradeoff 1
546
- - Tradeoff 2
547
-
548
- ### Risks
549
- - Risk 1 and mitigation
550
-
551
- ## Related
552
- - Related ADRs
553
- - Related documentation
554
-
555
- ## Project
556
- {project_name}
557
-
558
- ## Date
559
- {datetime.now().strftime("%Y-%m-%d")}
560
- """
561
-
562
- def _generate_prd_outline(self, analysis: ProcessAnalysis) -> str:
563
- """Generate PRD outline."""
564
- stakeholders = ", ".join(analysis.stakeholders[:3])
565
- return f"""### Product Requirements Document Outline
566
-
567
- 1. **Overview**
568
- - Problem statement: Manual {analysis.name.lower()} process
569
- - Solution summary: Automation using recommended approach
570
-
571
- 2. **Stakeholders**
572
- - Primary: {stakeholders}
573
- - Secondary: IT Operations, Support
574
-
575
- 3. **User Stories**
576
- - As a stakeholder, I want automated {analysis.name.lower()}
577
- - As an operator, I want monitoring and alerting
578
- - As a manager, I want visibility into process metrics
579
-
580
- 4. **Functional Requirements**
581
- - FR1: Automate data collection
582
- - FR2: Automate processing logic
583
- - FR3: Automate output generation
584
- - FR4: Provide manual override capability
585
-
586
- 5. **Non-Functional Requirements**
587
- - Performance: Complete in <{int(analysis.total_time_minutes * 0.2)} minutes
588
- - Reliability: 99% success rate
589
- - Security: Comply with data policies
590
-
591
- 6. **Success Criteria**
592
- - Time reduction >80%
593
- - Error rate <5%
594
- - User satisfaction >4/5
595
- """
596
-
597
- def _generate_tech_spec_outline(
598
- self,
599
- analysis: ProcessAnalysis,
600
- strategy: AutomationStrategy
601
- ) -> str:
602
- """Generate technical spec outline."""
603
- tools = [t['name'] for t in strategy.to_dict().get('recommended_tools', [])[:3]]
604
- return f"""### Technical Specification Outline
605
-
606
- 1. **Architecture Overview**
607
- - High-level system diagram
608
- - Component interactions
609
- - Data flow
610
-
611
- 2. **Technology Stack**
612
- - Primary tools: {', '.join(tools)}
613
- - Azure services: As per recommendations
614
- - Languages: Python, SQL
615
-
616
- 3. **Data Architecture**
617
- - Input sources: {', '.join(analysis.data_sources_involved[:3]) or 'TBD'}
618
- - Data transformations
619
- - Output formats
620
-
621
- 4. **Integration Points**
622
- - External systems
623
- - APIs and protocols
624
- - Authentication
625
-
626
- 5. **Security Design**
627
- - Access control
628
- - Data protection
629
- - Audit logging
630
-
631
- 6. **Monitoring & Operations**
632
- - Health checks
633
- - Alerting rules
634
- - Runbook procedures
635
- """
636
-
637
-
638
- # Example usage
639
- if __name__ == "__main__":
640
- from process_analyzer import ProcessAnalyzer
641
- from automation_recommender import AutomationRecommender
642
- from role_matcher import RoleMatcher
643
-
644
- # Analyze process
645
- analyzer = ProcessAnalyzer()
646
- analysis = analyzer.analyze_process(
647
- name="Monthly Sales Report",
648
- description="Generate and distribute monthly sales performance reports",
649
- steps=[
650
- {"name": "Extract CRM data", "time_minutes": 30, "manual": True, "data_sources": ["Salesforce"]},
651
- {"name": "Extract ERP data", "time_minutes": 45, "manual": True, "data_sources": ["SAP"]},
652
- {"name": "Merge and clean", "time_minutes": 60, "manual": True, "error_prone": True},
653
- {"name": "Calculate KPIs", "time_minutes": 30, "manual": True, "requires_expertise": True},
654
- {"name": "Generate charts", "time_minutes": 45, "manual": True},
655
- {"name": "Write summary", "time_minutes": 60, "manual": True, "requires_decision": True},
656
- {"name": "Review and send", "time_minutes": 30, "manual": True}
657
- ],
658
- frequency="monthly",
659
- stakeholders=["Sales Director", "CFO", "Regional Managers"]
660
- )
661
-
662
- # Get recommendations
663
- recommender = AutomationRecommender()
664
- strategy = recommender.recommend(analysis)
665
-
666
- # Match roles
667
- matcher = RoleMatcher()
668
- team = matcher.match_roles(analysis, strategy)
669
-
670
- # Generate plan
671
- generator = PlanGenerator()
672
- plan = generator.generate_plan(
673
- analysis=analysis,
674
- recommendations=strategy,
675
- team_composition=team
676
- )
677
-
678
- # Output as markdown
679
- print(plan.to_markdown())
1
+ """
2
+ Plan Generator - Generates comprehensive automation implementation plans.
3
+
4
+ Part of the Tech Hub Skills Library (sd-08: Process Automation).
5
+ """
6
+
7
+ from dataclasses import dataclass, field
8
+ from typing import List, Dict, Optional
9
+ from datetime import datetime
10
+ import json
11
+
12
+ from process_analyzer import ProcessAnalysis, ProcessComplexity
13
+ from automation_recommender import AutomationStrategy, AutomationApproach
14
+ from role_matcher import TeamComposition, RoleAssignment
15
+
16
+
17
+ @dataclass
18
+ class Milestone:
19
+ """A project milestone."""
20
+ name: str
21
+ phase: int
22
+ deliverables: List[str]
23
+ success_criteria: List[str]
24
+ dependencies: List[str] = field(default_factory=list)
25
+
26
+
27
+ @dataclass
28
+ class RiskMitigation:
29
+ """Risk mitigation strategy."""
30
+ risk: str
31
+ probability: str # low, medium, high
32
+ impact: str # low, medium, high
33
+ mitigation: str
34
+ owner: str
35
+ contingency: str
36
+
37
+
38
+ @dataclass
39
+ class AutomationPlan:
40
+ """Complete automation implementation plan."""
41
+ # Header
42
+ name: str
43
+ version: str
44
+ created_date: str
45
+
46
+ # Summary
47
+ executive_summary: Dict
48
+
49
+ # Analysis
50
+ process_analysis: Dict
51
+ automation_strategy: Dict
52
+ team_composition: Dict
53
+
54
+ # Implementation
55
+ phases: List[Dict]
56
+ milestones: List[Milestone]
57
+
58
+ # Risk & Governance
59
+ risks: List[RiskMitigation]
60
+ success_metrics: List[Dict]
61
+ governance: Dict
62
+
63
+ # Documentation
64
+ adr_template: str
65
+ prd_outline: str
66
+ technical_spec_outline: str
67
+
68
+ def to_markdown(self) -> str:
69
+ """Convert plan to markdown document."""
70
+ md = []
71
+
72
+ # Title
73
+ md.append(f"# Automation Plan: {self.name}")
74
+ md.append(f"\n**Version**: {self.version}")
75
+ md.append(f"**Created**: {self.created_date}")
76
+ md.append("")
77
+
78
+ # Executive Summary
79
+ md.append("## Executive Summary")
80
+ md.append("")
81
+ summary = self.executive_summary
82
+ md.append(f"- **Automation Potential**: {summary.get('automation_score', 'N/A')}/100")
83
+ md.append(f"- **Complexity**: {summary.get('complexity', 'N/A')}")
84
+ md.append(f"- **Estimated Effort**: {summary.get('effort_weeks', 'N/A')} weeks")
85
+ md.append(f"- **Primary Approach**: {summary.get('approach', 'N/A')}")
86
+ md.append(f"- **Confidence**: {summary.get('confidence', 'N/A')}%")
87
+ md.append("")
88
+
89
+ # Current State
90
+ md.append("## Current State Analysis")
91
+ md.append("")
92
+ analysis = self.process_analysis
93
+ md.append(f"**Process**: {analysis.get('name', 'N/A')}")
94
+ md.append(f"\n{analysis.get('description', '')}")
95
+ md.append("")
96
+ md.append(f"- **Frequency**: {analysis.get('frequency', 'N/A')}")
97
+ md.append(f"- **Total Time**: {analysis.get('total_time_minutes', 0)} minutes")
98
+ md.append(f"- **Stakeholders**: {', '.join(analysis.get('stakeholders', []))}")
99
+ md.append("")
100
+
101
+ # Bottlenecks
102
+ if analysis.get('bottlenecks'):
103
+ md.append("### Identified Bottlenecks")
104
+ for bn in analysis.get('bottlenecks', []):
105
+ md.append(f"- {bn}")
106
+ md.append("")
107
+
108
+ # Team Composition
109
+ md.append("## Recommended Team")
110
+ md.append("")
111
+ md.append("| Role | Effort | Key Skills | Primary |")
112
+ md.append("|------|--------|------------|---------|")
113
+ for assignment in self.team_composition.get('assignments', []):
114
+ skills = ', '.join(assignment.get('skills', [])[:3])
115
+ primary = "Yes" if assignment.get('is_primary') else ""
116
+ md.append(f"| {assignment.get('role_name', '')} | {assignment.get('effort_pct', 0)}% | {skills} | {primary} |")
117
+ md.append("")
118
+
119
+ # Skill Gaps
120
+ if self.team_composition.get('skill_gaps'):
121
+ md.append("### Skill Gaps")
122
+ for gap in self.team_composition.get('skill_gaps', []):
123
+ md.append(f"- **{gap.get('area', '')}**: {gap.get('recommendation', '')}")
124
+ md.append("")
125
+
126
+ # Recommended Tools
127
+ md.append("## Recommended Tools & Technologies")
128
+ md.append("")
129
+ strategy = self.automation_strategy
130
+ md.append("| Tool | Category | Fit Score | Azure Service |")
131
+ md.append("|------|----------|-----------|---------------|")
132
+ for tool in strategy.get('recommended_tools', [])[:6]:
133
+ azure = tool.get('azure_service', '-')
134
+ md.append(f"| {tool.get('name', '')} | {tool.get('category', '')} | {tool.get('fit_score', 0)}% | {azure} |")
135
+ md.append("")
136
+
137
+ # Implementation Phases
138
+ md.append("## Implementation Phases")
139
+ md.append("")
140
+ for phase in self.phases:
141
+ md.append(f"### Phase {phase.get('phase', '')}: {phase.get('name', '')}")
142
+ md.append(f"**Duration**: {phase.get('duration_weeks', '')} weeks")
143
+ md.append("")
144
+ md.append("**Activities**:")
145
+ for activity in phase.get('activities', []):
146
+ md.append(f"- {activity}")
147
+ md.append("")
148
+ md.append("**Deliverables**:")
149
+ for deliverable in phase.get('deliverables', []):
150
+ md.append(f"- {deliverable}")
151
+ md.append("")
152
+ md.append(f"**Skills Needed**: {', '.join(phase.get('skills_needed', []))}")
153
+ md.append("")
154
+
155
+ # Milestones
156
+ md.append("## Key Milestones")
157
+ md.append("")
158
+ md.append("| Milestone | Phase | Deliverables | Success Criteria |")
159
+ md.append("|-----------|-------|--------------|------------------|")
160
+ for milestone in self.milestones:
161
+ deliverables = "; ".join(milestone.deliverables[:2])
162
+ criteria = "; ".join(milestone.success_criteria[:2])
163
+ md.append(f"| {milestone.name} | {milestone.phase} | {deliverables} | {criteria} |")
164
+ md.append("")
165
+
166
+ # Risk Assessment
167
+ md.append("## Risk Assessment")
168
+ md.append("")
169
+ md.append("| Risk | Probability | Impact | Mitigation | Owner |")
170
+ md.append("|------|-------------|--------|------------|-------|")
171
+ for risk in self.risks:
172
+ md.append(f"| {risk.risk} | {risk.probability} | {risk.impact} | {risk.mitigation} | {risk.owner} |")
173
+ md.append("")
174
+
175
+ # Success Metrics
176
+ md.append("## Success Metrics")
177
+ md.append("")
178
+ md.append("| Metric | Current | Target | Measurement |")
179
+ md.append("|--------|---------|--------|-------------|")
180
+ for metric in self.success_metrics:
181
+ md.append(f"| {metric.get('name', '')} | {metric.get('current', '-')} | {metric.get('target', '')} | {metric.get('measurement', '')} |")
182
+ md.append("")
183
+
184
+ # Governance
185
+ md.append("## Governance")
186
+ md.append("")
187
+ gov = self.governance
188
+ md.append(f"- **Review Cadence**: {gov.get('review_cadence', 'Weekly')}")
189
+ md.append(f"- **Escalation Path**: {gov.get('escalation_path', 'Project Lead → Manager → Director')}")
190
+ md.append(f"- **Change Control**: {gov.get('change_control', 'ADR for significant changes')}")
191
+ md.append("")
192
+
193
+ # ADR Template
194
+ md.append("## Appendix A: Architecture Decision Record Template")
195
+ md.append("")
196
+ md.append("```markdown")
197
+ md.append(self.adr_template)
198
+ md.append("```")
199
+ md.append("")
200
+
201
+ # PRD Outline
202
+ md.append("## Appendix B: PRD Outline")
203
+ md.append("")
204
+ md.append(self.prd_outline)
205
+ md.append("")
206
+
207
+ return "\n".join(md)
208
+
209
+ def to_dict(self) -> Dict:
210
+ """Convert plan to dictionary."""
211
+ return {
212
+ "name": self.name,
213
+ "version": self.version,
214
+ "created_date": self.created_date,
215
+ "executive_summary": self.executive_summary,
216
+ "process_analysis": self.process_analysis,
217
+ "automation_strategy": self.automation_strategy,
218
+ "team_composition": self.team_composition,
219
+ "phases": self.phases,
220
+ "milestones": [
221
+ {
222
+ "name": m.name,
223
+ "phase": m.phase,
224
+ "deliverables": m.deliverables,
225
+ "success_criteria": m.success_criteria
226
+ }
227
+ for m in self.milestones
228
+ ],
229
+ "risks": [
230
+ {
231
+ "risk": r.risk,
232
+ "probability": r.probability,
233
+ "impact": r.impact,
234
+ "mitigation": r.mitigation,
235
+ "owner": r.owner
236
+ }
237
+ for r in self.risks
238
+ ],
239
+ "success_metrics": self.success_metrics,
240
+ "governance": self.governance
241
+ }
242
+
243
+ def to_json(self) -> str:
244
+ """Convert plan to JSON."""
245
+ return json.dumps(self.to_dict(), indent=2)
246
+
247
+
248
+ class PlanGenerator:
249
+ """
250
+ Generates comprehensive automation implementation plans.
251
+
252
+ Combines process analysis, automation strategy, and team composition
253
+ into actionable implementation plans with documentation templates.
254
+ """
255
+
256
+ def __init__(self):
257
+ """Initialize plan generator."""
258
+ self.version = "1.0"
259
+
260
+ def generate_plan(
261
+ self,
262
+ analysis: ProcessAnalysis,
263
+ recommendations: AutomationStrategy,
264
+ team_composition: TeamComposition,
265
+ project_name: Optional[str] = None
266
+ ) -> AutomationPlan:
267
+ """
268
+ Generate complete automation implementation plan.
269
+
270
+ Args:
271
+ analysis: Process analysis
272
+ recommendations: Automation strategy
273
+ team_composition: Team composition
274
+
275
+ Returns:
276
+ Complete AutomationPlan
277
+ """
278
+ name = project_name or f"{analysis.name} Automation"
279
+
280
+ # Build executive summary
281
+ executive_summary = {
282
+ "automation_score": round(analysis.automation_score, 1),
283
+ "complexity": analysis.complexity.value,
284
+ "effort_weeks": recommendations.estimated_effort_weeks,
285
+ "approach": recommendations.primary_approach.value,
286
+ "confidence": recommendations.confidence_score,
287
+ "roi_potential": "High" if analysis.automation_score > 70 else "Medium"
288
+ }
289
+
290
+ # Convert analysis to dict
291
+ process_analysis = analysis.to_dict()
292
+
293
+ # Convert strategy to dict
294
+ automation_strategy = recommendations.to_dict()
295
+
296
+ # Convert team to dict
297
+ team_dict = team_composition.to_dict()
298
+
299
+ # Generate milestones
300
+ milestones = self._generate_milestones(recommendations.implementation_phases)
301
+
302
+ # Generate risks
303
+ risks = self._generate_risks(analysis, recommendations, team_composition)
304
+
305
+ # Generate success metrics
306
+ success_metrics = self._generate_metrics(analysis)
307
+
308
+ # Generate governance
309
+ governance = self._generate_governance(analysis)
310
+
311
+ # Generate documentation templates
312
+ adr_template = self._generate_adr_template(name)
313
+ prd_outline = self._generate_prd_outline(analysis)
314
+ tech_spec = self._generate_tech_spec_outline(analysis, recommendations)
315
+
316
+ return AutomationPlan(
317
+ name=name,
318
+ version=self.version,
319
+ created_date=datetime.now().strftime("%Y-%m-%d"),
320
+ executive_summary=executive_summary,
321
+ process_analysis=process_analysis,
322
+ automation_strategy=automation_strategy,
323
+ team_composition=team_dict,
324
+ phases=recommendations.implementation_phases,
325
+ milestones=milestones,
326
+ risks=risks,
327
+ success_metrics=success_metrics,
328
+ governance=governance,
329
+ adr_template=adr_template,
330
+ prd_outline=prd_outline,
331
+ technical_spec_outline=tech_spec
332
+ )
333
+
334
+ def _generate_milestones(self, phases: List[Dict]) -> List[Milestone]:
335
+ """Generate milestones from phases."""
336
+ milestones = []
337
+
338
+ for phase in phases:
339
+ phase_num = phase.get('phase', 0)
340
+ phase_name = phase.get('name', f'Phase {phase_num}')
341
+
342
+ milestones.append(Milestone(
343
+ name=f"M{phase_num}: {phase_name} Complete",
344
+ phase=phase_num,
345
+ deliverables=phase.get('deliverables', []),
346
+ success_criteria=[
347
+ f"All {phase_name.lower()} activities completed",
348
+ "Stakeholder sign-off obtained",
349
+ "Documentation updated"
350
+ ],
351
+ dependencies=[f"M{phase_num - 1}"] if phase_num > 1 else []
352
+ ))
353
+
354
+ # Add final milestone
355
+ milestones.append(Milestone(
356
+ name="Project Complete",
357
+ phase=len(phases) + 1,
358
+ deliverables=[
359
+ "Production deployment",
360
+ "User training complete",
361
+ "Runbooks delivered"
362
+ ],
363
+ success_criteria=[
364
+ "All success metrics achieved",
365
+ "No critical issues open",
366
+ "Handover to operations complete"
367
+ ],
368
+ dependencies=[f"M{len(phases)}"]
369
+ ))
370
+
371
+ return milestones
372
+
373
+ def _generate_risks(
374
+ self,
375
+ analysis: ProcessAnalysis,
376
+ strategy: AutomationStrategy,
377
+ team: TeamComposition
378
+ ) -> List[RiskMitigation]:
379
+ """Generate risk register."""
380
+ risks = []
381
+
382
+ # Technical risks
383
+ if analysis.complexity in [ProcessComplexity.COMPLEX, ProcessComplexity.ENTERPRISE]:
384
+ risks.append(RiskMitigation(
385
+ risk="Technical complexity exceeds estimates",
386
+ probability="medium",
387
+ impact="high",
388
+ mitigation="Break into smaller increments, add technical spikes",
389
+ owner="Tech Lead",
390
+ contingency="Descope non-essential features"
391
+ ))
392
+
393
+ # Integration risks
394
+ if len(analysis.data_sources_involved) > 2:
395
+ risks.append(RiskMitigation(
396
+ risk="Data integration issues",
397
+ probability="medium",
398
+ impact="medium",
399
+ mitigation="Early integration testing, mock services",
400
+ owner="Data Engineer",
401
+ contingency="Manual data entry fallback"
402
+ ))
403
+
404
+ # Resource risks
405
+ if team.recommended_team_size > 4:
406
+ risks.append(RiskMitigation(
407
+ risk="Resource availability constraints",
408
+ probability="medium",
409
+ impact="high",
410
+ mitigation="Identify backup resources, cross-training",
411
+ owner="Project Manager",
412
+ contingency="Extend timeline, prioritize features"
413
+ ))
414
+
415
+ # Skill gap risks
416
+ if team.skill_gaps:
417
+ risks.append(RiskMitigation(
418
+ risk="Team skill gaps",
419
+ probability="low",
420
+ impact="medium",
421
+ mitigation="Training plan, expert consultation",
422
+ owner="Tech Lead",
423
+ contingency="External contractor support"
424
+ ))
425
+
426
+ # Adoption risks
427
+ risks.append(RiskMitigation(
428
+ risk="User adoption resistance",
429
+ probability="medium",
430
+ impact="medium",
431
+ mitigation="Early stakeholder engagement, training program",
432
+ owner="Product Owner",
433
+ contingency="Phased rollout, additional change management"
434
+ ))
435
+
436
+ # Security/Compliance risks
437
+ if analysis.compliance_requirements:
438
+ risks.append(RiskMitigation(
439
+ risk="Compliance requirements not met",
440
+ probability="low",
441
+ impact="critical",
442
+ mitigation="Security review gates, compliance checklist",
443
+ owner="Security Architect",
444
+ contingency="Halt deployment until resolved"
445
+ ))
446
+
447
+ return risks
448
+
449
+ def _generate_metrics(self, analysis: ProcessAnalysis) -> List[Dict]:
450
+ """Generate success metrics."""
451
+ metrics = [
452
+ {
453
+ "name": "Process Time Reduction",
454
+ "current": f"{analysis.total_time_minutes} min",
455
+ "target": f"<{int(analysis.total_time_minutes * 0.2)} min",
456
+ "measurement": "Time from start to completion"
457
+ },
458
+ {
459
+ "name": "Manual Effort",
460
+ "current": "100%",
461
+ "target": "<20%",
462
+ "measurement": "Human intervention required"
463
+ },
464
+ {
465
+ "name": "Error Rate",
466
+ "current": "Unknown",
467
+ "target": "<5%",
468
+ "measurement": "Errors per 100 executions"
469
+ },
470
+ {
471
+ "name": "Automation Reliability",
472
+ "current": "N/A",
473
+ "target": ">99%",
474
+ "measurement": "Successful runs / Total runs"
475
+ }
476
+ ]
477
+
478
+ # Add stakeholder-specific metrics
479
+ if "Finance" in analysis.stakeholders or "CFO" in str(analysis.stakeholders):
480
+ metrics.append({
481
+ "name": "Cost Savings",
482
+ "current": "Baseline",
483
+ "target": ">$50K/year",
484
+ "measurement": "Reduced labor + efficiency gains"
485
+ })
486
+
487
+ if "Customer" in str(analysis.stakeholders).lower():
488
+ metrics.append({
489
+ "name": "Customer Impact",
490
+ "current": "Baseline",
491
+ "target": "NPS +5",
492
+ "measurement": "Customer satisfaction surveys"
493
+ })
494
+
495
+ return metrics
496
+
497
+ def _generate_governance(self, analysis: ProcessAnalysis) -> Dict:
498
+ """Generate governance structure."""
499
+ # More governance for complex processes
500
+ if analysis.complexity == ProcessComplexity.ENTERPRISE:
501
+ return {
502
+ "review_cadence": "Weekly steering committee",
503
+ "escalation_path": "Tech Lead → Project Manager → Director → VP",
504
+ "change_control": "Change Advisory Board for scope changes",
505
+ "documentation": "ADRs, PRDs, Technical Specs required",
506
+ "approvals": ["Security", "Compliance", "Architecture", "Business"]
507
+ }
508
+ elif analysis.complexity == ProcessComplexity.COMPLEX:
509
+ return {
510
+ "review_cadence": "Weekly team standup + bi-weekly stakeholder sync",
511
+ "escalation_path": "Tech Lead → Manager → Director",
512
+ "change_control": "ADR for architectural changes, team consensus for others",
513
+ "documentation": "ADRs for major decisions, technical design doc",
514
+ "approvals": ["Security", "Architecture"]
515
+ }
516
+ else:
517
+ return {
518
+ "review_cadence": "Weekly team standup",
519
+ "escalation_path": "Tech Lead → Manager",
520
+ "change_control": "Team consensus, ADR for major decisions",
521
+ "documentation": "README, inline documentation",
522
+ "approvals": ["Tech Lead"]
523
+ }
524
+
525
+ def _generate_adr_template(self, project_name: str) -> str:
526
+ """Generate ADR template."""
527
+ return f"""# ADR-001: [Decision Title]
528
+
529
+ ## Status
530
+ Proposed | Accepted | Deprecated | Superseded
531
+
532
+ ## Context
533
+ What is the issue we're trying to solve?
534
+ What constraints do we have?
535
+
536
+ ## Decision
537
+ What decision did we make and why?
538
+
539
+ ## Consequences
540
+ ### Positive
541
+ - Benefit 1
542
+ - Benefit 2
543
+
544
+ ### Negative
545
+ - Tradeoff 1
546
+ - Tradeoff 2
547
+
548
+ ### Risks
549
+ - Risk 1 and mitigation
550
+
551
+ ## Related
552
+ - Related ADRs
553
+ - Related documentation
554
+
555
+ ## Project
556
+ {project_name}
557
+
558
+ ## Date
559
+ {datetime.now().strftime("%Y-%m-%d")}
560
+ """
561
+
562
+ def _generate_prd_outline(self, analysis: ProcessAnalysis) -> str:
563
+ """Generate PRD outline."""
564
+ stakeholders = ", ".join(analysis.stakeholders[:3])
565
+ return f"""### Product Requirements Document Outline
566
+
567
+ 1. **Overview**
568
+ - Problem statement: Manual {analysis.name.lower()} process
569
+ - Solution summary: Automation using recommended approach
570
+
571
+ 2. **Stakeholders**
572
+ - Primary: {stakeholders}
573
+ - Secondary: IT Operations, Support
574
+
575
+ 3. **User Stories**
576
+ - As a stakeholder, I want automated {analysis.name.lower()}
577
+ - As an operator, I want monitoring and alerting
578
+ - As a manager, I want visibility into process metrics
579
+
580
+ 4. **Functional Requirements**
581
+ - FR1: Automate data collection
582
+ - FR2: Automate processing logic
583
+ - FR3: Automate output generation
584
+ - FR4: Provide manual override capability
585
+
586
+ 5. **Non-Functional Requirements**
587
+ - Performance: Complete in <{int(analysis.total_time_minutes * 0.2)} minutes
588
+ - Reliability: 99% success rate
589
+ - Security: Comply with data policies
590
+
591
+ 6. **Success Criteria**
592
+ - Time reduction >80%
593
+ - Error rate <5%
594
+ - User satisfaction >4/5
595
+ """
596
+
597
+ def _generate_tech_spec_outline(
598
+ self,
599
+ analysis: ProcessAnalysis,
600
+ strategy: AutomationStrategy
601
+ ) -> str:
602
+ """Generate technical spec outline."""
603
+ tools = [t['name'] for t in strategy.to_dict().get('recommended_tools', [])[:3]]
604
+ return f"""### Technical Specification Outline
605
+
606
+ 1. **Architecture Overview**
607
+ - High-level system diagram
608
+ - Component interactions
609
+ - Data flow
610
+
611
+ 2. **Technology Stack**
612
+ - Primary tools: {', '.join(tools)}
613
+ - Azure services: As per recommendations
614
+ - Languages: Python, SQL
615
+
616
+ 3. **Data Architecture**
617
+ - Input sources: {', '.join(analysis.data_sources_involved[:3]) or 'TBD'}
618
+ - Data transformations
619
+ - Output formats
620
+
621
+ 4. **Integration Points**
622
+ - External systems
623
+ - APIs and protocols
624
+ - Authentication
625
+
626
+ 5. **Security Design**
627
+ - Access control
628
+ - Data protection
629
+ - Audit logging
630
+
631
+ 6. **Monitoring & Operations**
632
+ - Health checks
633
+ - Alerting rules
634
+ - Runbook procedures
635
+ """
636
+
637
+
638
+ # Example usage
639
+ if __name__ == "__main__":
640
+ from process_analyzer import ProcessAnalyzer
641
+ from automation_recommender import AutomationRecommender
642
+ from role_matcher import RoleMatcher
643
+
644
+ # Analyze process
645
+ analyzer = ProcessAnalyzer()
646
+ analysis = analyzer.analyze_process(
647
+ name="Monthly Sales Report",
648
+ description="Generate and distribute monthly sales performance reports",
649
+ steps=[
650
+ {"name": "Extract CRM data", "time_minutes": 30, "manual": True, "data_sources": ["Salesforce"]},
651
+ {"name": "Extract ERP data", "time_minutes": 45, "manual": True, "data_sources": ["SAP"]},
652
+ {"name": "Merge and clean", "time_minutes": 60, "manual": True, "error_prone": True},
653
+ {"name": "Calculate KPIs", "time_minutes": 30, "manual": True, "requires_expertise": True},
654
+ {"name": "Generate charts", "time_minutes": 45, "manual": True},
655
+ {"name": "Write summary", "time_minutes": 60, "manual": True, "requires_decision": True},
656
+ {"name": "Review and send", "time_minutes": 30, "manual": True}
657
+ ],
658
+ frequency="monthly",
659
+ stakeholders=["Sales Director", "CFO", "Regional Managers"]
660
+ )
661
+
662
+ # Get recommendations
663
+ recommender = AutomationRecommender()
664
+ strategy = recommender.recommend(analysis)
665
+
666
+ # Match roles
667
+ matcher = RoleMatcher()
668
+ team = matcher.match_roles(analysis, strategy)
669
+
670
+ # Generate plan
671
+ generator = PlanGenerator()
672
+ plan = generator.generate_plan(
673
+ analysis=analysis,
674
+ recommendations=strategy,
675
+ team_composition=team
676
+ )
677
+
678
+ # Output as markdown
679
+ print(plan.to_markdown())