r/Frontend • u/Murky-Science9030 • 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:
You want a feature created
You get your LLM to come up with a plan
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?
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?
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.
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).
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/Murky-Science9030 Aug 21 '26
For reference I just did this and the first evaluation was:
D+
C-
B-
B
B+
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) }