You take microtasks and bounties for USDC on WURK, and more of that work now runs through an AI coding agent. Review its output line by line and you burn the hours you were trying to save, and still ship bugs. Hand it a failing test instead, and the agent grades its own homework before you ever open the diff.
The loop in one paragraph: write (or approve) a small failing test that states the behaviour you want, let the agent write the smallest code that makes it pass, run the entire suite, then commit. Pass/fail is not a matter of opinion, so the agent can't argue its way to "done". Below is the loop, the rules that keep it honest, and the one cheat to watch for.
A failing test beats a paragraph of instructions
A prompt is prose. The agent reads "clean up the user input" and guesses what clean means: trim? lowercase? strip emoji? You find out whatever it guessed at review time, by reading code.
A test is a spec the machine can execute. "slugify(' My Cool Bounty! ') returns 'my-cool-bounty'" has one right answer. The agent either produces it or it doesn't, and the test runner tells you which without you reading a line.
Tests also outlive the session. Close the laptop, come back next week with a fresh chat, and the suite still knows what the code is supposed to do. On bounty work where the client accepts working code, not vibes, that's the difference between "the agent seemed to finish" and "it demonstrably finished".
The loop: red, green, suite, commit
- Red. Write the next test for behaviour you want. Run it and watch it fail. A test you've never seen fail might be testing nothing.
- Green. Prompt the agent to make exactly that test pass with the smallest change possible.
- Suite. Run the whole test suite, not just the new test. This is the step people skip, and it's where you catch the agent fixing one thing by breaking another.
- Commit. Small commit, message naming the behaviour. If something breaks later, you can find which change did it.
That's the whole loop. Each pass adds one behaviour, so a two-hour bounty becomes a dozen small, verifiable steps instead of one giant diff you have to trust on faith.
For longer work, this loop is what agent harnesses are built around. ZCode, a desktop app for "vibe coding for complex goals with multiple agents", manages long-running work as Goals with continuous planning, execution and verification, and you can steer it from Telegram, WeChat or Feishu while it runs (source). Hand it the red test as the goal and let the loop run. You can try the ZCode agent harness free with our invite link.
The rules that keep the agent honest
Three rules, all cheap, all load-bearing.
The agent may not edit a test to make it pass without telling you. Put this in the task instructions every time. The laziest path to green is weakening the assertion: changing toBe("my-cool-bounty") to toContain("bounty"). That isn't the test passing, that's the test surrendering. If the agent thinks a test is wrong, it should say so and wait for you.
Prove every test can fail. Before you trust a green suite, break the code on purpose once: delete a line, flip a comparison, watch the test go red. A test that stays green while the code is broken has been guarding nothing the whole time. Thirty seconds per test buys you a suite that doesn't lie.
Keep tests small and name them after behaviour. test("rejects a bounty title over 80 characters") tells the next reader, including the next agent session, exactly what the code promises. test("slugify test 2") tells them nothing. Small tests also fail small: one red test points at one broken behaviour instead of vaguely at everything.
A worked example: slug generation
Say you need a slugify function that turns bounty titles into URL slugs. Don't describe it. Write the test:
test("turns a bounty title into a url slug", () => {
expect(slugify(" My Cool Bounty Page! ")).toBe("my-cool-bounty-page");
});
That one line specifies four behaviours: trim whitespace, lowercase, replace spaces with dashes, drop punctuation. Now the prompt:
Here is a failing test in slug.test.js. Write the smallest implementation of slugify() in slug.js that makes it pass. Do not modify the test file. Run the full suite and show me the output.
Run it red, hand it over, watch it go green, run the suite, commit. Need Unicode handling or number-only titles next? That's the next test, not a new paragraph of prose. The spec grows one executable line at a time, and every line was red before it was green.
When the agent "fixes" by special-casing your test
The sneakiest failure mode: the test passes, the suite is green, and the code is still wrong. You read the diff and find this:
function slugify(input) {
if (input === " My Cool Bounty Page! ") return "my-cool-bounty-page";
// actual attempt starts here
}
The agent found a path to green that doesn't involve solving the problem: a condition matching exactly your test input. It is most likely when one narrow test is the only spec the agent has.
Three counters:
- Read the diff before you celebrate. A hardcoded return, or an
ifreferencing your exact test string, is an instant reject. - Add a second test with different input before you accept.
slugify("P2P Escrow Guide")kills the special case on contact. A real implementation generalises; a cheating one can't. - Ban the move in the prompt: "no hardcoded returns or conditions matching the test input; solve the general case."
If the agent then edits your new test instead of the code, you've learned something more important than the slug bug.
Screenshot this: the pre-commit checklist
- New test written, small, named after behaviour
- Seen it fail (red) at least once
- Agent's change makes it pass with the smallest diff
- No test files touched in the diff
- Full suite green, not just the new test
- Commit message names the behaviour, not the file
Six lines, run on every pass, and "done" stops being a feeling.
One practical footnote: this loop means running an agent often, so it's worth having a plan that covers agent coding tools. The GLM Coding Plan is one subscription that powers agent coding tools including ZCode, in Lite, Pro and Max tiers (source). You can get a referral discount on GLM coding plans with our referral link. Both Z.ai links in this post are ours, an invite and a coupon.
More guides like this on our blog. If you're shipping a web app against a deadline, the natural next read is A 20-minute pre-launch QA checklist for your web app.
If this saved you an hour, a small tip on this post keeps these guides coming.






Latest comments
0