ProjekinAja. Agentic AI Stage 3 · Working With Agents Lesson 3.8
● Stage 3 · Lesson 3.8

Agentic Coding — Building Software with AI

The killer app of agents right now. Coding agents — Claude Code, Cursor, and friends — can read a codebase, write code, run tests, and fix their own bugs. If you drive them well.

⏱ ~16 min read 💻 The flagship use case 🛠️ Hands-on skill

🎯 By the end you'll understand

Why coding is the single best fit for agents today, what the coding-agent loop actually looks like step by step, the handful of tools these agents use, and — most importantly — how to drive one well: a clear brief, the right context, tests as the verifier, and reviewing the diff instead of trusting the summary.

KEY INSIGHTThe one idea to take away

Coding is the perfect agent task for one reason: the agent can check its own work. Code either compiles or it doesn't. Tests either pass or they don't.

Every skill you've learned in Stage 3 — briefing, scoping, supervising, verifying, steering — lands hardest here. A coding agent isn't magic. It's a tireless junior developer with photographic recall of your repo and an automatic feedback loop. Point it well and it's a force multiplier. Point it badly and it confidently ships broken code with a cheerful summary.

🔑 Hold onto this

The thing that makes coding agents work is verification that's built into the world. The compiler and the test suite are an honest, automatic verifier (Lesson 3.6) the agent can hammer against — over and over — without ever asking you. Your job is to make sure it's hammering against the right target.

CORE CONCEPTWhy coding is the best agent fit

Back in Lesson 1.6 you learned the recipe for a task where agents shine: a clear goal, a way to verify success, good tools, and reversible steps. Coding hits all four like nothing else:

IngredientWhy coding nails it
Clear goal"Make this test pass." "Add a logout button." Goals can be stated precisely, often as a failing test.
Instantly verifiableDoes it compile? Do the tests pass? The answer is objective, automatic, and arrives in seconds — no human needed.
Great toolsRead a file, search the repo, edit a file, run a shell command, run the tests. Mature, programmatic, fast.
Mostly reversibleVersion control. A bad change is one git checkout away from gone. You can let it experiment.

Compare that to "write me a marketing strategy." No compiler tells you if it's right. No test goes red. The agent can't self-correct because there's no signal to correct against. It writes something plausible, you have no automatic way to know if it's good, and the agent has no automatic way to improve it. Coding gives the agent a tight, honest feedback loop — and a tight feedback loop is what turns a guesser into a problem-solver.

There's a second reason coding works so well, and it's easy to miss: code is text, and text is exactly what these models are built for. A coding agent isn't reaching into some alien domain — it's reading and writing the same kind of structured language it was trained on by the billions of lines. The "world" it acts on (files, terminals, test output) is all text it can perceive directly and completely. There's no fuzzy camera feed, no robot arm that might miss. The agent's senses and the task's reality are the same medium. That alignment is rare, and it's a big part of why coding agents feel a generation ahead of agents pointed at messier domains.

💡 The deep reason

An agent is only as good as the loop it runs in (Lesson 2.1). Coding hands it a near-perfect loop for free: act → run tests → read the result → act again. That's why coding agents feel almost alive while a "write my essay" agent feels like a fancy autocomplete.

FRAMEWORKThe coding-agent loop, in practice

This is the agent loop from Lesson 2.1, made concrete for software. When you hand a coding agent a task, it runs roughly this cycle — sometimes for two steps, sometimes for fifty:

1

🔍 Understand the codebase

Search and read the relevant files. Where does the logic live? What patterns does this repo use? It builds a mental model before touching anything.

2

🗺️ Plan

Decide what to change and in what order. A good agent states the plan so you can correct it before it writes code.

3

✏️ Edit

Make the change — a focused diff, ideally, not a rewrite of the whole file.

4

🧪 Run the tests

Execute the suite (or the one relevant test) and read the output. This is the verifier doing its job.

5

👁️ Read the failure

If something's red, read the actual error message — not a guess about it. The error tells it exactly what to fix.

6

🔁 Fix → repeat

Adjust and re-run. Loop steps 3–5 until green. Then report what it did and why.

Notice steps 4 and 5: the agent isn't asking you whether it worked. It's checking against reality. That self-checking loop is the whole game — and it only works when the verifier (your test suite) is trustworthy.

The loop is also why coding agents handle their own mistakes so gracefully. A model will, fairly often, write a first attempt that's wrong — a typo, a wrong import, an off-by-one. With a chatbot that's the end of the story; you get a confident wrong answer. With an agent in this loop, the wrong attempt simply turns a test red, the agent reads the error, and it tries again. The failures don't disappear — they get caught and corrected before they ever reach you. What you see is the result after several quiet rounds of self-correction. That's a profound shift: you're no longer judging the model's first guess, you're judging the output of a loop that has already verified itself against an objective bar.

PRACTICALThe tools a coding agent reaches for

A coding agent is an LLM wired to a small, powerful toolbox — the "hands" from Lesson 2.2. The set is surprisingly small, and that's a feature:

ToolWhat it doesWhy it matters
read_fileOpens a file's contentsTo understand before editing
search / grepFinds where something lives across the repoTo navigate a codebase it's never seen
edit_fileChanges lines in a fileThe actual act of writing code
run_commandRuns a shell command (build, install, lint)To interact with the project like a developer would
run_testsExecutes the test suiteThe verifier — the most important tool of all

That's basically it. Read, search, edit, run, test. With those five verbs an agent can do almost anything a developer does at a keyboard. The intelligence is in which tool to call and when — that's the LLM brain making decisions inside the loop.

SEE ITA coding agent run, step by step

The task: "The checkout test is failing — fix it." Press ▶ Step to advance one move at a time, or Run all to watch the whole loop. Notice the agent runs the tests before and after the fix — letting the suite be the judge.

💻 Coding Agent Run · "fix the failing checkout test"

Watch the loop: understand → test (red) → read → edit → test (green) → done.

Ready. Press Step to begin.
1

🔍 Understand the repo

Search for the checkout logic and its test to learn how the code is shaped.

2

🧪 Run the tests

Get a baseline. Expect to see the failure first-hand, not assume it.

3

📖 Read the file

Open checkout.js and the failing test to find the actual bug.

4

✏️ Edit the bug

Apply a focused one-line fix to the total calculation.

5

🧪 Re-run the tests

Verify the fix against the suite. The verifier has the final say.

6

✅ Done

Tests green. Report the change and the diff for review.

Agent

Illustrative run. A real agent's tool calls and output look very similar — the shape of the loop is exactly this.

PRACTICALHow to drive one well

Here's where everything in Stage 3 pays off. The difference between "this agent is incredible" and "this agent wasted my afternoon" is almost never the model — it's the driving. Run this checklist:

📝

Write a clear brief (3.2)

Not "improve checkout." Say what done looks like: "the checkout.total test should pass; don't change the API." A failing test is the perfect brief — unambiguous and verifiable.

📍

Point it at the right context (3.3)

Name the files, the test command, the conventions. The agent reads what you give it — feed it checkout.js and the test, not the whole 200-file repo. Right context beats more context.

🎯

Let tests be the success criteria (3.6)

Define "done" as a test going green. Now the agent has an honest verifier it can run itself, and you have an objective bar — no vibes-based "looks good to me."

🔬

Review the diff, not the summary (3.6)

The agent's chipper "✅ All fixed!" is a claim, not proof. Read the actual change. Did it fix the bug — or delete the test? Did it touch files it shouldn't?

🛞

Steer when it drifts (3.7)

Going down a rabbit hole or over-engineering? Interrupt early. "Stop — simpler. Just change the one function." A short correction now beats untangling a mess later.

📦

Keep the task scoped (3.5)

One coherent change per run. "Fix the checkout bug" — not "fix checkout, add a feature, and refactor auth." Small scope = reviewable diff = catchable mistakes.

▸ The driver's mantra

Clear brief → right files → tests as the bar → review the diff. Master those four and you'll get more out of a coding agent than most engineers do — because most skip straight to "go" and trust the summary.

COMPARISONCLI, IDE, and copilot — three autonomy levels

"Coding agent" covers a range. They differ mostly in how much autonomy they take — the same spectrum you met in Lesson 1.2:

FormExampleAutonomyBest for
CLI agentClaude CodeHigh — runs the full loop, edits many files, runs tests itselfReal tasks: "fix this bug," "add this feature," end to end
IDE agentCursor, agent modeHigh, inside your editor — you watch and approve as it goesMulti-file changes where you want to see edits land live
Inline copilottab-completion suggestionsLow — suggests the next line; you stay in the loopFast typing, boilerplate, staying in flow yourself

More autonomy isn't automatically better. A copilot keeps you fully in control for delicate code; a CLI agent crushes a well-scoped chore while you do something else. Match the autonomy level to the stakes (Lesson 3.4) — and to how much you trust the verifier for this particular task. A change covered by a solid test suite is safe to hand off at high autonomy. A change to code with no tests, on a critical path, with effects that are hard to undo? Dial the autonomy down and watch every step.

A coding agent doesn't replace the developer. It replaces the typing — and the tedious round-trips of run, read error, tweak, run again. The judgment stays yours.

That's the honest mental model. The agent is extraordinary at the mechanical loop and surprisingly good at the local reasoning inside it. What it lacks is your sense of the whole: whether this is even the right change, whether the architecture is heading somewhere sane, whether a passing test is testing the thing that actually matters. Those are exactly the calls a person who can read code makes — which is why this tool multiplies that person's output instead of substituting for them.

WEAKNESSCommon mistakes to avoid

✗ Merging code you didn't review

The agent writes plausible code, which is not the same as correct code. It can confidently produce something that compiles, passes, and is subtly wrong. The summary is a sales pitch; the diff is the truth. Read it before you merge — always (3.6).

✗ Letting it edit tests to make them pass

When "done" means "tests green," an agent under pressure may take the shortcut you didn't intend: weaken or delete the test. Now the verifier is corrupt and the bug is still there. Watch for changes to test files you didn't ask for — that's the verifier being gamed (a classic reward-hacking trap from 3.6).

✗ Running with no version-control safety net

Reversibility is half of why coding suits agents (1.6). Let an autonomous agent loose on an uncommitted, un-backed-up project and a bad run can destroy hours of work. Commit first. A clean git status is your undo button.

KEY INSIGHTWhere this connects in your course

  • Good agent tasks (1.6) — coding is the textbook fit: clear goal, verifiable, good tools, reversible.
  • The loop (2.1) — understand → edit → test → read → fix → repeat is that loop made concrete.
  • Tools (2.2) — read_file, search, edit_file, run_tests are the agent's hands.
  • The brief (3.2) — a failing test is the clearest brief you can write.
  • Context (3.3) — point it at the right files, not the whole repo.
  • Verification (3.6) — tests are the verifier; review the diff, never just the summary.
  • Steering (3.7) — interrupt and redirect when it over-engineers or drifts.
  • Building your own (4.7) — when you assemble agents yourself, you'll wire these same tools and loops.

Honest framing to carry out: a coding agent is a force multiplier for people who can read code and verify. It doesn't replace understanding — it amplifies it. You still own the result. The engineers who win with these tools aren't the ones who trust them most; they're the ones who drive them best.

GLOSSARYKey terms introduced

Coding agent
An AI agent that builds software by reading code, editing files, running commands, and running tests in a loop until the goal is met.
Diff
The exact set of line-by-line changes a code edit makes. Reviewing the diff — not the agent's summary — is how you verify what really changed.
Test-driven verification
Defining success as a test going green, so the agent has an objective, automatic verifier it can run itself.
Codebase context
The files, conventions, and commands the agent reads to understand a project before changing it. Right context beats more context.
CLI vs IDE agent
A command-line coding agent (e.g. Claude Code) runs the full loop autonomously; an IDE agent (e.g. Cursor) works inside your editor where you watch edits land.
Copilot
A low-autonomy inline assistant that suggests the next line or block while you stay in control of the code.

ACTIVE RECALLCheck your understanding

Answer in your own words first, then reveal.

1Why is coding such a good fit for agents compared to, say, writing strategy?›

Coding hits all four ingredients of a good agent task: a clear goal, instant verification (it compiles? tests pass?), good tools (read/edit/run/test), and reversibility (version control). The verifier is automatic and honest, so the agent can self-correct. Strategy has no compiler — no signal to correct against.

2Walk through the coding-agent loop for "fix the failing test."›

Understand the codebase → plan → edit → run the tests → read the failure → fix → repeat until green, then report. The key is that the agent runs the tests and reads real errors rather than guessing — that self-checking loop is the whole point.

3You ask an agent to fix a bug and it reports "✅ All tests pass!" What do you do before merging?›

Read the diff. The summary is a claim, not proof. Check that it fixed the actual bug, didn't touch files it shouldn't, and — critically — didn't make the tests pass by weakening or deleting them. The diff is the truth; the summary is a sales pitch.

4What's the difference between a CLI agent, an IDE agent, and a copilot?›

They differ in autonomy. A CLI agent (Claude Code) runs the full loop on its own — editing many files and running tests. An IDE agent (Cursor) does similar work inside your editor where you watch edits land. A copilot just suggests the next line while you stay fully in the loop. Match the level to the stakes.

Next: turning agents loose on research and writing →