Build the Feedback Loop First
Retrofitting CI, linting, Prettier, and regression tests into a mature codebase so the repository catches broken changes before a person has to.
I just finished adding CI, linting, Prettier, and the first frontend tests to a mature project. On paper it was a modest list:
- add a pull-request CI workflow
- move the web app off the deprecated
next lint - add Prettier
- set up component tests for the frontend
- write the first real UI regression test
- turn on formatting checks in CI
None of it was product work, and every item cost more than it would have on day one. I did it for the agents working in that repo. A person can remember the one lint warning nobody fixes, click around the UI to see if anything feels off, and decide a diff is probably fine. An agent can do some of that, but not the same way twice. I wanted checks that pass or fail on their own, every time: does the change format, lint, build, and pass the tests?
Prettier on an old repo touched 171 files
On a new project you pick a formatter config and move on. On a mature one, the code already has a style, or several: files written years apart, by people with different habits. So we tried several Prettier configs and measured how much each one would change:
- the least disruptive setup still touched
171files and changed5,256lines - the best setup with
120-character lines touched217files and changed7,525lines - the configs that made everything uniform changed even more
On a live repo, each of those lines is noise in
review, a chance of a merge conflict, and a git blame entry that now points at
a formatting commit.
The rollout had to go in order
We couldn't turn on a strict format:check right away, because main itself
didn't pass it. So the order was fixed: CI first, then explicit linting, then
Prettier installed without reformatting anything, then the frontend test setup
and the first regression test, then the full formatting sweep, and only then
formatting checks in CI.
Each step left the repo half-done on purpose. Prettier installed without reformatting the repo is fine, as long as the PR says that's where it stops and nobody mistakes it for finished.
Even the sweep had to wait for the testing PRs to merge. A 171-file mechanical diff landing first would have turned two focused branches into rebase work. On a new project, none of this ordering would have mattered.
Testing the autocomplete retry
The first frontend bug we wanted a test for was small and easy to see: after one failed autocomplete request, the next attempt should still work.
The fix was easy. Testing it wasn't, because the web app had no way to run UI behavior checks. Before we could write the test, we had to build a browser-like test environment and prove it worked with a smoke test.
Why this matters more with agents
When an agent writes diffs faster than the repo can check them, the bottleneck moves to review, testing, and integration, which means it moves to a person. Every agent change lands on someone's desk: did it break the build, add a lint error, break the UI? Without CI, the only way to know is to look.
Each check takes one of those questions off the desk:
format: nobody decides or argues about stylelint: small structural mistakes fail in secondstest: the suite checks behavior instead of someone assuming itbuild: integration failures show up before review- CI: all of it runs on every PR, not when someone remembers
What I'd set up on day one
If I started a new project tomorrow, I'd set this up before writing features:
- a pull-request CI workflow
- one local command that runs the same checks CI runs
- a linter I call directly, not a framework wrapper that can get deprecated
under me the way
next lintdid - a formatter, before styles drift apart
- at least one frontend or component-test setup, before the UI gets complicated
Once the full loop was in place on this project, the payoff showed up fast. An agent opened a PR that broke a lint rule. CI failed, the agent read the failure, fixed the import, and pushed again. The PR merged green, and no person touched it.