Refactor & architecture improver
Point the agent at a messy area and it reads your code, finds the shallowest module, writes a tiny-commit refactor plan, applies it behind your tests step by step, and drafts a PR — so debt comes down without behaviour changing.
Saves you ~6.3 h / run
How it works
- Trigger
- When you start the “Refactor” workflow.
- Job
- Find the deepening opportunity, plan tiny commits, apply behind tests.
- Outcome
- A tested implementation and pull request draft.
What it installs
Agents 2
-
Refactoring Agent
Reads the target area, writes a scoped tiny-commit refactor plan, applies it behind green tests, and drafts a PR.
-
Refactor & architecture improver Quality Reviewer
Checks primary evidence, domain controls, deliverable completeness, and communication quality, stopping the run when the work is wrong, unsupported, incomplete, or uncertain.
Teams 1
-
Refactor & architecture improver quality team
The delivery agents produce the work while an independent quality reviewer checks each workflow handoff against explicit evidence, domain, and communication requirements before the run can continue.
Workflows 1
-
Refactor
Find the deepening opportunity, plan tiny commits, apply behind tests, then draft a PR for approval.
Goals 1
-
Debt reduced safely
Bring technical debt down by deepening shallow modules without ever changing observable behaviour. Success looks like: Each assigned target lands a tiny-commit, behaviour-preserving refactor behind green tests with an approved pull request, and no refactor introduces a behaviour change.
Skills 3
-
improve-codebase-architecture
Surface deepening opportunities — refactors that turn shallow modules into deep ones — using the deletion test and the deep-module vocabulary (module, interface, depth, seam, adapter, leverage, locality), then deepen the one the user picks. Adapted from mattpocock/skills/improve-codebase-architecture.
-
request-refactor-plan
Produce a scoped, reviewable refactor plan as a sequence of the smallest working commits (Fowler), after checking test coverage and pinning current behaviour, with explicit scope and out-of-scope. Adapted from mattpocock/skills/request-refactor-plan.
-
domain-modeling
Actively sharpen the project's ubiquitous language while refactoring — challenge terms against the glossary, name seams in the domain's words, update the glossary inline, and offer an ADR only for hard-to-reverse, surprising trade-offs. Adapted from mattpocock/skills/domain-modeling.
Requirements
- Connected repository — The agent reads the target area, the surrounding code, and the test suite from your connected repository, and opens the refactor as a pull request. Until repository access is connected, it works from the code supplied as attachments and drafts the PR for you to open.
Setup guide
How to Improve Architecture With a Refactor Agent
Use an agent to find shallow modules, plan tiny behavior-preserving commits, run tests, and draft a refactor PR.
Read the setup guideDon't see your workflow? Describe it.
A sentence or two about a recurring job is enough. We design the playbook that runs it and show you exactly what it saves.