Agents love “fixing” forms. You ask for one rule — zip required before city on blur — and the PR rewrites the whole validation layer, swaps the library, and invents three new error keys nobody asked for.

I’ve started forcing patch-sized validation edits. One rule, one file when possible, same patterns as the neighboring fields. Smaller diffs review faster and break less.

What “patch-sized” means here

  • One rule per prompt (or one tightly related pair, like “required + format for email”)
  • Touch the existing validator / schema / onBlur helper — don’t introduce a second system
  • Reuse existing error copy keys and i18n paths
  • No new deps unless the ticket already approved them
  • Leave happy-path UI alone unless the rule literally needs a new affordance

If the agent can’t do that without a rewrite, the rewrite is a separate PR with its own review budget.

Prompt shape that keeps diffs small

Edit US zip-before-city validation in `shippingValidation.ts` only. Constraints: - Add one rule: on blur of city, require zip first (existing error key `errors.zipRequired`) - Do not change Checkout, Billing, or the shared schema package - Do not add zod / yup / new deps - Match the pattern used by `phoneRequired` in the same file - Show me the unified diff before writing other files If you need more than ~40 lines or a second file, stop and explain why. 

The last line matters. Agents expand scope quietly; a hard line-count stop makes them ask instead of “cleaning up” the file.

What I reject in review

Reject / send back

  • New validation library for one rule
  • Renamed every error key “for consistency”
  • Form component rewrite when only the rule changed
  • Shared schema change that ripples into Checkout with no ticket

Accept

  • Small diff in the existing validator
  • Same error key style as neighbors
  • Tests that cover the new rule (and only that rule) if the file already has them

Why this beats “just let the agent finish”

A full rewrite can look cleaner. It also:

  • Hides the one-line bug you actually wanted fixed
  • Mixes intentional rule changes with drive-by refactors
  • Makes bisect and revert painful

Patch-sized keeps the merge about the product rule. Refactors wait for a PR titled like a refactor.

Tiny habit

Next time you ask an agent to tweak form validation, paste the constraints above and demand a unified diff first. If the draft already spans three files, stop — narrow the prompt and try again. The rule you wanted usually fits in one patch.