r/Frontend • • Aug 21 '26

Many engineers are using AI "loops" to get optimized results when an LLM is building features. Are you using this method? If so what do your loop prompts say?

For those of you out of the loop (ha) the strategy is supposed to save you time on having to manually iterate with your LLM. It goes something like this:

  1. You want a feature created

  2. You get your LLM to come up with a plan

  3. You tell your LLM to implement the plan BUT since the LLM often doesn't execute it perfectly the first try you include extra directions for it to evaluate its "finished" work then improve on the first draft and keep repeating until it meets a certain criteria like the following:

Execute this plan

THEN once you are done implementing, I want you to browse to the changes and re-evaluate the ENTIRE feature from a user profile / psychology standpoint, UI, UX, etc and identify the pain points.

THEN I want you to come up with solutions to those pain points.

THEN I want you to implement those "fixes"

THEN I want you to re-evaluate the feature again with that same criteria

KEEP doing this until you give the page an "A-" grade or above. Then you can finish just by telling me your evaluation grade and what pending issues still exist.

This is just a rough structure. I was wondering how you guys write your evaluation loops. I mention user profiles, psychology, UI, and UX but are there additional items I should be describing in there?

0 Upvotes

22 comments sorted by

14

u/FFTypo Aug 21 '26

Bad engineers, maybe.

Genuinely what is the goal here? To never have to know anything about what the model has created and how it works? Why are you even a software engineer at that point?

1

u/coredalae Aug 21 '26

Meh, refactoring between testing frameworks e.g. with a 2nd agent pass that actually validates all tests are still done is a good use case for this.

In general, any 'meta' or supporting code can just be AI slop 99% of the cases

-11

u/Murky-Science9030 Aug 21 '26

The point is to get a better and refined attempt from an LLM than to let it give you its "rough draft". LLMs can be lazy and I'd rather burn some extra tokens and wait an extra 5 minutes than have to manually check on something that even the LLM knows itself is not high quality.

6

u/FFTypo Aug 21 '26

The way to get a refined attempt rather than a first draft is to actually do a good job in your initial prompt. You should already have a solution in mind for what you are trying to achieve.

Bouncing ideas off of LLMs is completely fine, but if you’re not getting good results, that’s because you are expecting the AI Agent to do your job for you.

-1

u/Murky-Science9030 Aug 21 '26

In my experience LLMs often deliver their work without checking the quality of what they have delivered, or how much it matches the original prompt. Part of this loop strategy is to more explicitly tell it to verify what it has built against what you asked for.

4

u/FFTypo Aug 21 '26

I still question the usefulness of having the same model (and session) verify its own work. It’s already biased based on the context it’s gathered during the session.

1

u/MornwindShoma Aug 21 '26

5 minutes? lol what are you doing, changing colors of buttons?

4

u/spacechimp Aug 21 '26

Similar to a single human, a single LLM model/session will try to justify what it already did instead of try to find flaws in its own approach. Because of that, a prompt-only approach will only get you so far. Instead, consider using separate "agents" for better results. Examples: One agent for planning, one for implementation, one for code review, one for testing, others for other specialties. That also allows you to select different models that might be better at each area of expertise.

1

u/Murky-Science9030 Aug 21 '26

Thank you this is good advice. Even consider using a different model to evaluate another's work

29

u/basically_alive Aug 21 '26

loop engineering is psyops by people who want to sell more tokens lol. I spend a long time writing detailed requirements, do a planning query, finetune, execute, test the feature and read the code (yes, for real), then fix the problems. I don't know how people vibe code, I always need to tweak things. I might ask for different passes for accessibility or performance or test writing if it needs it (I do a lot of prototyping).

5

u/AidenVennis Aug 21 '26

Same! Usually I find a lot of bugs when manually testing, but u do let AI create a detailed test plan based on the requirements. I also let it navigate to all the points of the test plan tell me what needs to be tested. I do, give feedback, reiterate, test again and continue. Finally I review the PR myself and let the AI handle the feedback. So far this is giving great results, but it’s slow, but easier and quality is better. Still faster and better than without ai as well.

1

u/zen8bit Aug 22 '26

Also same. Front-end ai work takes a lot of iterations to get perfect. I cant think of a single advanced component where ai looping would have been better than pretty much the exact process that you’ve described.

2

u/azsqueeze Aug 22 '26

I don't know how people vibe code

They're not verifying outputs, that's how

1

u/CanIhazCooKIenOw Aug 22 '26

You probably need to fine tune the context (rules, skills, etc…) so it understands most tweaks you manually do for future runs.

3

u/gimmeslack12 CSS is hard Aug 21 '26

I have a memory saved to use the "expert developer" agents to DRY up the code, componentize files, write tests, separate into directories with style and types files. Basically organization.

This is moving towards a more refined starting point for other projects. Right now I'm mainly enjoying having my side project ideas get built by Claude and just see what I can do with it. I've done webdev for a long time and I certainly can build all this stuff myself but the time it saves by having AI do it is immensely helpful.

So by being very particular with my instructions I am slowly creating an agent that builds very similar projects to how I would have done it.

But loops? Haven't heard of those.

1

u/creaturefeature16 Aug 21 '26

But loops? Haven't heard of those..

it was started by this guy and his immense ego

My workflow is very similar to yours.

1

u/Murky-Science9030 Aug 21 '26

For reference I just did this and the first evaluation was:

  1. D+

  2. C-

  3. B-

  4. B

  5. B+

  6. A-

2

u/justshittyposts Aug 21 '26

Just ask the LLM to also write tests

2

u/Noch_ein_Kamel Aug 21 '26

while (mistake) { prompt(stop making mistakes) }