Vibe Engines
YouTube

Vibe Engines is free, interactive AI engineering & system design — runs in your browser. Pick a learning path

Handbooks  /  Agentic Coding
AI Engineering~13 min readAll levels
Deep Dive

Agentic coding: the agent does the labor. You do the engineering.

Coding agents — Claude Code, Cursor, and their cousins — will happily read your repo, edit twelve files, run the tests and open the PR. The engineers getting 10× out of them and the engineers drowning in AI slop are using the same tools. The difference is technique. This is the technique.

01

From autocomplete to agents

Three eras in five years. Autocomplete (Copilot-classic): the model finishes your line — you were still the one driving every keystroke. Chat: you paste code into a box, the model suggests, you copy back. And now agents: the model works in your repo — reads files it decides to read, edits what needs editing, runs the build, reads the failure, fixes it, and reports back.

The unlock isn't a smarter model wearing a new UI. It's the loop: act → observe → correct, with real tools. An agent that can run your tests can check its own work — and that single capability changes what you can safely delegate.

→ The mental shift

Stop thinking "smart autocomplete." Start thinking "talented new teammate with zero context and infinite energy" — one who read the whole internet but has never seen your codebase, your conventions, or your production incidents. Everything in this handbook follows from that framing.

02

What a coding agent actually is

Strip the branding from any coding agent — CLI (Claude Code), IDE-native (Cursor), cloud-hosted — and you find the same three organs:

Every coding agent, anatomically
The loopPlan → tool call → observe result → next decision, until done or stopped. The agent loop, pointed at software.
The toolsRead/edit files, search the repo, run shell commands, execute tests — the hands. What's allowed here defines the blast radius.
The contextInstruction files, the files it chose to read, command output, your conversation — assembled fresh, every turn.

This anatomy explains the two universal failure modes. Agents fail when the context is wrong (didn't read the right files, missing conventions, stale assumptions) or when the loop runs unverified (no tests to check against, so errors compound silently). Nearly every technique below is a countermeasure to one or the other.

03

The instruction file: your highest-leverage artifact

Every serious agent reads a standing instruction file from your repo — CLAUDE.md, AGENTS.md, Cursor rules. This file is the project's memory across sessions, and writing it well is the single best investment in agentic coding.

What belongs in CLAUDE.md
CommandsExact build / test / lint / run invocations — including how to run one test, not just the suite.
ArchitectureThe 10-line map: where things live, what generates what, which files are auto-generated and must never be hand-edited.
ConventionsThe rules a senior reviewer would enforce: naming, error handling, "we use X not Y" — with the why when it's not obvious.
CorrectionsEvery time the agent gets something wrong twice, it becomes a line here. The file is a ratchet: mistakes get made once.

Two rules keep it working. Keep it lean — it's loaded into every session's context, so a bloated file taxes every turn (the attention budget again); push per-task detail into skills. And keep it true — a stale instruction file is worse than none, because the agent trusts it over the code.

04

The core workflow: plan, then verify small steps

The naive move is one giant prompt: "build the feature." The reliable move is the shape senior engineers already know:

The loop that ships
1 · Plan firstHave the agent explore and propose a plan before touching code. Reviewing a plan costs minutes; reviewing a wrong 15-file diff costs an afternoon.
2 · Small stepsOne coherent change at a time — a function, a route, a migration. Small diffs are reviewable diffs; reviewable is the whole game.
3 · Verify each stepTests, typecheck, actually running the thing. Give the agent the verification commands and make it use them — an agent that can self-check compounds correctness instead of errors.
4 · Course-correct earlyWrong direction at step 2 is a nudge; discovered at step 9 it's a restart. Interrupt freely — steering is cheap, unwinding isn't.
5 · Fresh context per taskLong sessions accumulate stale assumptions and dead ends (context rot). New task, new session, clean window.

Tests deserve special emphasis: they convert the agent's greatest weakness (confident wrongness) into a solved problem, because the loop can check itself against them. Test-first is agent-native development — write (or have it write) the failing test, then let it iterate until green.

The reason is compounding. If each of k steps is right with probability p, one giant unverified change is correct only if all land at once — pk, which collapses. Verifying each small step (retry until its test passes) lifts every step to near-certain, so the whole task stays high:

one-shot = pk  ·  verified = (1−(1−p)retries)k  →  8 steps at 80%/step: 17% vs 94%

Small + verified compounds correctness; big + unverified compounds errors. The runnable version below traces both curves as the step count grows.

05

Scaling up: skills, subagents, hooks

Past the basics, coding agents grow three extension points — all instances of patterns you've seen elsewhere on this site:

ExtensionWhat it doesThe underlying idea
SkillsPackaged procedures loaded on demand — deploy runbooks, review checklists, house workflows.Progressive disclosure: expertise outside the window, selected just-in-time.
SubagentsSpawn a worker with a clean context for a scoped job (research this bug, review this diff) that returns findings.The isolate operation — deep work in a lane, conclusions upward.
Hooks / gatesDeterministic scripts that fire on events: format on save, block commits without tests, require approval for deploys.Policy in code, not in hopes — the harness enforcing what prompts merely request.

The composition is the point: skills teach, subagents parallelize, hooks enforce. A well-tooled repo makes a mediocre prompt succeed; a bare repo makes a great prompt gamble.

06

The spectrum: vibe coding is a dial, not a sin

Vibe coding — accepting AI code without reading it — got a bad name from people doing it in production. But it's better understood as a review dial you set per artifact:

Set the dial by blast radius

Vibe freely

  • Prototypes, spikes, throwaway scripts
  • Internal tools with no users
  • Exploration: "show me three approaches"
  • Anything you'll delete by Friday

Review like it's radioactive

  • Auth, payments, permissions, crypto
  • Migrations and anything touching data
  • Public APIs and their contracts
  • Dependency and infra changes
→ The iron rule

You own what you merge. "The AI wrote it" has exactly the professional standing of "the intern wrote it" — none. The agent is a force multiplier on your labor, never a transfer of your accountability.

07

Sharp edges: security and team discipline

Agents that read the web and run commands have a threat model. Three edges cut most often. Prompt injection: a malicious webpage, package README or issue comment can steer an agent that reads it — treat all fetched content as untrusted, and gate what an agent can do after reading the internet. Secrets: agents read environments and echo what they read — keep credentials out of repos and logs, and out of the files agents routinely open. Dangerous commands: sandboxes, allowlists, and human approval on anything irreversible (deploys, migrations, force-pushes) — the same bounded-autonomy design as any production agent.

Team-level, two norms keep quality from silently eroding: PR review standards don't relax for AI-authored code (if anything, watch for plausible-but-wrong more, rubber-stamp less), and the instruction file is a maintained artifact — reviewed in PRs like code, because it programs every future session.

08

Where this sits in the stack

Agentic coding is the daily practice; the disciplines underneath it are the theory:

LayerQuestionGo deeper
Agentic codingHow do I work with a coding agent, day to day?You're here.
Agent skillsHow do I package expertise it loads on demand?The Skills handbook
Context engineeringWhat should it see each turn?The Context handbook
Loop engineeringHow do autonomous loops run and stop safely?The Loop handbook
Harness engineeringHow do I build these systems myself?The Harness roadmap
RUN IT YOURSELF

Why verified small steps beat one giant diff

"Plan, then verify small steps" isn't just good taste — it's arithmetic. Model a task as k steps, each right 80% of the time. Ship it as one giant unverified change and it's correct only if every step lands at once: 0.8k, which collapses to 17% by eight steps and under 3% by sixteen. Verify each small step instead — retry until its test passes — and every step climbs to ~99%, so the whole task stays far higher: 94% at eight steps, still 88% at sixteen. It erodes too, just slowly. Watch the two curves diverge. Change the per-step success or the retry budget.

CPython · WebAssembly
By the numbers

Worked example: an 8-step feature, traced

Say you ask an agent to add CSV export to an admin page. The plan has 8 steps and, as in section 04, each step is right 80% of the time on the first try. The verified column lets the agent retry a step up to 3 times until its test passes, so each step lands with 1 − 0.23 = 99.2%. The columns show the chance that every step so far is right.

kStepOne giant changeVerified, 3 tries
1Read the existing JSON export80.0%99.2%
2Add the query for the report rows64.0%98.4%
3Write the CSV serializer51.2%97.6%
4Add the /export.csv route41.0%96.8%
5Check the admin permission32.8%96.1%
6Stream large results26.2%95.3%
7Add the button to the page21.0%94.5%
8Update the docs16.8%93.8%

The one-shot change is wrong five times in six. The verified run costs little extra work: a step needs a second try 20% of the time and a third 4% of the time, so the 8 steps take 1.24 × 8 = 9.92 attempts on average instead of 8. Long tasks still decay, though. At 3 tries the verified curve falls below 90% after 13 steps and reaches 87.9% at 16. A fourth try per step keeps it above 90% until about 65 steps. The model also assumes each test actually catches a wrong step. A test that cannot fail turns the verified column back into the one-shot one.

Trade-offs

Cost and trade-offs of each workflow

For the same 8-step task at 80% per step. Time is agent attempts, Space is what lands on you to review or hold in context.

CaseTimeSpaceWhy
One giant prompt8 steps in one attemptOne large diff, reviewed at the end16.8% chance it is all right, and you find out late
Verified, 2 tries per step9.6 attempts on average8 small diffs72.1%: one retry is not enough
Verified, 3 tries per step9.92 attempts8 small diffs93.8%
Verified, 4 tries per step9.98 attempts8 small diffs98.7%: almost free once tests exist
One long sessionNo restart costA window full of old output and dead endsContext rot: stale assumptions steer later steps
Subagent for researchExtra tokens in a separate windowOnly the findings come backKeeps the main context small
Long instruction fileRead at the start of every sessionIts length is paid every turnKeep it lean and move detail into skills

Retries are cheap because most steps pass first time. What is expensive is the test that makes a retry meaningful, and that is a one-off cost the next task reuses.

Watch for

Common mistakes

  • Tests written to match the code

    Ask an agent to write code and then tests, and the tests often assert what the code already does. Write or review the failing test first, and check that it fails for the right reason.

  • Letting the agent edit tests to go green

    When a test fails, the shortest path to green is to change the test. Say in the instruction file that tests change only when you ask, and read test diffs before code diffs.

  • Skipping the plan review

    A wrong plan produces a clean, confident, wrong diff. Reading five lines of plan is the cheapest review you will ever do.

  • Trusting “done”

    An agent’s summary is a claim, not a result. Run the thing yourself, or make the agent paste the command and its output.

  • Correcting in chat instead of in the file

    A correction typed into one session is gone in the next. If you have said it twice, it belongs in CLAUDE.md or AGENTS.md.

In the wild

Where this shows up in production and interviews

  • CI as the agent’s verifier

    The same suite that gates human PRs is what an agent loops against. A repo with fast, reliable tests gets more out of agents than one with a flaky or slow suite.

  • Hooks as policy

    Format on save, block a commit with failing tests, require approval before a deploy. Each one turns a request in the prompt into a rule the harness enforces.

  • Code review of agent PRs

    Teams that ship agent-written code keep their review bar and add one habit: look for plausible-but-wrong code, such as a handled error that swallows the real failure.

  • The interview version

    In an AI-assisted coding round you are scored on this loop: state the plan, keep each change small, run a test that could fail, and explain every line. See the AI-Assisted Interviews handbook.

Self-check

Check yourself

A task has 12 steps at 80% each. What are the one-shot and verified (3 tries per step) success rates?

One-shot: 0.812 = 6.9%. Verified: 0.99212 = 90.8%. Splitting the task and testing each step does more than any prompt wording could.

Which helps an 8-step task more: a model that is 90% right per step, used one-shot, or the 80% model with verification?

The verified 80% model. 0.98 = 43.0%, against 93.8% for 80% with 3 tries per step. Verification lifts every step; a better model alone still multiplies its errors.

Every step’s test passed, but the feature is broken. What went wrong?

The tests could not fail for the bug you shipped. The verified model assumes each test catches a wrong step. If it does not, you have the one-shot odds with extra steps. Add a test that reproduces the bug and check it fails before the fix.

The agent used the old logging helper in three sessions this week. What is the fix?

One line in the instruction file: “use log.event(), not the old helper”, with the reason. That file is read every session, so the mistake is made once. Repeating it in chat fixes only the current session.

Frequently asked

Quick answers

What is agentic coding?

Developing with an AI agent that takes multi-step actions in your repo — reading, editing, running tests, iterating — while you direct, review and verify.

What is a CLAUDE.md / rules file?

Your repo's standing instructions, read at the start of every session: commands, architecture map, conventions, and accumulated corrections. The highest-leverage artifact in the practice.

Agentic vs vibe coding?

A review dial: vibe freely on throwaway code, review like a hawk on auth, payments, data and infra. You own what you merge, either way.

Biggest security risks?

Prompt injection via fetched content, secret exposure, and unreviewed dangerous commands — countered by sandboxes, allowlists, secret hygiene, and approval gates.

Agentic Coding · AI Engineering · Vibe Engines · 2026
Finished this one? 0 / 209 Handbooks done
NextVibe Coding vs Spec-Driven Development Next in “Adapt to the AI Era” · step 4 of 11

Explore the topic

See this alongside everything else on the same subject — handbooks, system designs, challenges and tools, in one place.

More Handbooks