Skip to content

Commit f09a1b3

Browse files
committed
2 parents 4d0abc1 + 6e25aed commit f09a1b3

File tree

7 files changed

+415
-5
lines changed

7 files changed

+415
-5
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ You can use the "/plan" agent to turn the reports into actionable issues which c
4848
### Code Improvement Workflows (by making changes, producing pull requests)
4949

5050
- [📖 Regular Documentation Update](docs/update-docs.md) - Update documentation automatically
51+
- [✨ Code Simplifier](docs/code-simplifier.md) - Automatically simplify recently modified code for improved clarity and maintainability
5152
- [⚡ Daily Progress](docs/daily-progress.md) - Automated daily feature development following a structured roadmap
5253
- [🧪 Daily Test Coverage Improver](docs/daily-test-improver.md) - Improve test coverage by adding meaningful tests to under-tested areas
5354
- [⚡ Daily Performance Improver](docs/daily-perf-improver.md) - Analyze and improve code performance through benchmarking and optimization

docs/code-simplifier.md

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# Code Simplifier
2+
3+
> For an overview of all available workflows, see the [main README](../README.md).
4+
5+
The [Code Simplifier workflow](../workflows/code-simplifier.md?plain=1) automatically analyzes recently modified code and creates pull requests with simplifications that improve clarity, consistency, and maintainability while preserving functionality.
6+
7+
## Installation
8+
9+
Add the workflow to your repository:
10+
11+
```bash
12+
gh aw add https://github.com/githubnext/agentics/blob/main/workflows/code-simplifier.md
13+
```
14+
15+
Then compile:
16+
17+
```bash
18+
gh aw compile
19+
```
20+
21+
## What It Does
22+
23+
The Code Simplifier workflow runs daily and:
24+
25+
1. **Identifies Recent Changes** - Finds code modified in the last 24 hours from merged PRs and commits
26+
2. **Analyzes Code Quality** - Reviews changed files for opportunities to simplify without changing functionality
27+
3. **Applies Improvements** - Makes targeted edits to enhance clarity, reduce complexity, and apply project conventions
28+
4. **Validates Changes** - Runs tests, linters, and builds to ensure no functionality is broken
29+
5. **Creates Pull Requests** - Proposes simplifications for review when beneficial improvements are found
30+
31+
## How It Works
32+
33+
The workflow focuses exclusively on **recently modified code** (last 24 hours), making it a continuous cleanup process that trails behind active development:
34+
35+
### Simplification Principles
36+
37+
- **Preserves Functionality** - Never changes what code does, only how it does it
38+
- **Enhances Clarity** - Reduces nesting, eliminates redundancy, improves naming
39+
- **Applies Standards** - Follows project-specific conventions and established patterns
40+
- **Maintains Balance** - Avoids over-simplification that reduces maintainability
41+
42+
### What It Simplifies
43+
44+
Common improvements include:
45+
- Reducing nested conditionals and loops
46+
- Extracting repeated logic into helper functions
47+
- Improving variable and function names for clarity
48+
- Consolidating similar error handling patterns
49+
- Removing unnecessary comments
50+
- Converting complex expressions to more readable forms
51+
- Applying idiomatic language features
52+
53+
## When to Use This Workflow
54+
55+
The Code Simplifier is particularly valuable:
56+
57+
- **After Rapid Development** - Cleans up code written during feature sprints
58+
- **With AI-Assisted Development** - Ensures speed doesn't sacrifice simplicity
59+
- **For Continuous Quality** - Maintains code quality as an ongoing practice, not periodic sprints
60+
- **In Active Codebases** - Works best in repositories with regular changes
61+
62+
## Example Pull Requests
63+
64+
From the original gh-aw repository (83% merge rate):
65+
- [Extract action mode helper to reduce duplication](https://github.com/github/gh-aw/pull/13982)
66+
- [Simplify validation config code for clarity](https://github.com/github/gh-aw/pull/13118)
67+
68+
## Customization
69+
70+
You can customize the workflow by editing the source file:
71+
72+
```bash
73+
gh aw edit code-simplifier
74+
```
75+
76+
Common customizations:
77+
- **Change schedule** - Adjust how often it runs (default: daily)
78+
- **Modify scope** - Change the time window for recent changes (default: 24 hours)
79+
- **Add language-specific rules** - Include conventions specific to your project's languages
80+
- **Adjust validation** - Customize test, lint, and build commands for your build system
81+
82+
## Configuration
83+
84+
The workflow uses these default settings:
85+
86+
- **Schedule**: Runs daily
87+
- **Scope**: Analyzes code changed in the last 24 hours
88+
- **PR Labels**: `refactoring`, `code-quality`, `automation`
89+
- **Timeout**: 30 minutes
90+
- **Expires**: PRs auto-close after 1 day if not merged
91+
92+
## Tips for Success
93+
94+
1. **Review Promptly** - The workflow creates PRs that expire in 1 day, so review them quickly
95+
2. **Trust the Tests** - The workflow validates all changes with your test suite
96+
3. **Provide Feedback** - Close PRs that miss the mark; the workflow learns from patterns
97+
4. **Set Clear Conventions** - Document coding standards in your repository for better results
98+
5. **Start Small** - Run it for a week to see the kinds of improvements it suggests
99+
100+
## Source
101+
102+
This workflow is adapted from [Peli's Agent Factory](https://github.github.io/gh-aw/blog/2026-01-13-meet-the-workflows-continuous-simplicity/), where it achieved an 83% merge rate across 6 PRs in the gh-aw repository.
103+
104+
## Related Workflows
105+
106+
- [Update Docs](update-docs.md) - Maintains documentation automatically
107+
- [Daily Test Coverage Improver](daily-test-improver.md) - Improves test coverage
108+
- [Daily Performance Improver](daily-perf-improver.md) - Optimizes code performance

0 commit comments

Comments
 (0)