For an overview of all available workflows, see the main README.
The Code Simplifier workflow automatically analyzes recently modified code and creates pull requests with simplifications that improve clarity, consistency, and maintainability while preserving functionality.
Add the workflow to your repository:
gh aw add https://github.com/githubnext/agentics/blob/main/workflows/code-simplifier.mdThen compile:
gh aw compileThe Code Simplifier workflow runs daily and:
- Identifies Recent Changes - Finds code modified in the last 24 hours from merged PRs and commits
- Analyzes Code Quality - Reviews changed files for opportunities to simplify without changing functionality
- Applies Improvements - Makes targeted edits to enhance clarity, reduce complexity, and apply project conventions
- Validates Changes - Runs tests, linters, and builds to ensure no functionality is broken
- Creates Pull Requests - Proposes simplifications for review when beneficial improvements are found
The workflow focuses exclusively on recently modified code (last 24 hours), making it a continuous cleanup process that trails behind active development:
- Preserves Functionality - Never changes what code does, only how it does it
- Enhances Clarity - Reduces nesting, eliminates redundancy, improves naming
- Applies Standards - Follows project-specific conventions and established patterns
- Maintains Balance - Avoids over-simplification that reduces maintainability
Common improvements include:
- Reducing nested conditionals and loops
- Extracting repeated logic into helper functions
- Improving variable and function names for clarity
- Consolidating similar error handling patterns
- Removing unnecessary comments
- Converting complex expressions to more readable forms
- Applying idiomatic language features
The Code Simplifier is particularly valuable:
- After Rapid Development - Cleans up code written during feature sprints
- With AI-Assisted Development - Ensures speed doesn't sacrifice simplicity
- For Continuous Quality - Maintains code quality as an ongoing practice, not periodic sprints
- In Active Codebases - Works best in repositories with regular changes
From the original gh-aw repository (83% merge rate):
You can customize the workflow by editing the source file:
gh aw edit code-simplifierCommon customizations:
- Change schedule - Adjust how often it runs (default: daily)
- Modify scope - Change the time window for recent changes (default: 24 hours)
- Add language-specific rules - Include conventions specific to your project's languages
- Adjust validation - Customize test, lint, and build commands for your build system
The workflow uses these default settings:
- Schedule: Runs daily
- Scope: Analyzes code changed in the last 24 hours
- PR Labels:
refactoring,code-quality,automation - Timeout: 30 minutes
- Expires: PRs auto-close after 1 day if not merged
- Review Promptly - The workflow creates PRs that expire in 1 day, so review them quickly
- Trust the Tests - The workflow validates all changes with your test suite
- Provide Feedback - Close PRs that miss the mark; the workflow learns from patterns
- Set Clear Conventions - Document coding standards in your repository for better results
- Start Small - Run it for a week to see the kinds of improvements it suggests
This workflow is adapted from Peli's Agent Factory, where it achieved an 83% merge rate across 6 PRs in the gh-aw repository.
- Update Docs - Maintains documentation automatically
- Daily Test Coverage Improver - Improves test coverage
- Daily Performance Improver - Optimizes code performance