Refactor large workflows into modular shared components #8849
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Five workflows grew to 600-748 lines with mixed concerns, impeding maintenance and reuse. This refactors two high-priority workflows by extracting common patterns into shared modules.
Refactored Workflows
copilot-session-insights.md: 748 → 403 lines (-46%)
shared/session-analysis-charts.md(118 lines)shared/session-analysis-strategies.md(242 lines)ci-coach.md: 725 → 281 lines (-61%)
shared/ci-data-analysis.md(173 lines)shared/ci-optimization-strategies.md(193 lines)Pattern
Main workflows now compose via imports:
Shared modules handle single concerns: data collection, analysis strategies, visualization, or reporting.
Additional Modules
Created
shared/token-cost-analysis.md(317 lines) with reusable token aggregation and cost tracking patterns for token reporting workflows.Documentation
Added
specs/workflow-refactoring-patterns.mdcovering:Remaining Work
Three workflows identified for future refactoring:
daily-copilot-token-report.md(680 lines)prompt-clustering-analysis.md(639 lines)developer-docs-consolidator.md(623 lines)Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.