# Pay down a refactor

Pay down a refactor: Apply one convention across a whole repo, file by file, without stopping other work to do it.

Source: https://codeherder.com/use-cases/pay-down-a-refactor/

Use cases

Apply one convention across a whole repo, file by file, without stopping other work to do it.

[Request access →](https://codeherder.com/get-started/#request-access)

Counted from this repository's own history.

## The work

Name the convention and where it should apply. An agent finds every place the old pattern still lives, applies the new one, and opens a pull request for the change. A person reviews the diff against the rule before it merges.

## Why it stalls

A repo-wide convention change touches too many files for one sitting, and too few files at a time to feel worth scheduling. So it keeps losing to work with a deadline attached.

How it runs

## Plan, code, review, merge, verify

1. plan Reads the convention and finds every site in the repo where the old pattern still applies.
2. code Applies the new convention site by site, and adds a check that stops the old pattern from creeping back.
3. review Checks each changed site against the stated rule. Matching the old code it replaced isn't the bar.
4. merge Opens a pull request limited to the convention named.
5. verify Confirms the old pattern is gone and the new check catches it if it comes back.

## What you need on hand

- The convention, stated as a rule
- Where it should and should not apply
- A person to review the diff against that rule

## Proof, not a promise

290 Go packages in this repo, one vertical slice each: real scale for a convention to apply across.

Don't know what to write

## Two ready-to-file briefs for this job

[One thing has two names; give it one Name the two terms that mean the same thing, and get the whole codebase moved to one of them.](https://codeherder.com/starter-briefs/give-one-thing-one-name/) [Pull one duplicated block into one place Point at the same logic copied into more than one place, and get it merged into one shared version.](https://codeherder.com/starter-briefs/pull-duplicated-code-into-one-place/)

[See every starter brief →](https://codeherder.com/starter-briefs)

Keep going

## Related jobs

[Cover untested code Point an agent at a file with no tests, and get a real test suite back instead of a promise to write one later.](https://codeherder.com/use-cases/cover-untested-code/) [Keep the docs true Have an agent check a doc page against the code it describes, and fix the parts that drifted.](https://codeherder.com/use-cases/keep-the-docs-true/) [Run the routine chores Hand off dependency bumps, migrations, and lint fixes: the chores every repo needs and nobody wants to own.](https://codeherder.com/use-cases/run-the-routine-chores/)

[← See every job](https://codeherder.com/use-cases)
