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.
The brief
Copy this text as it is, or change the specifics to match your own case, then file it as a task.
Copy this and file it as a task
The same block of logic is duplicated in more than one place in this codebase, and they've started to drift slightly apart. Pull it into one shared place, update every call site to use the shared version instead of its own copy, and make sure nothing that depended on a small difference between the copies breaks.
The done checks
Paste these lines into the Acceptance criteria field of the task. Change them to match your own case.
Copy this into Acceptance criteria
- [ ] Only one copy of the logic exists - [ ] Every former call site uses the shared version - [ ] Each call site's own existing tests still pass
Why this works
It names a specific duplication rather than "reduce duplication" in general, so the scope is fixed: one shared version, every call site updated to use it. The existing tests at each call site are the check that nothing broke in the merge.
Plan, code, review, merge, verify
- plan
Compares every copy of the duplicated logic to find which differences are intentional and which are just drift.
- code
Extracts one shared version that covers every real requirement, and updates each call site to use it.
- review
Checks each call site's own tests still pass against the shared version, exercising every caller in turn.
- merge
Merges the change once checks pass. It resolves only this one duplication.
- verify
Confirms every former call site still behaves the way its own tests expect.
What you need on hand
- Where the duplicated logic lives, in every place it's copied
- Whether the small differences between the copies are intentional or drift
- A person to review the merged version against each original call site
Done when
- Only one copy of the logic exists
- Every former call site uses the shared version
- Each call site's own existing tests still pass
Proof, not a promise
No real task in examples.ts matches this brief's exact shape yet. What's real is the mechanism: an agent compares every copy of the duplicated logic before merging it, so an intentional difference doesn't get silently erased along with the accidental drift.
Related briefs
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.
Add a filter to a list we already have
Name the list and what you want to narrow it by, and get a working filter control for it.
Cover the one file nobody has tests for
Name a file with no test coverage, and get a real test suite for what it actually does.
Try it on one repository for two weeks.
File a task. An agent builds it. You see the cost of each task.