Menu

Prefer patch-sized agent edits for form validation rules
📰

Prefer patch-sized agent edits for form validation rules

DEV Community: react·Sherotree·10 days ago
#PQl5THr5
#devtoreact#devto#dev#rule#validation
Reading 0:00
15s threshold

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…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.