Everyday Programmer
AI Workflows

AI Pairing Loops for Senior Frontend Engineers

A practical workflow for using AI to inspect, draft, refactor, and verify without skipping ownership.

3 min readAI Workflows, Practice

AI pairing gets better when it becomes a loop instead of a wish. Senior engineers do not need a magic prompt. They need a repeatable way to move from context to change to verification without giving up judgment.

The loop I use is simple: inspect, frame, draft, reduce, verify, and record what changed.

Loop 1: Inspect before asking for code

Start by asking the assistant to read the relevant files and summarize the current design. This turns the first exchange into shared context instead of premature implementation.

inspect-prompt.md
md
 1  Read the route, content helper, and card component.
 2  
 3  Return:
 4  1. The data flow
 5  2. The component boundaries
 6  3. Any hardcoded links or duplicated source of truth
 7  4. What tests or build checks cover this path
 8  
 9  Do not propose a patch yet.

Loop 2: Frame the change

Once the current shape is clear, write the smallest useful brief. The brief should name the outcome, constraints, and verification path.

For example:

  • Outcome: homepage article cards come from MDX posts.
  • Constraint: links must be generated from slugs.
  • Constraint: styling remains token-only.
  • Verification: build succeeds and article routes exist.

This gives the assistant a job that can be checked.

Loop 3: Draft narrowly

The best AI-generated patches are small. I ask for one behavior change at a time, then review it like any other diff.

draft-prompt.md
md
Update the homepage so the latest article cards are derived from getAllPosts().
Map title, description, date, readingTime, tags, and slug into ArticleCard props.
Do not change the visual design.

A narrow draft reduces the surface area for accidental rewrites.

Loop 4: Reduce the patch

After a draft lands, I usually ask the model to critique its own diff for unnecessary changes.

Useful reduction prompts include:

  • Which edits are unrelated to the requested behavior?
  • Did this introduce a new abstraction that is not needed yet?
  • Can any hardcoded value be derived from existing content data?
  • Does the patch keep the same component contract?

Loop 5: Verify with real commands

The loop is not complete until the code runs. For a content-driven site, that usually means checking the generated routes and running the production build.

verify.sh
sh
pnpm build

For component work, I extend verification with Chromatic. An AI-generated component can look correct in one state and wrong in another. Visual snapshots across every variant make that visible before the PR merges.

If verification fails, feed the real error back into the next loop. Do not summarize what "should" work when the toolchain is telling you what actually happened.

Loop 6: Record the invariant

When a bug came from duplicated truth, the fix should leave an invariant behind. In this case, the invariant is: homepage article links come from getAllPosts(), so they point at real MDX-backed slugs.

That invariant is more important than the specific three articles. It prevents the next broken homepage link.

A senior engineer still owns the decision

AI can inspect faster, draft faster, and remember boring constraints. It cannot own product intent, architecture taste, or production accountability.

Use the loop to increase leverage, then keep the parts of engineering that require judgment firmly in human hands.

AI Workflows Practice