For an overview of all available workflows, see the main README.
Analyze source files to identify the largest and create an actionable refactoring issue with a detailed split plan
The Large File Simplifier workflow scans your repository for oversized source files and, when one exceeds a healthy size threshold, creates a detailed issue with a concrete plan for splitting it into smaller, focused modules.
# Install the 'gh aw' extension
gh extension install github/gh-aw
# Add the workflow to your repository
gh aw add-wizard githubnext/agentics/large-file-simplifierThis walks you through adding the workflow to your repository.
graph LR
A[Scan Source Files] --> B[Find Largest File]
B --> C{β₯ 500 lines?}
C -->|No| D[Report: All Files Healthy]
C -->|Yes| E[Analyze Structure]
E --> F[Plan File Splits]
F --> G[Create Issue]
The workflow identifies logical boundaries within the file β distinct responsibilities, related function clusters, utility code β and produces a concrete refactoring plan with proposed file names, contents, and acceptance criteria.
- Repository file tree via
git ls-treeto find source files and their sizes - File contents to analyze structure and identify logical split points
- Existing open issues to avoid duplicate work (skip-if-match)
- Issues with detailed refactoring plans for oversized files
- Each issue targets a single file to keep work scoped
- Issues are labeled with
refactoring,code-health,automated-analysis - Issues auto-expire after 2 days if not actioned
- Issues are assigned to Copilot for potential automated follow-up
This workflow does not perform web searches.
- Review the plan: Verify the proposed split makes logical sense for your codebase
- Adjust boundaries: Modify the suggested file groupings if needed before implementing
- Implement or assign: Perform the refactoring yourself, assign to a team member, or let Copilot handle it
- Close if unnecessary: Close the issue if the file is large for valid reasons
The workflow uses these default settings:
- Schedule: Weekdays
- Threshold: 500 lines (files under this are not flagged)
- Target: Each proposed new file should be under 300 lines
- Issue labels:
refactoring,code-health,automated-analysis - Issue expiry: 2 days if not actioned
- Skip condition: Does not run if a
[large-file-simplifier]issue is already open - Max issues per run: 1 (one file at a time)
Edit the workflow source:
gh aw edit large-file-simplifierCommon customizations:
- Adjust the threshold β Change the 500-line trigger to match your team's standards
- Focus on specific languages β Restrict the file extension pattern to your primary language
- Change split target β Modify the 300-line target for proposed new files
- Adjust schedule β Run less frequently for stable codebases
After editing, run gh aw compile to update the workflow and commit to the default branch.
- Work the backlog gradually β The workflow creates one issue at a time to keep things manageable
- Split incrementally β Implement the refactoring one module at a time for easier review
- Update imports throughout β After splitting a file, search the codebase for import paths that need updating
- Trust the threshold β Files just above 500 lines may not need splitting; focus on files well over it
- Daily File Diet β Similar workflow that also creates refactoring issues for oversized files
- Code Simplifier β Simplifies recently modified code for clarity
- Duplicate Code Detector β Finds and removes code duplication