Developing with AI agents isn’t as fun as coding everything top to bottom yourself and understanding how every bit of it works, but alas, this is necessary. Projects, teams and even organizations demand higher speed in development.

From Prompt Engineering to Context Engineering

Back when people were getting used to LLMs like ChatGPT, courses on Prompt Engineering became prevalent. And sure, it could help us get better results. But when we talk about development using AI agents, more concepts come into play, and one important one is Context Engineering. The prompt we give an agent still plays an important role in what results we get, but providing the right context is even more important.

In a previous article, I talked about Spec Driven Development (SDD) and how it differs from Vibe Coding. Vibe coders reach what we call a prototype. But for a large enough product to get past the prototype stage and become an MVP (the first production version of the product), we need specifications and proper related documentation (specs). SDD is closely related to Context Engineering.

What is Context Engineering?

Think of context engineering as putting data within reach of an agent before it even starts working. It can encompass things like Skills, MCP, tools and CLI tools, plugins, and even instruction files like CLAUDE.md, GEMINI.md and AGENTS.md. Each of these aspects is broad enough to have an article of its own, but I will try to sum them up right here as best I can.

  • Skills are like quick notes the AI reads before performing a task.
  • MCP is a standard protocol that lets an agent connect to and control external tools or data sources it could not access before.
  • Tools are predetermined functions with a specific name and description that let the agent do things.
  • Plugins are combinations: they could bundle skills, MCP, code, etc.

What are those special files (e.g. CLAUDE.md)?

When Claude Code came out, it was guaranteed to read CLAUDE.md before doing anything else. Gemini CLI does the same thing with GEMINI.md. Other agents usually read AGENTS.md.

Can’t we just use AGENTS.md?

Yes, mostly. Claude Code now reads AGENTS.md natively (v2.1.277 and later), as long as there’s no CLAUDE.md in or above your working directory. If you keep a CLAUDE.md, add an @AGENTS.md line to it. Gemini CLI still reads GEMINI.md by default, though—so if you use it, you can point it to AGENTS.md with a one-line @AGENTS.md import in GEMINI.md (or via context.fileName in .gemini/settings.json). That way you only have to maintain one file.

Putting it into practice

All right, let’s get to the good parts.

If you are not just creating a prototype, not just winging it, and your idea or project is large enough, I think how you manage your context becomes really important.

Start with the specs

There are multiple ways to organize the specs of your project so agents can use them: Spec Kit by GitHub, Kiro, JSM Skills (or something similar), or maybe just some files in a docs folder.

What do I use? Lately I’ve been using JSM Skills for my development. They are very well written and help maintain good specs when we develop real production products. You need to learn how to work with them, but once you get the hang of it you’ll see their potential. The specs drive your development workflow and can also suggest what else to use (like related skills and MCPs based on your specific project). From that point forward, you can add any number of other things to your context to make it perfect for your development task.

What about context drift? This is an issue that happens when your docs are not kept up to date with your codebase. If you use a proper SDD toolkit or flow for your setup, this can be prevented easily. For example, with JSM Skills, we have /sync, which we run after each change to keep our specs and docs in line with the codebase, and /audit, which bootstraps the context files or fills gaps in them.

What else do I use?

Here are a number of useful ones.

Managing token usage

  • Graphify: turns your codebase and docs into a queryable knowledge graph so agents navigate by structure instead of re-reading raw files.
  • Trail Code: builds a local code map and saves session learnings as shared memory so agents don’t burn tokens re-exploring the same code.
  • Caveman: makes agent replies terser to cut output tokens, and can compress memory files like CLAUDE.md, without altering code.

Design

Security

Others

  • Playwright (MCP/CLI): lets your agent automate and test web pages in a real browser (the CLI is especially token-efficient for coding agents).
  • Shadcn MCP: lets your agent search, inspect and install shadcn/ui components directly from registries.
  • Ponytail skill: puts your agent in “lazy senior dev” mode so it writes the smallest working change and avoids over-engineering and bloat.
  • Google’s Modern Web Guidance skills: keeps your coding agent up to date with modern web platform APIs, best practices, accessibility, and lightweight fallbacks.

Do you use them all together? No, only the ones I need at any given time. I don’t want to pollute my context with too much info. You need to choose for yourself, and you’ll get the hang of it.

Are these the only ones? Absolutely not. There are tons; these are just a few of my picks. After a while, you’ll find and use your own selection of skills, MCPs and tools.

Subagents

Good. Now you have a well-defined, specified and documented task set up in your repository, and you keep it up to date and tidy. You have your instruction files (AGENTS.md, plus GEMINI.md or CLAUDE.md where needed) set up, and you are using your choice of skills, MCPs and tools.

You have come a long way, but there is another important concept to know: subagents.

Your agent has a limited memory. It can remember things up to a certain point, after which it becomes unreliable and prone to errors. That’s why in very long conversations, agents sound dumber and make mistakes or don’t perform as well as they did. Claude Code shows you how much of the context you have used: the /context command gives the detail, and a status line can show the percentage. When it fills up, agents try to compact it (there is even a /compact command), and some details of the history get lost. Using subagents here helps greatly.

Subagents give you two things:

  1. Fresh, isolated context, because each subagent starts with its own separate context window (without your conversation history) when it is invoked.
  2. Speed, because subagents can work in parallel and do things that would normally take much longer.

This kind of agent orchestration is at the core of how Jarred Sumner, Bun’s creator (now at Anthropic), rewrote Bun in Rust in 11 days using roughly 64 parallel Claude Code instances at peak—work that would have taken a small team of engineers about a year.

How can I use subagents?

Simple, just ask your agent. You can give details like how many you want, what each one should do, what happens afterwards, and so on. For example, you can ask it to spin up two subagents in parallel: one to review the auth endpoints and another to write Playwright tests for the checkout flow, then summarize both results.

Any drawbacks?

Well, token usage can add up, and because each subagent starts without your main conversation history, you still need to brief them clearly.

Loops and Verification Loops

Loops come in many forms and have different use cases, and they are very helpful in practice. Here are the two main ways I currently use them.

One popular method is using the /goal command. You give it a completion condition, and Claude keeps working turn after turn until that condition is met. A small model checks it after each turn, and it stops when the condition is met, is judged impossible, hits an error you have to fix, or you clear it with /goal clear (requires Claude Code v2.1.139 or later).

The other place I use loops in my workflow is around code quality and testing. In agentic development, it becomes really important to have solid tests, linters, formatters, and code quality gates (like SonarQube, if needed) to avoid regressions and ship with confidence. One of my go-to tools for this is Vite+.

Vite+ is like a series of great choices and conventions packed into one easy-to-use package. It uses Oxlint instead of ESLint (which is much faster with great compatibility) and Oxfmt instead of Prettier. It can also manage your project’s package manager, pin a specific Node version per project (e.g. v22 for one project and v24 for another), show which libraries and packages are outdated, and set up pre-commit hooks for you. If you haven’t heard of it before, you can already imagine how many tools it replaces on its own.

The part that ties most directly into our verification loop is the pre-commit hook. Basically, it won’t let a commit go through until the code passes:

  1. Linting
  2. Formatting
  3. Type checking (you can use TypeScript 7 as well)

It tries to fix issues automatically and runs fast. When it hits an error it can’t fix on its own, it stops and blocks the commit. Your AI agent sees the failure output automatically and keeps fixing until no issues remain.

You can take this even further by configuring your agent to cross-check your git changes against specific skills (like Ponytail or Google’s Modern Web Guidance skills) or run a comprehensive test suite. You can even ask it to play the role of a QA engineer, spin up a browser, and verify the changes end-to-end (via Playwright or similar browser tools). This makes a huge difference in how confidently you can ship with AI agents. These flows and loops do consume more tokens, but in my opinion, it is well worth it.

Summary

I tried to give you the gist of it in a single blog post, but there are a lot of other topics you need to explore on your own. I’ll update this post from time to time and write new ones related to it.

  • Manage your specs and keep them in sync with your codebase (using something like JSM Skills).
  • Get related skills, MCPs and tools based on your project and workflow.
  • Make proper use of subagents to speed up work and improve quality, instead of polluting a single context.
  • Set up verification loops and quality gates so your agent catches and fixes issues before you ship.