Keeping Agent Edits Clean in Prettier and ESLint
Prettier and ESLint Should Decide the Diff
A coding agent finishes a small React change, and the diff suddenly contains reordered imports, different quotes, and a disabled lint rule. The feature might work, but now reviewing six lines of behavior means reading sixty lines of formatting churn. My rule is simple: the agent proposes code; repository tooling decides whether that code belongs.
Here is the comparison I use for a TypeScript repository: the same requested change, the same model, and two workflows. These are reproducible approaches, not benchmark results. The task is adding a loading state to an existing component without changing unrelated files.
Prompt-Only Instructions Beside an Enforced Check Loop
On the prompt-only side, I tell the agent to follow existing style, use Prettier, and obey ESLint. It reads the component and edits it. This is fast to start, but success depends on whether the agent discovers the right configuration, remembers every instruction, and actually runs the tools.
On the enforced-loop side, I give it the same task plus explicit completion gates: inspect repository instructions, edit only relevant files, format those files, run lint and tests, then inspect the diff. The extra setup is small; the important difference is that compliance becomes observable.
- Prompt-only completion means the agent believes its changes follow conventions.
- Enforced-loop completion means named checks passed against the actual changed files.
- Neither workflow proves correctness, so behavior still needs appropriate tests.
Put the Repository Contract Where the Agent Reads
I keep canonical commands in package.json and explain them in the repository instructions supported by the chosen agent. For Codex, that can be AGENTS.md; for Claude Code, CLAUDE.md. Do not assume every client reads the same file automatically. Keep shared guidance synchronized rather than maintaining contradictory copies.
The contract should say which package manager to use, which workspace owns the change, and which commands are required. For example: use npm ci for a lockfile-backed install, npm run format:check for formatting verification, npm run lint for linting, and npm test for behavior checks. Define those scripts first; their names alone guarantee nothing.
I also state two boundaries explicitly: do not disable lint rules to make a task pass, and do not reformat unrelated files. If a rule genuinely blocks the requested behavior, report the conflict instead of quietly editing configuration.
Compare Both Workflows on the Same Component
For the prompt-only run, start from a clean branch and ask for the loading state. Record the changed files, check output, and any unrelated edits. Reset to the same starting commit before trying the enforced loop. Keep the model and task identical so you are comparing workflows rather than changing several variables.
For the enforced run, require this sequence in the task:
- Read the nearest repository instructions and relevant formatter configuration before editing.
- Implement the loading state without changing unrelated components or configuration.
- Run the repository formatter in write mode on changed supported files.
- Run lint and relevant tests, then fix failures introduced by this patch.
- Inspect git diff --check and git diff before reporting completion.
If checks already fail on the starting commit, record that baseline. An unavailable dependency or missing credential is not a passing test. Ask the agent to report exact commands, outcomes, and remaining blockers.
Keep the Check Loop When Switching Models
Fluxo gives my terminal workflow one key and one base URL, https://api.fluxorelay.com, across Claude, GPT, Gemini, DeepSeek, Kimi, GLM, Qwen, Grok, and more. It works with Claude Code, Codex, Gemini CLI, and any OpenAI SDK. I can compare Claude Sonnet 5.5 with GPT-6.1 Sol while keeping the repository gates unchanged.
Usage is billed per real token, including cache reads and writes, with no monthly fee. Users also earn a referral share when people they invite pay. If you want to try this workflow across models, you can create a Fluxo account.
Verdict: Enforce Checks, Keep Prompts Short
The enforced loop wins because it replaces stylistic promises with inspectable evidence. Prompt instructions still explain intent, but formatter output, lint results, tests, and a reviewed diff define completion. Put those same checks in CI, and agent forgetfulness stops being a merge policy.