Phase 07 · AI-Assisted Engineering with Claude CodeLesson 3 of 4
Harness & Loop Engineering
Results depend on the system around the model, not just the model.
The problem
Two developers can use the exact same AI model and get completely different results. The difference is rarely the model; it's everything around it. Harness engineering is the practice of designing that surrounding system (context, tools, permissions and feedback loops) so the agent reliably produces good work.
The concept
Model + harness = results#
| Part | What it includes |
|---|---|
| Model | The LLM's raw capability |
| Context | What the agent knows: instructions, project notes, relevant files, examples |
| Tools | What it can do: read and edit files, run tests, search, call APIs |
| Permissions | What it's allowed to do without asking |
| Feedback loops | How it finds out whether its work is correct |
Feedback loops: the biggest lever#
An agent that can check its own work is dramatically more reliable than one that can't. Give it ways to verify:
- Tests: "run
uv run pytestafter every change and fix failures" - Type checkers and linters: catch whole classes of mistakes instantly
- Running the app: start the server and request the endpoint
- Screenshots for UI work: compare what's on screen with what was intended
Loop engineering: act → check → fix#
Instead of hoping for a correct answer in one shot, design a loop:
The check-and-fix loop
- Make a change
- Run the checkstests, lint, build
- Read the results
- Fix what failedthen run the checks again
Stop when all checks pass, or after N attempts, then ask a human
This turns "the model guesses" into "the model converges". Each iteration uses real evidence, not assumptions.
Good context beats long prompts#
- Specs over vibes: "Return 404 with
{"error": "not found"}when the ID doesn't exist" beats "handle errors properly". - Point to examples: "Follow the pattern in
routes/users.py." - Small tasks: a focused task with clear acceptance criteria is easier to get right than a vague large one.
- Persistent notes: project conventions in
CLAUDE.mdso you don't repeat them.
Permissions: safe by default#
Let the agent freely read files and run tests, but require confirmation for risky actions: deleting files, pushing to production, running database migrations, spending money. Good harnesses make the safe path the easy path.
Try it
Your task · about 10 minutes
Add one feedback loop to your agent setup, such as a test command or a linter, and ask Claude Code to keep going until it passes.
Recap & next
Key takeaways
- An agent's results depend on the model plus its "harness": tools, context, permissions and feedback loops.
- Give agents a way to check their own work, such as tests, linters, type checks or screenshots.
- Clear specs and small tasks beat long, vague instructions.
- Loops (act → check → fix) let agents converge on correct results instead of guessing once.
Quick check
2 questions · instant feedback
Go deeper
The full course on Claude Code
Udemy course
Claude Ecosystem - AI, Code, Cowork, M365 & Certification
View course (opens Udemy in a new tab)
Related videos
Finished this lesson?
Mark it complete to track your progress and keep your streak going.
