DEV Community

QuickStrats
QuickStrats

Posted on

How to Build Your First AI Loop — A 5-Minute Guide for People Who Don't Write Code

Last week I explained what Loop Engineering is. If you missed it: it means giving AI a goal, tools, and rules — then letting it check its own work until it's done, without you driving every step.

This week I'll show you how to build one. No Python. No API keys. Just tools you already have.


The Simplest Loop You Can Build Today

You need three things:

  1. A task with a clear right-or-wrong answer
  2. A way for the AI to check its own work
  3. A hard stop

Here's the template:

You are an editor. Your job is to fix every sentence in this article that starts with the same word as the previous sentence.

Rules:
1. Read the article below
2. Find every group of 3+ consecutive sentences that start with the same word
3. Rewrite those sentences so no 3 in a row start the same way
4. After rewriting, re-read the article and count again
5. If you find fewer than 3 violations, stop. You are done.
6. If there are still violations, fix them and check again
7. Stop after 5 rounds even if not perfect

Article:
[paste your article here]
Enter fullscreen mode Exit fullscreen mode

That's a loop. You didn't write a single line of code. You described the goal, gave the AI a way to check, set a hard limit, and walked away.


Why This Works Better Than "Fix This Please"

If you paste an article into Claude or ChatGPT and say "make this better," you get one output. You read it. You find things to fix. You ask again. That's prompt engineering — you are the evaluator.

With the loop template above, the AI reads its own output. It counts repeated sentence starts. It decides whether it's done. You come back when it's finished.

Same task. Different approach. The loop version usually produces cleaner output because the AI catches things you would have missed.


The 5 Components Every Loop Needs

I talked about this in the first article, but here it is applied to an actual task:

Component What it means Bad example Good example
Verifiable goal Something you can count or test "Make it better" "No 3 consecutive sentences start the same way"
Context The AI remembers what it tried Starting from scratch each round "Re-read the article and count again"
Tools What the AI can use Giving it everything Just the article + editing permission
Evaluation How it checks success "Does this feel right?" "If fewer than 3 violations, stop"
Hard stop When to quit "Keep going until perfect" "Stop after 5 rounds"

Every working loop has all five. Every broken loop is missing one.


Three Loops You Can Use Right Now

Loop 1: The Transition Word Checker

You are a writing coach. Your job is to make sure at least 25% of sentences contain transition words (however, therefore, meanwhile, for example, in contrast, as a result, etc.).

Rules:
1. Count total sentences in the article
2. Count sentences with transition words
3. If the percentage is below 25%, add transition words where they fit naturally
4. Re-count after editing
5. Stop when transition word percentage > 25% OR after 5 rounds
6. Do not force transition words where they make writing awkward

Article:
[paste here]
Enter fullscreen mode Exit fullscreen mode

Loop 2: The Link Checker

You are a quality assurance checker. Your job is to verify every external link in this article works and is relevant.

Rules:
1. List every URL in the article
2. For each URL, describe what it links to based on the URL structure and anchor text
3. Flag any link that appears broken, irrelevant, or points to a suspicious domain
4. Flag any link where the anchor text doesn't describe the destination
5. Stop when no flags remain OR after 3 rounds

Article:
[paste here]
Enter fullscreen mode Exit fullscreen mode

Loop 3: The Format Cleaner

You are a formatter. Your job is to make sure this article follows a consistent format.

Rules:
1. Check that every H2 is followed by body text, not another heading
2. Check that no paragraph is longer than 4 lines
3. Check that every image has alt text
4. Fix any format violation you find
5. Re-check after fixing
6. Stop when format is clean OR after 5 rounds

Article:
[paste here]
Enter fullscreen mode Exit fullscreen mode

Copy any of these into Claude or ChatGPT, paste your content, and let it run. These aren't theoretical — I use the transition word checker on every article I publish.


When Loops Go Wrong

Not every task is loop-shaped. Here's when NOT to use one:

  • Judgment calls. "Does this headline sound good?" The AI can't read minds. Skip the loop and check yourself.
  • Creative work. "Write a funny tweet about productivity." Humor is subjective. One-shot it.
  • Vague goals. "Make the article more engaging." What does "engaging" mean? If you can't define it, the loop can't check it.

The most common loop failure: the goal isn't actually verifiable. The AI spins in circles because you told it to chase something it can't measure. Before you build a loop, ask yourself: "Could I pay a stranger to check this?" If you couldn't give a stranger clear pass/fail criteria, skip the loop.


What To Do Next

Pick one article you've already written. Copy the transition word loop above. Paste it into Claude or ChatGPT with your article. Let it run.

Watch what happens. Did it stop after one round? Three rounds? Did it hit the 5-round limit? Did the output actually improve?

The first time you walk away from your keyboard and come back to a finished result, you'll understand why Loop Engineering matters. It's not about saving time — it's about the AI catching things you never would have caught, because it checks systematically and you check intuitively.


Next in This Series

In Part 3, I'll show you how to chain multiple loops together — a writing loop feeds into a formatting loop feeds into a link-checking loop. That's when you start running a content production line instead of writing individual articles.


Follow QuickStrats on dev.to for more practical AI guides. No jargon. No hype. Just what actually works.

Also on my blog: Compare Game Key Prices — Save 50%+ With These Free Tools

Top comments (0)