Skip to content
groundworkv0.2

Working with coding agents

What LLMs, agents, harnesses, skills, and MCP actually are, and how to work with them effectively.

9 min read · Last reviewed November 20, 2026

Working with coding agents

An is an LLM in a loop with tools. Once you understand that loop, you understand both its strengths and its failure modes.

You'll be able to#

  • Explain the difference between a model, an agent, a harness, a skill, and an MCP server
  • Know what an agent can and can't "see" at any moment
  • Structure work so an agent succeeds on the first or second try

The mental model#

 you ──prompt──▶ ┌──────────── harness ────────────┐
                 │  context window (what it sees)  │
                 │        ▲            │           │
                 │   tool results   tool calls     │
                 │        │            ▼           │
                 │   files · shell · web · MCP     │
                 └─────────────────────────────────┘

The model reads its context, decides on an action (edit a file, run a command, search), and the executes that action and feeds the result back in. This repeats until the model decides the task is done. The model knows only what's in its , plus whatever it learned in training, and that training may be out of date.

Key concepts#

  • (model): The engine that predicts text. Examples: Claude, GPT, Gemini, and open models like Llama or Qwen.
  • Context window: Everything the model can see right now, including your prompt, files it has read, and tool outputs. It's finite. When it fills up, the harness compacts or drops older material, and the agent can lose track of earlier details.
  • Agent: A model plus a loop plus tools. It acts, observes the result, and acts again.
  • Harness: The program that runs the agent loop and provides its tools. Examples: Claude Code, Cursor, GitHub Copilot agent mode, OpenAI Codex, Aider, Cline.
  • Tools: Actions the agent can take, such as reading or editing files, running shell commands, searching the web, or browsing.
  • (Model Context Protocol): An open standard for plugging external tools and data into agents (GitHub, databases, Figma, Sentry…). Think of it as USB-C for agent tools.
  • Skills / rules files: Reusable instructions the agent loads when relevant, such as CLAUDE.md, AGENTS.md, .cursor/rules, or folders. This is where your project's conventions live, so you don't repeat them in every prompt.
  • Subagents: Child agents spawned for a sub-task, each with a fresh context. They're useful for parallel or exploratory work.
  • : Output that sounds confident but is wrong. Invented APIs, package names and config options are the classics.

Decisions you make (not the agent)#

Your call, not the agent's

DecisionSensible defaultChoose otherwise when…
Task sizeOne feature or one bug per sessionYou're scaffolding something brand new
Plan first?Yes, for anything touching >3 files: ask for a plan, review it, then buildIt's a one-line fix
Project rules fileAlways keep one (AGENTS.md/CLAUDE.md) with stack, commands, conventionsNever skip it
Version controlCommit before every agent session, so a bad run is easy to throw awayNever skip it
VerificationThe agent runs tests, lint and type-check before it says "done"Prototype you'll throw away

What good output looks like#

  • The agent reads relevant files before editing them
  • It runs the build and tests, and reports the results
  • It asks you about ambiguity instead of guessing on important choices
  • Its diffs are small and focused, and match the existing code style

Red flags#

  • Invented packages or APIs → check that the package actually exists on npm or PyPI before installing it. Malicious packages are sometimes published under names models tend to hallucinate ("").
  • "Done!" without having run anything → ask it to run the tests and show you the output.
  • A sprawling diff for a small ask → reject it and re-prompt with a narrower scope.
  • Disabling tests or type checks to get green → reject it immediately.
  • Hardcoded secrets → see Environments & secrets.
  • Editing a file it never read → ask which files it read first. Edits made from guesses tend to duplicate or contradict code that already exists.
  • A new helper that duplicates an existing one → search the repo for similar names before accepting new utility files.
  • Old-version patterns (the wrong major version of a framework or library) → the model's training may be out of date. Name the versions in your rules file and check the diff against the docs for the version you use.

Worked example#

Task: Add a "cancel booking" feature to an app you did not write.

You prompt: "Add a cancel booking button and endpoint." The agent immediately starts writing, creates lib/booking-utils.ts with a new cancelBooking helper, adds an endpoint and a button, and says it is done.

What a good result contains: the agent first reads how bookings are already handled, proposes a plan naming the files it will change, reuses what exists, and ends by running the tests and showing the output.

The wrong turn: the repository already had lib/bookings.ts with a cancellation helper that also sends a confirmation email. The agent never looked, so the new helper cancels without sending the email, and now two helpers do almost the same thing.

How review catches it: ask which existing files did you read before writing this? The answer is none. Then look at the file list: a brand-new utility file in a repo that already has a bookings module is a red flag. Re-run the task with the orient-then-plan prompt below, and have it show its plan before it writes any code.

Sample prompts#

Set up a project rules file#

Prompt
Read this repository and create an AGENTS.md at the root. Include:
- Stack and versions (from package.json / lockfiles)
- How to install, run dev, run tests, lint, type-check, build
- Folder structure and what lives where
- Coding conventions you can infer (naming, file layout, state management, styling)
- Things an agent should never do in this repo (e.g. edit generated files, commit .env)
Keep it under 150 lines. Don't invent anything you can't verify from the code.

Plan-then-build#

Prompt
I want to add <feature>. Before writing any code:
1. Read the relevant parts of the codebase.
2. Propose a plan: files to change, new files, data model changes, risks.
3. List any decisions you need from me.
Stop and wait for my approval before implementing.

Why it works: It separates thinking from doing, so you catch a wrong approach before it turns into 400 lines of code.

Orient, then plan#

Prompt
I want to add <feature>. Don't write code yet.
1. Search the repo for how <related area> is already handled and list the files and helpers you found, with a one-line summary of each.
2. Say which of them you will reuse and which you will change.
3. Propose a plan: files to change, new files (and why none of the existing ones fit), risks.
Wait for my approval.

Why it works: It forces the search that prevents duplicated code, and "why none of the existing ones fit" makes new files a justified exception.

Review before I commit#

Prompt
Review the uncommitted changes (git diff) as a skeptical reviewer. List every file changed and whether it relates to the task: <task>. Flag unrelated changes, new dependencies, deleted or weakened tests, and anything that looks hardcoded. Don't change any code.

Why it works: It catches scope creep and the "make the tests green" shortcuts that agents sometimes take. See Reviewing and verifying AI output for more.

Explain your last change#

Prompt
Explain the change you just made as if to a teammate reviewing it: what problem it solves, why you chose this approach over the alternatives, what you assumed, and what you did not verify. If any part is a guess, say so.

Why it works: Explaining forces the agent to surface assumptions. Check the explanation against the diff rather than taking it as proof.

Fix a failing test the right way#

Prompt
The test <test name> is failing. Find the root cause in the code under test, not in the test. Don't change the test's expectations or skip it unless you can show the expectation is wrong, and explain why. Show the failing output before and the passing output after.

Why it works: It rules out the shortcut of editing the test to match the bug.

Check your understanding#

Check your understanding

1/3What can the model use when it generates an answer?
2/3Why commit before starting an agent session?
3/3The agent says "Done!" What should you do next?

Checklist#

  • A rules file exists and is up to date
  • Work is committed before the session starts
  • Task is scoped to one feature or fix
  • Agent verified its own work (tests, types, build)
  • You read the diff

Go deeper#