The Steering Map

Every time you start a fresh session, the agent wakes up knowing nothing about how you work. That isn't a bug - it's what stateless means. The model carries nothing from one session to the next, so your conventions, your edge cases, and the patterns that you want to encode in your project are gone the moment you clear the context.

Steering is the question of how you guide the agent's behavior across different sessions. Which instructions should reach the agent every time, and how do you deliver them without having to restate them every time you do more work?

So where should those steering instructions live? That's what this section answers.

Understanding Context Load

Before we answer that, we need to tackle the idea that the rest of this section depends on.

Anything that you load into the agent up front, you pay for on every single model provider request.

A session can contain multiple turns, and each of these turns contains many model provider requests, where you send a request and receive a response. A single turn can last 15 minutes and contain hundreds of model provider requests. There can be many, many turns within a session.

Diagram showing a session with three turns, each turn containing multiple model provider requests represented as light blue dots

Diagram showing a session with three turns, each turn containing multiple model provider requests represented as light blue dots

Each model provider request carries all of the history and everything new along with it. Any little instruction that you add early in the context window is going to be passed in on every single request.

Context load diagram showing five numbered requests, each row containing blocks representing the growing payload with a violet block at the front being re-sent every time

Context load diagram showing five numbered requests, each row containing blocks representing the growing payload with a violet block at the front being re-sent every time

You still get some caching, so the cost is slightly lowered based on what you would expect, but it is still frustrating to have that thing in the window if it's not needed on every request.

The Two Costs of Context Load

You're paying tokens to include these steering instructions on every request. But there's a second cost: you're also paying in attention.

Every extra instruction that you load makes every other instruction a little bit quieter and pushes the agent a little bit closer to the dumb zone.

Attention diagram showing five empty boxes with arrows scattered across them, clustered densely at the left and thinning out toward the right

Attention diagram showing five empty boxes with arrows scattered across them, clustered densely at the left and thinning out toward the right

That combined cost, paying more tokens and spreading your agent's attention thinner, is what we'll call context load. And every time you have a steering instruction, you need to think about the context load that steering instruction is providing.

So when we talk about steering, we're not just thinking about writing good rules for our agent. It's about figuring out which rules, which patterns we encode in the context window, because we pay a cost in context load for everything we add.

Push vs Point: Two Strategies for Steering

Whenever we want to steer our agent, there are really two choices on how we can choose to steer it. We can either push that instruction or we can point at the instruction.

Push: Always-On Steering

Imagine the agent's context window looks like a box, and our instruction is a yellow blob sitting inside it. When we push the instruction to the agent, it means that steering instruction is always on. It sits in the context window for every single session. The agent cannot miss it because it's already in its context window.

That means it's costing us context load whether this turn needs it or not.

Push diagram showing the context window with a large yellow block inside representing a steering instruction that is always present

Push diagram showing the context window with a large yellow block inside representing a steering instruction that is always present

Point: On-Demand Steering

When you point, you put the steering instructions somewhere in the environment. You put one little line in the context window just to point to it. This line could read: "when you're doing a certain kind of work, then use these instructions." That line is a context pointer.

It's a pointer that sits in the context window so that when the agent needs it, it goes and follows the pointer, pulls in the full instruction.

Most turns a context pointer will cost you almost nothing.

Point diagram showing the context window with a tiny yellow square inside and a yellow arrow leading down to a full yellow block outside the window

Point diagram showing the context window with a tiny yellow square inside and a yellow arrow leading down to a full yellow block outside the window

StrategyCostAvailability
PushHigh on every requestAlways present
PointMinimal most turnsOnly when needed
Side-by-side comparison of Push and Point strategies, showing the context window with a large block inside for Push versus a tiny pointer square for Point

Side-by-side comparison of Push and Point strategies, showing the context window with a large block inside for Push versus a tiny pointer square for Point

Where Pushed Steering Lives: AGENTS.md

So how do you push to an agent context window? One technique is the AGENTS.md file. This is a file often at the root of your project that the harness loads into the context window at the session start.

AGENTS.md is a cross-harness convention, so whatever tool that you're using probably will understand it. The big exception here is Claude Code, which calls it CLAUDE.md for reasons beyond understanding. I'm going to call it AGENTS.md, not because I'm pedantic, but because someday I hope that CLAUDE.md will actually join in the bandwagon.

When Pushed Rules Misfire

We understand the cost of pushing steering rules now - it's paid in context load on every request. But there's a bigger problem: agents can't tell when the rules apply, and so they will often take rules that you've put as pushed steering rules and apply them in the wrong situations.

Someone sent a really funny example of when an agent was too overeager to follow an instruction. And it actually happened not in a coding harness, but in claude.ai.

In claude.ai you can open up the settings and see instructions for Claude which act exactly like the AGENTS.md file. They are pushed into the agent's context.

Claude.ai settings screen showing the Instructions for Claude section

Claude.ai settings screen showing the Instructions for Claude section

Someone had an instruction kind of like this in their global instructions:

I work under PCI DSS card payment compliance. Anything security relevant should be flagged.

Then they asked the agent how to bake a chocolate cake. It gave them the recipe but then added a note at the end that since they handle credit cards under PCI DSS they should consider the security implications of the chocolate cake.

Browser showing a Claude.ai conversation titled 'Chocolate cake recipe' with the agent's response about PCI DSS compliance implications for baking

Browser showing a Claude.ai conversation titled 'Chocolate cake recipe' with the agent's response about PCI DSS compliance implications for baking

In other words, these pushed rules can make the agents do strange things. And we better make sure that the way that we're using the agent matches up to the rules that we have in there.

The Epidemic of Over-Pushing

This advice will run counter to what a lot of people are doing right now. They are pushing tons of instructions into CLAUDE.md or AGENTS.md, and I think they're seeing worse results because of it.

There is an epidemic of pushing right now and so much so many tokens are being wasted. So much context load is being placed on these agents when I think instead you need to be considering techniques for pointing.

In this course, in practice: you point by default. And you let the agent decide whether to pull in those instructions or not.

That's how we're going to tackle the rest of the section. We're going to show techniques both for pushing and pointing. There are situations where you do want to push, and we'll show you about skills, about documentation inside the repo, and all the cool techniques that you can use to steer your agent without pushing too much context load.

Quiz

A convention for writing database migrations comes up about once a week in your project, and it runs to forty lines. Where do you put it?

  • In its own file, with a one-line pointer in AGENTS.md
  • Inline in AGENTS.md, so the agent can never miss it
  • In a note you paste into prompts when it is relevant
Answer
Inlining pays all forty lines on every model provider request, in every session, for a rule needed once a week - and every extra instruction makes the others a little quieter. Pasting it by hand moves the cost onto you, and you will forget on the week it matters. A pointer costs almost nothing most turns, and the agent pulls the file in when the work calls for it.

Loading forty lines at the start of every session costs you tokens on every request. What is the second cost you pay?

  • Attention: every other instruction gets quieter
  • Latency: each request takes longer to come back
  • Caching: the discount no longer applies at all
Answer
Caching does not go away - you still get some, which lowers the cost slightly, so the discount is not what you lose. Speed is not what suffers either. Attention is: every extra instruction loaded makes every other instruction a little quieter and pushes the agent closer to the dumb zone.

Your always-on instructions say to flag anything security-relevant. The agent now appends compliance notes to work that has nothing to do with security. What fixes it?

  • Move the rule behind a pointer that says when to use it
  • Keep it pushed, and add wording about when it applies
  • Restate the rule further down so the agent reads it
Answer
The failure is that a pushed rule sits in front of the agent for every task, and the agent cannot tell when it applies. Extra wording leaves it pushed, so it still costs context load on every request and is still there during the chocolate cake question. Restating it makes it louder in exactly the situations where it should be silent. Put it in the environment and leave one line pointing at it.

Steering With A Pointer

Commit Map
pushed-migration-steps Start the lesson: the migration steps pushed into AGENTS.md, with the /writing-for-agents skill available
migration-steps-doc See my solution: the steps moved into docs/database-migrations.md behind a pointer

The database schema is worth special care in this project. Whenever you change the schema, add a table, modify a column, there's a hidden second step. You also have to update scripts/seed.ts, the script that fills the database with its starting data.

If you change the schema and forget the seed script, the next reseed leaves you with data that no longer matches the shape. The type safety you get from Drizzle stops at the schema, the raw SQL in the DROP TABLE IF EXISTS block has no guard rails, so mismatches slip through silently and break things downstream.

There's a second thing worth saying. In this project, the database is disposable. It lives on data.db, gitignored, holding nothing but seed data. You can migrate freely, throw it away, and reseed from scratch. Those are real constraints, the kind of thing you'd explain to a new teammate on their first day. And the agent can't know them unless you tell it, because they aren't derivable from the code.

The Problem

The obvious move is to push all those steps into AGENTS.md so the agent always has them. But look at what that costs.

Every request carries the full migration steps. Every turn for the rest of the session pays input tokens for a document it doesn't need, right now, maybe the agent is building a UI feature that touches nothing in the database. The steps compete for attention budget. Picture a project with ten sets of instructions like this, all pushed into context. The cost compounds.

The Doc-Plus-Pointer Pattern

You don't need the steps on every request. You need them reachable from every request. Those are different things.

Take the steps out of AGENTS.md and give them their own document. Leave one short line in AGENTS.md: when you're changing the database schema, read this doc first. The context load becomes a single sentence. The steps load only when the agent follows the pointer and needs them.

That's the doc-plus-pointer pattern. A context pointer is a reference in the agent's context that names some material and encodes the condition for reaching it. It needs two things to work:

  • A stable path - the agent needs to know where to find it.
  • Clear description - the agent needs to know when following it is worth it. A bare path is a pointer the agent has no reason to use. Word it the way the task actually presents.

The /writing-for-agents Skill

Writing a good document for an agent is its own skill. You're going to use the /writing-for-agents skill to do it. This skill takes the steps in your head and turns them into a document an agent can follow: clear, ordered, no waffle. It's built exactly for writing AGENTS.md and for writing the kind of focused docs that sit behind pointers.

Steps To Complete

  • Run npm run reset to grab the /writing-for-agents skill

This will reset the repo to the commit that includes the skill.

  • Open the /writing-for-agents skill and read through it

Understand what it's asking for, particularly the section on context pointers and the two loads (context load and cognitive load). This is the vocabulary you'll be using.

  • Create a new docs/ folder in the repo root

This is where your migration steps doc will live.

  • Use /writing-for-agents to move the migration steps out of AGENTS.md into a new document called database-migrations.md inside the docs/ folder

The skill will guide you. Ask it to take the steps currently in AGENTS.md and restructure them as a standalone document. The doc should stand on its own, it won't have AGENTS.md above it, so promote the headings one level.

  • Replace the migration steps in AGENTS.md with a single pointer line

The pointer should describe when and why the agent should reach for the document. Something like: "When making a database schema change, consult docs/database-migrations.md for the exact steps."

  • Make a small, real schema change to test the pointer

Open an agent and ask it to make a simple change to the schema, maybe add a non-nullable column to an existing table, or add a new field. Watch what happens.

The agent should see your pointer line in AGENTS.md, recognize that it's doing a schema change, and pull in the full doc from docs/database-migrations.md. It should then follow the steps: update the schema, generate the migration, update scripts/seed.ts, reseed, and typecheck.

  • Verify the change worked

Check that npm run db:seed runs without error, that npm run typecheck passes, and that the data in the database matches the new schema.

  • Commit your changes and reset the project when you're done

Once you've verified it works, commit to your branch. When you're ready to move on, run npm run reset to return to the original state.

Steering With A Pointer Solution

Commit Map
pushed-migration-steps Start the lesson: the migration steps pushed into AGENTS.md
migration-steps-doc See my solution: docs/database-migrations.md plus the pointer, and the salesCopy schema change that tests it

All right, we're going to kick things off by running the /writing-for-agents skill here, and I'm then going to dictate what I want to happen.

I would like you to take the AGENTS.md file, especially the stuff about the database migrations and all of those steps, and put that behind a context pointer. It's just a little bit too large right now, and I don't want to have this in every model provider request.

Okay, let's run this and see what happens.

So it's going ahead and creating a docs/database-migrations.md and leaving AGENTS.md as a pointer. This is, as you can imagine, a very simple change here. What we end up with is a database migrations doc, which is a one-to-one representation of what was in the original.

The docs/database-migrations.md file showing the migration steps

The docs/database-migrations.md file showing the migration steps

And then in AGENTS.md, we have this database migrations pointer.

AGENTS.md showing the pointer to database-migrations.md

AGENTS.md showing the pointer to database-migrations.md

Understanding Pointers

So as you can see, a pointer is basically made up of two parts:

  1. The link - the actual thing that's pointing to it
  2. The text around the pointer - what tells the agent when to use it

Keep in mind this is the stuff that will actually get pushed to the agent, and it will only go and look at this file when it actually needs to. And so the description on the pointer is actually really important.

To me, I'm not exactly happy with this pointer description. It's certainly quite concrete, like, "read before editing this specific file, read whenever a schema change needs this thing updated, or when this particular command fails to start." That's very concrete and very specific, but I think I want to make it a bit broader.

So I'm going to say:

Update the description of the pointer in AGENTS.md to be a bit broader to say: whenever we make a database change, follow these steps.

That way the agent has a really clear rationale and understands exactly when it needs to. Of course it will use its own judgment too - it might look at the name of the file, for instance, and just say "okay, database migrations, I'll do it whenever database migration is needed." But this reads a little bit better to me, and it's also a little bit shorter, which always helps.

So I'm happy with how the pointer looks. Let's now clear the context and test this out.

Making A Schema Change

The change that I want to test this out with is we're going to go into app/db/schema.ts here. We're going to look at salesCopy under courses and we notice that most of these have .notNull() attached to them, meaning that they have to have a value in the database, even if it's an empty string. So for salesCopy, we're going to make it not nullable.

app/db/schema.ts showing the salesCopy field in the courses table

app/db/schema.ts showing the salesCopy field in the courses table

It kind of makes sense to me because all courses need to have some kind of sales copy.

Make the salesCopy attribute of courses non-nullable. Make it a required field when creating new courses, and make sure that it's non-empty.

So there we go, we've got a small, quite well-scoped feature that needs a database migration. Let's see if it picks up the database migration.

And there we go - reading two files, one of which is, it just went by very, very quickly, but one of which was the database migrations doc.

You should be able to press Ctrl+O here and zoom up and we should see it up here.

Agent tool call list showing Read of docs/database-migrations.md

Agent tool call list showing Read of docs/database-migrations.md

Yep, there we go. Read …/ai-coding-crash-course/docs/database-migrations.md

So our pointer has worked and it's now pulled in the correct doc into its context window.

The Agent Works It Out

You can see too that it immediately changed the salesCopy text here, and it looked like it ran a shell command - yeah, it ran npm run db:generate, fantastic.

Terminal output showing npm run db:generate command execution

Terminal output showing npm run db:generate command execution

And now it's going through and making the required changes.

The question is: has it updated the seed script? That's the really important bit.

It actually looks like it hasn't needed to because both of the courses in the seed script both already pass a salesCopy. But it looks like it's now running the reseed, so it's reseeding from scratch, type checking, and running tests.

Terminal output showing database reseed with row counts and test results

Terminal output showing database reseed with row counts and test results

So even though it didn't need to, it reseeded the database, which I think is good practice. It's certainly aware that the seed script exists, which it probably might not have been if we hadn't included it in that doc.

So our experiment worked. Almost as if they were in AGENTS.md themselves, this pointer was effective enough that it was able to direct the agent to the documentation when it was needed.

The Key Takeaway

So whenever you're thinking about adding or doing some steering in the global scope, I recommend pointing over pushing.

And this pattern of having local docs inside the repo, hidden behind a pointer, is very, very effective.

However, it does have some weaknesses, and that's what we're going to be exploring in the next couple of lessons.

Nice work, and I will see you in the next one.

What Are Agent Skills?

The pattern of a document paired with a pointer works well, but it hits an interesting constraint. Everything about it lives just inside one repository. There's no easy way to package it up and ship it to your teammates.

You can't carry these between projects - they have to be manually extracted and pasted in each time. Every instance means copying files by hand, and every team member has to repeat the work.

Skills: A Pointer, Packaged

This problem is what skills are designed for. A skill is the same setup you saw before, a pointer to a document, but packaged and standardized. It's a self-contained folder that does the same job as the doc-plus-pointer approach. You keep the steering files on disk and pull them in only when they're relevant, bundled into one portable, shareable unit.

A skill folder contains a SKILL.md file (the main document), alongside any supporting files it needs. Here's what makes skills portable:

Skill folder structure showing SKILL.md file

Skill folder structure showing SKILL.md file

  • One line always on: the skill's name and description
  • Everything else loads on demand: the body and any linked files only load when the agent reaches for them
  • Bundled together: all files live in one folder, ready to share

The description acts as the context pointer for the agent. It reads the description to decide whether the skill is relevant right now. Once it sees the description, it decides whether to load that skill into its context window.

For example, a skill called writing-for-agents with the description "Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md." tells the agent exactly when to reach for it.

writing-for-agents skill showing frontmatter with name and description

writing-for-agents skill showing frontmatter with name and description

More Than One File

A skill isn't limited to a single file. Everything inside the skill folder gets bundled in with it. So a skill might contain:

  • SKILL.md (the main entry point)
  • Supporting files like SKILL-MECHANICS.md
  • Additional reference materials

The main SKILL.md can point to these supporting files with context pointers, and the agent follows those links only when it needs them. This is progressive disclosure one layer down - the agent pays no context load for the supporting files until it commits to using the skill.

For instance, you might write in SKILL.md: "When the document you're writing is a skill, read SKILL-MECHANICS.md for frontmatter, invocation choice, and router skills."

SKILL.md showing context pointer to SKILL-MECHANICS.md

SKILL.md showing context pointer to SKILL-MECHANICS.md

This creates a layered structure:

  • Context window → name and description
  • Name and description → SKILL.md
  • SKILL.md → SKILL-MECHANICS.md (and other files)
Diagram showing layered structure from context window to SKILL.md to reference files

Diagram showing layered structure from context window to SKILL.md to reference files

The Open Standard

Skills are an open standard, defined at agentskills.io. This is significant because a skill written once for one agent can work in pretty much any agent that supports skills. They're totally portable.

This portability means you can:

  • Write a skill once
  • Share it with your team
  • Reuse it across projects
  • Package huge amounts of information into one portable unit

Two Ways To Invoke A Skill

There are two main ways a skill can get invoked, and they trade off two different kinds of load:

Invocation TypeHow It WorksContext LoadCognitive Load
Model-invokedDescription is in the context window. The agent can see it, notice it's relevant, and pull it in on its own.HigherLower
User-invokedDescription is hidden from the agent. Only you can invoke it by typing its name.ZeroHigher (you must remember it)

The difference comes down to a single line in the skill's frontmatter.

Model-Invoked Skills

Keep the description in the frontmatter and the agent can discover the skill autonomously. The agent reads the description, recognizes when it's relevant, and invokes it without you mentioning it. You can still type the skill's name yourself - model-invocation always includes user reach, it just adds agent discovery on top.

The description is the skill's top-level context pointer, and it stays loaded at all times. That's a permanent context load, but you get automatic discoverability.

User-Invoked Skills

Add disable-model-invocation: true to the frontmatter to hide the description from the agent. Now only you can invoke the skill by name - the agent can't reach it at all, even if it would be helpful. Zero context load, but you have to remember the skill exists and remember to use it.

Here's what a user-invoked skill's frontmatter looks like:

---
name: handoff
description: Compact the current conversation into a handoff document for another agent to pick up.
disable-model-invocation: true
---

With disable-model-invocation: true, the description becomes human-facing rather than agent-facing - a one-line summary for you to read, not for the agent to parse.

handoff skill frontmatter showing disable-model-invocation: true

handoff skill frontmatter showing disable-model-invocation: true

The Trade-Off

The choice between model-invoked and user-invoked is a trade-off:

  • More model-invoked skills = higher context load, but the agent can discover them
  • More user-invoked skills = zero additional context load, but higher cognitive load on you

There's something appealing about paying zero context load for user-invoked skills. You can have a lot of them without bloating your context window. This is why many personal skill sets tend to lean toward user-invoked skills - they're "free" in terms of context.

Listing Your Skills

To see what skills you have available, run the /skills command. This brings up a menu listing the name and description of every skill you have access to. This is the context load you're paying - one line per model-invoked skill.

/skills command output showing list of available skills

/skills command output showing list of available skills

In that list, you'll see which ones are user-invoked. For example:

  • grill-me is user-invoked (no description shown to the agent)
  • writing-for-agents is model-invoked (description shown to the agent)

You can invoke user-invoked skills by typing their name, just like any command.

Skills as Portable Pointers

A skill is just a pointer, packaged. It's the same setup as a document in your repository with a pointer line in AGENTS.md, except here you can:

  • Bundle it up
  • Pass it to your team
  • Distribute it on the web
  • Carry it between projects

The concept of something you can easily share is powerful. And now you're ready to build one.

Quiz

For a skill the agent can discover on its own, what is sitting in the context window at all times?

  • The skill's name and description, one line
  • All of SKILL.md, minus the supporting files
  • Every file bundled inside the skill's folder
Answer
The body of SKILL.md and any file it links to load only when the agent reaches for the skill, so neither is in the window up front. Bundling puts the files in one folder so the skill can be shared - it does not put them in context. One line per discoverable skill is the whole standing cost.

You wrote a skill you will need maybe twice a month, and you know you will forget it exists. Which frontmatter do you ship?

  • Leave the description on, so the agent can find it
  • Set disable-model-invocation and invoke it by name
  • Paste the skill's body into AGENTS.md instead of it
Answer
Hiding the description costs zero context load, but the agent cannot reach the skill at all, and the cognitive load lands on you - which is exactly what fails for a skill you will forget. Pasting the body into AGENTS.md pays for the whole document on every request rather than one line. One description line buys the agent the chance to notice it.

Your SKILL.md has grown a long section on frontmatter details that matters in one case out of ten. What do you do with that section?

  • Move it to a second file, pointed at from SKILL.md
  • Keep it in SKILL.md, since the folder ships as one
  • Make it a separate skill with its own description
Answer
Leaving it in SKILL.md means it loads every time the skill fires, including the nine cases where it does not apply - the folder shipping as one unit is about sharing, not about what enters the window. A separate skill adds another description line that is loaded permanently. A pointer to a supporting file costs nothing until the agent follows it.

Write A Skill

Commit Map
migration-steps-doc Start the lesson: the migration steps in docs/database-migrations.md behind a pointer
migration-steps-skill See my solution: the doc converted into a database-migrations skill

You've built documentation for database migrations and pointed your agents to it with AGENTS.md. But a pointer leaves you with a problem: every agent has to fetch the doc when it might need it.

Skills solve this. A skill is a pointer, but packaged. Its name and description tell the agent whether it's relevant, and the body loads only when the agent reaches for it.

This lesson turns your doc-and-pointer into a skill. You can do it by hand or let the agent handle it with the writing-for-agents skill. Then you'll use the request logger to confirm the skill gets invoked at exactly the right moment.

Steps To Complete

Set Up The Request Logger

  • Run npm run request-logger

This starts a proxy server that logs every request your agent sends. It asks which coding agent you use, listens on http://localhost:8787, and prints the exact command to start that agent through it.

  • In another terminal, copy and paste the printed command to run the agent through the proxy
  • Send a dummy request

Type Hello! to see what gets loaded before any work happens.

  • Check the log in request-logger/logs

Open the markdown file that was created. Look for:

  • The contents of CLAUDE.md, which shows the pointer to docs/database-migrations.md
  • The skills list (search for "skills"). You should see only grilling and writing-for-agents available, because the other skills have disable-model-invocation: true set
  • The Skill tool definition, which shows how the agent invokes skills by name and the harness resolves the SKILL.md file

This is your baseline - what the wire looks like before the conversion.

Convert The Doc Into A Skill

  • Ask the agent to convert the database migrations doc into a skill

You can dictate something like:

I'd like you to take the documentation on database migrations and move it
into its own skill project based in this repo.

Don't manually invoke the writing-for-agents skill. Let the agent decide whether it needs it.

  • Watch what happens in the request logger

The agent should invoke the writing-for-agents skill, load it into context, then create the new skill in .agents/skills/database-migrations/.

  • Verify the skill was created

Check that:

  • .agents/skills/database-migrations/SKILL.md exists with frontmatter containing a name and description
  • The skill body contains the migration steps from the original doc
  • The pointer line was removed from AGENTS.md
  • The original docs/database-migrations.md file was deleted

Test The Skill

This creates a fresh log showing what changed.

  • Check the new log in request-logger/logs

Search for "skills" again. You should now see the database-migrations skill in the list with its description - the context pointer moved from CLAUDE.md to the skills list.

  • Run npm run reset to clear the database
  • Ask the agent to make a schema change

For example, rename pricePaid to amountPaid in the purchases table:

In the purchases table, change pricePaid to amountPaid.
  • Watch the agent invoke the skill immediately

The database-migrations skill should be invoked the moment the agent recognizes it needs the migration steps.

  • If the agent hits an interactive prompt, complete it manually

For example, npm run db:generate might need you to confirm a column rename. Run the command yourself and tell the agent it's done.

  • Verify the agent follows the skill's steps

It should use the same terms from the skill: reseed, verify, typecheck.

  • Compare what changed on the wire

The pointer moved from CLAUDE.md to the skills list, but the agent's behaviour stayed the same. The packaging changed, the guidance didn't.

Write A Skill Solution

Commit Map
migration-steps-doc Start the lesson: the migration steps in docs/database-migrations.md behind a pointer
migration-steps-skill See my solution: the database-migrations skill, plus the pricePaid to amountPaid rename that tests it

I've sent off a dummy request here just saying "Hello" to see the system set up. Let's go into the logs and check out the AGENTS.md file.

We can see the contents of CLAUDE.md inside the request log. It just has a little pointer there pointing to the database migrations documentation.

CLAUDE.md contents showing the database migrations pointer

CLAUDE.md contents showing the database migrations pointer

If we search for "skills", we notice we've only got the grilling and writing-for-agents skills available in the context window. That's because the other two skills in the repo have disable-model-invocation: true set in their frontmatter, so the agent can't call them on its own.

Skills list showing only grilling and writing-for-agents

Skills list showing only grilling and writing-for-agents

If we look for the Skill tool, which is defined above, we can see how it works. Once the agent decides it needs to go and find a skill file, it's going to invoke the Skill tool with the name of that file. Then the harness will go and resolve where the actual SKILL.md file is.

Skill tool definition in the request log

Skill tool definition in the request log

Making the move

Let's actually go ahead and make the move. I'm going to dictate into Claude Code what I want.

I'd like you to take the documentation on database migrations and move it
into its own skill project based in this repo.

As a little experiment, I'm not going to manually invoke the writing-for-agents skill - I'm just going to leave it and see if it does it itself.

And there we go. The writing-for-agents skill has been invoked here. It's actually loading up the skill into its context window.

writing-for-agents skill being invoked

writing-for-agents skill being invoked

It's now gone ahead and created the skill inside .agents. It's under the database migrations folder, and we've got SKILL.md that looks like our original AGENTS.md did.

New database-migrations skill folder with SKILL.md

New database-migrations skill folder with SKILL.md

Now it's going ahead and removing the old pointer, so AGENTS.md is now completely empty. The docs file has been removed too.

Testing with a second session

So now, if I clear the context, I'm going to create another dummy message. Let's go into the request logs and we should be able to see that things have changed.

Here we go. The following skills are now available. You can see "Database schema changes - generate the migration, update the seed, reseed. Use when editing the schema, when adding or altering a table column or enum, or when npm run db:seed fails to start."

Skills list now showing database-migrations skill

Skills list now showing database-migrations skill

So we have a context pointer here for a skill. And now all we need to do to get this to work with our colleagues' skills is just go up to the top here, zip up the database-migrations folder and send it off to them.

The schema change test

For this session's schema change, let's go into purchases and I'm going to change pricePaid to amountPaid.

Schema file showing the pricePaid field

Schema file showing the pricePaid field

We need to change the name of a property. So in purchases, instead of pricePaid, I want it to be amountPaid.

Looking at the original schema:

export const purchases = sqliteTable("purchases", {
  id: integer("id").primaryKey({ autoIncrement: true }),
  userId: integer("user_id")
    .notNull()
    .references(() => users.id),
  courseId: integer("course_id")
    .notNull()
    .references(() => courses.id),
  pricePaid: integer("price_paid").notNull(),
  country: text("country"),
  createdAt: text("created_at")
    .notNull()
    .$defaultFn(() => new Date().toISOString()),
});

And now hopefully this will invoke the correct skill at the right moment. Oh, and there it goes immediately.

database-migrations skill being invoked immediately

database-migrations skill being invoked immediately

It should now go through and do the rest of the work that it needs to.

Looks like it needs a TTY, an interactive terminal. So I'm going to grab what it sent me and I'm going to run npm run db:generate myself.

npm run db:generate

We are renaming this, so I'm going to select rename column and then I'll go back and tell it that I was able to complete it.

Interactive terminal prompting for rename column selection

Interactive terminal prompting for rename column selection

Yep, done.

And just like before, it now understands that it has reseed and verify. It's using the same terms as in our skill.

I'm feeling pretty confident that is going to be okay.

The portable pointer

So there we go. Skills are just the same as our doc and pointer approach, except they're just more portable.

We really swapped around the context pointer. Instead of it being in CLAUDE.md, it now turned up in the skills list instead.

Both times we were able to successfully call it and pull it out at the right moment because we had a well-written description.

If we wanted to avoid this context load cost, then we could just make it a user-invoked skill instead - pull it out of here and then rely on the user to call it at the right moment.

But for me, it makes sense here to just make this part of the application. Make this part of the environment that the agent operates in. And I think it's a pretty nice skill.

So nice work on your first skill. I'll see you in the next one.

User Vs Project Skills

Skills can live in one of two places, and the choice matters.

Two Levels for Skills

The first level is your user directory at ~/.agents/skills. A skill there is personal to you and follows you everywhere: every project you open on your machine has it available.

The second level is the project itself, in its .agents/skills folder. A skill there is checked into the repo, scoped to that one project, but shared with anyone who clones the repository.

User-level skills directory at ~/.agents/skills/

User-level skills directory at ~/.agents/skills/

Personal and portable, versus shared and checked in. That's the choice.

Where Skills Live

LevelLocationScopeSharing
User~/.agents/skills/Personal to youGlobal across all your projects
Project.agents/skills/Scoped to one projectShared with everyone who clones

Skills at the user level are the same under two conventions, you'll also see them referred to as living in ~/.claude/skills/. Both paths refer to the same set of skills on your machine.

Project-level skills directory inside the repository

Project-level skills directory inside the repository

At the project level, skills are checked into the repository. This means they're part of the git history and automatically shared with everyone who clones the project. The project ai-coding-crash-course includes five skills at this point:

.agents/skills/database-migrations/
.agents/skills/grill-me/
.agents/skills/grilling/
.agents/skills/handoff/
.agents/skills/writing-for-agents/

How to Choose: Personal or Team?

Here's the rule: If it's a personal quality-of-life thing, the way you like to work or a shortcut that's yours, put it in your user directory.

The moment a skill is something the team relies on, something that encodes how this project is meant to be worked, it belongs in the project. The project is the stronger default, because:

  • It's version-controlled
  • It evolves with the codebase
  • Everyone who clones the repo gets it automatically
  • You never have to tell a teammate to install anything

When in doubt, and it's about the work rather than about you, put it in the project.

Two Different Flavors

User-LevelProject-Level
PersonalChecked-in
GlobalSingle-project
Communal

Personal: It's yours alone, nobody else sees it, and nobody else has to use it.

Global: It follows you everywhere. Install it once in your user directory, and it's available in every project you open on your machine with no setup and no copying.

Checked-in: The skill is part of your repository. It's tracked in git history and travels with the project.

Single-project: It won't follow you to your next project, but it's scoped to this one for good reason.

Communal: Everyone who edits the project can also contribute to the skill. The skill automatically grows with the project, and everyone on the team gets to build it up over time.

Whiteboard diagram showing user-level vs project-level skill characteristics

Whiteboard diagram showing user-level vs project-level skill characteristics

Solo or Team?

If you're working mostly solo, user-level skills are probably going to be more convenient because they follow you everywhere.

As soon as you have a team or multiple people contributing to the same project, project-level skills are the way to go. They become really beneficial for everyone working in the codebase.

Quiz

A skill encodes how database migrations must be run in this repo, and two teammates keep getting it wrong. Where does it belong?

  • The project's .agents/skills, checked into the repo
  • Your ~/.agents/skills, so it follows you everywhere
  • Your user directory, and you tell them to copy it
Answer
A skill in your user directory is personal to you and nobody else sees it, so the two teammates getting it wrong still get nothing. Telling them to copy it makes every person repeat the work by hand and lets the copies drift apart. Checked in, it arrives with the clone, sits in git history, and anyone on the team can improve it.

You have a shortcut for how you personally like to phrase things, and you want it in every repo you open. Where does it belong?

  • Your user directory, global across your projects
  • Each project's skills folder, checked in one by one
  • A repo you clone into every new project you start
Answer
Checking a personal quality-of-life habit into each project puts your taste in everyone's repository and makes you redo it per project - the project level is for what the team relies on. Cloning it in each time is the manual copying the user directory exists to remove. Installed once in your user directory, it is there in every project with no setup.

Pruning

There's one big problem with storing files in your project repository that everyone contributes to.

They only grow. They always get bigger and very rarely do they get smaller. Every rule in there goes in for a reason, and none of them tend to come out. A file starts at five lines, then grows to 500, then to 1,000.

The reason is psychological. Adding a rule feels cheap and it feels safe, especially when you're contributing to a group document. Removing one feels like you're saying that rule doesn't matter anymore, like you're stamping over someone's work.

But this idea of pruning matters. Pruning is going back through the file, cutting stuff out of it on a regular basis. It's critical for reducing the overall context load.

Almost every AGENTS.md file in the real world is far, far too big. The good news is that you can learn to prune them effectively.

The Pruning Toolkit

You need a way to decide, line by line, what stays. The solution is a set of three tests you can run over any steering file. These three tests form the pruning toolkit.

TestDefinition
Single Source Of TruthEvery fact should live in exactly one authoritative place
SedimentLines that were once true but aren't true now
No-OpsInstructions that change nothing about the agent's behavior

Anything that fails these three tests is not earning its place in the context window. Cut it, and you'll notice that your steering improves massively.

Test 1: Single Source Of Truth

Every fact that the agent needs should live in exactly one authoritative place. One single source of truth for every single fact.

This means avoiding duplication. You might write a rule in your AGENTS.md, then paste a slightly different version into a doc. Maybe they're being edited in different places, or they come in from different pull requests. Now you have these different, often competing sources of truth for what is exactly the same information.

When you have lots of duplication, the agent often can't tell which copy is live, so it trusts the wrong one. You can even have duplication within the same file when it's particularly long.

The Cost of Duplication

Duplication costs you in three ways:

  1. Maintenance - Every time you need to change the behavior, you have to change it in multiple places.
  1. Context load - You're paying tokens saying the same thing over and over.
  1. Prominence - That duplicated information becomes more prominent than the stuff that hasn't been duplicated, so it weights much higher than its actual real importance.

This means duplicated content drowns out other important information that just hasn't been duplicated. A fact with three homes is a fact you no longer control.

Keep every fact in one place, and point at that place from everywhere else.

Test 2: Sediment

Sediment is the second thing that rots a steering file. Sediment is really a psychological problem, it's a problem in how teams tend to work with these files.

Sediment layers build up in your AGENTS.md file over time because adding feels safe and removing feels risky. Any steering file without a strong pruning discipline will fall into sediment, becoming longer and longer and longer.

Every rule makes sense the day you write it. But projects move. The library gets swapped, conventions change, the bug you were guarding against gets fixed. And the rule you wrote for it stays. Nobody deletes it. It settles at the bottom of the file, dragging the agent toward a world that no longer exists.

This means your AGENTS.md file slowly becomes more irrelevant for more tasks. Having sediment means you get a lot of irrelevant stuff in the context window loading up the context and making the agent perform worse.

Identifying Sediment

Sediment is particularly dangerous because it was probably once correct. It might have been correct for a bit, or it might just be correct but not applicable in all situations. You need to be ruthless with removing it or putting it behind a pointer.

Ask of every line: is this still true?

Test 3: No-Ops

No-ops are probably the most pernicious problem, the most easy to add and hardest to remove.

A no-op is an instruction that just does nothing, it changes nothing about the output. This happens in two ways:

  • The model already does it by default
  • It does nothing in the context of that particular steering instruction

Imagine you've written an /implement skill and it has an instruction saying "write a detailed commit message." Is that instruction actually needed? What would happen if you deleted it? Would it still write a good commit message? Probably it would.

So you're paying context load to tell it what it would have done regardless.

Detecting No-Ops

The way you get rid of a no-op is simple: remove it and then see if the behavior has changed. If it hasn't changed, then that line was probably a no-op and could be deleted.

This test is one question: does this line change behaviour versus the default?

An instruction can be perfectly relevant to the situation and still be a no-op. It can be true, on-topic, and still not worth a single token, because the agent didn't need telling.

And a no-op isn't free. It's still in context, still paying context load, still diluting the lines around it that matter.

Putting It Together

So here's the pruning toolkit, three tests to run over every steering file:

  1. Is this instruction duplicated, breaking single source of truth?
  2. Is this instruction a piece of sediment that is true once but not true now?
  3. Is this line a no-op? Does it actually do anything to change behavior?

Anything that fails these three tests is not earning its place in the context window. It's just costing you context load for no gain.

Cut it, and you'll notice that your steering improves massively.

Quiz

Your implement skill says 'write a detailed commit message.' You delete the line and the commit messages come out the same. What now?

  • It was a no-op, so the line stays deleted
  • Put it back - it was holding the quality up
  • Move it into AGENTS.md so it always applies
Answer
The behaviour did not change against the default, which is the whole test - so nothing was holding the quality up, the model was already doing it. Moving the line to AGENTS.md makes it worse: it now costs context load on every request instead of only when the skill fires, and it still changes nothing. An instruction can be true and on topic and still not worth a token.

The same naming convention is written in AGENTS.md and, in slightly different words, on a docs page. What do you do?

  • Keep one copy and point at it from the other place
  • Edit both copies until the wording matches exactly
  • Leave both - saying it twice makes the rule stick
Answer
Matching the wording still leaves two places to change every time the rule changes, and still gives the agent no way to tell which copy is live. Saying it twice does make it weigh heavier, but that prominence is the cost, not the prize: it outranks its real importance and drowns out the lines said only once. One authoritative home, pointed at from everywhere else.

A rule in your steering file guards against a quirk in a library your project swapped out last quarter. What happens to the line?

  • Cut it, or put what survives of it behind a pointer
  • Keep it, in case the old library ever comes back
  • Rewrite it as advice about libraries more broadly
Answer
Keeping a line that describes a world that no longer exists drags the agent toward that world, and you pay context load for it in every session while it does so. Generalising it produces a line that is true of everything and changes no behaviour - a no-op, which is not an upgrade on a false rule. Sediment gets cut, or moved behind a pointer where it costs nothing.

Trying Out Pruning

Commit Map
init-generated-claude-md Start the lesson: the bloated AGENTS.md that /init generated
pruned-claude-md See my solution: AGENTS.md pruned to a navigation layer, with testing-services and adding-a-route extracted as skills

An agent can generate an AGENTS.md file from scratch using the /init command. It will scan your codebase and create steering guidance automatically.

The problem? It usually creates something enormous. Generic advice, boilerplate, directory listings, command tables - many things that don't actually change how the agent behaves. And all of it costs tokens every time the agent runs.

Your job is to read through a generated file and prune it ruthlessly. Keep only what earns its place in every session. Delete the rest.

The Three Tests

Use these three filters from the pruning toolkit to decide what stays and what goes:

Single source of truth Is this fact already true somewhere else in your codebase, or duplicated inside the file itself? If the agent can discover it by reading code, you don't need to steer it toward it.

Sediment Is this actually true of your specific project, or is it generic filler that could apply to any codebase? "Write unit tests for all new utilities" is sediment. "Our tests run on Vitest in watch mode with npm run test:watch" is not.

No-ops Does this change the agent's behaviour versus what it already does by default? If it doesn't influence decisions, it's taking up space for nothing.

Everything that fails any of these tests should be cut. Behind what remains, ask yourself: does every line earn a place in every session?

Steps To Complete

  • Open the generated AGENTS.md file and read it through from top to bottom

Get a sense of its structure. Note sections that feel generic, sections that duplicate what's obvious from the code, and sections that repeat information already in the file.

  • Identify no-ops

Look for advice that reads like best practices rather than project-specific guidance. Examples: "Write unit tests for all new utilities", "Provide helpful error messages to users", "Never include sensitive information in commits". These don't steer the agent - they describe what it already does.

Mark them for deletion.

  • Identify sediment

Find lines that could apply to any codebase rather than your specific one. A generic project overview, a command table listing every npm script without context, directory listings, generic development tips. These aren't lies, but they're not earning their tokens.

Mark them for deletion.

  • Identify duplication

Scan for facts repeated within the file. Check if any section duplicates information that lives in a README.md, package.json, code comments, or type definitions elsewhere in the repo. If the agent can read the source, you don't need to transcribe it.

Mark the redundant copy for deletion.

  • Run /context in a fresh terminal to measure token usage

Open a new agent session in the same directory and run /context. Note the token count for the Memory Files section - this shows what AGENTS.md is costing you per session.

You'll use this number to verify your pruning worked.

  • Delete or refactor marked sections using /writing-for-agents

For each section you marked, decide: delete it entirely, or move it behind a pointer (a link or reference to where the agent can find the real source)?

Use the /writing-for-agents skill to help you edit the file. It will guide you through rewriting sections to be tighter and more precise, or removing them entirely.

If a section is truly important but already documented elsewhere, add a pointer instead. If it's genuinely generic or redundant, delete it outright.

  • Run /context again and compare

Open a fresh agent session and run /context again. The Memory Files token count should drop noticeably. This is your proof that pruning worked.

  • Verify the file still makes sense

Read through the pruned AGENTS.md one more time. Does every remaining line steer the agent toward decisions it wouldn't make otherwise? If yes, you're done. If you spot more that could go, cut it.

Trying Out Pruning Solution

Commit Map
init-generated-claude-md Start the lesson: the bloated AGENTS.md that /init generated
pruned-claude-md See my solution: the 11-line AGENTS.md, with the testing and routing procedures behind skills

The first thing to think about when looking at a bloated AGENTS.md file is duplication. Not just duplication within the file itself, but duplication within easily accessible sources inside the codebase.

Finding the Duplicates

The most obvious duplication appears in the development commands section.

The development commands section showing npm run dev, npm build, and npm start

The development commands section showing npm run dev, npm build, and npm start

You'll find npm run dev, npm run build, and npm run start listed there, but these commands already live in package.json:

{
  "scripts": {
    "dev": "react-router dev",
    "build": "react-router build",
    "start": "react-router-serve ./build/server/index.js"
  }
}

It's trivial for an agent to find these commands in package.json.

They're the executable source of truth. The descriptions of what each command does can be inferred from the agent's parametric knowledge - it knows that npm run dev starts a dev server, and it can verify that from the output it sees. There's no need to duplicate this information.

This is a single source of truth violation. When you have two pieces of information competing to be authoritative, you should keep the executable thing as the source of truth.

The Overview and Tech Stack Problem

Look at the overview and tech stack sections. That same information already exists in the project's README.md at the root:

README.md showing the overview and tech stack

README.md showing the overview and tech stack

> The exercise repo for the AI Coding Crash Course

This is a full-stack course platform (think a mini Udemy) built with React Router, TypeScript, SQLite, and Drizzle ORM.

The agent knows the README.md exists at the root of the project. It can read it and understand the tech stack from there. It can also look at the directory structure and see that it's a React Router project. If it needs to check the version of React Router being used, it can look inside package.json and see the installed version.

These sections don't need to exist in AGENTS.md at all.

The Preamble is a No-Op

The preamble line in AGENTS.md saying 'This file provides guidance to Claude Code'

The preamble line in AGENTS.md saying 'This file provides guidance to Claude Code'

The opening line that says "This file provides guidance to the agent when working with code in this repository" - everyone already knows that. The agent knows it. The harness knows it. This is information that adds no value and should be removed entirely.

Formatting Rules Are Assumed Knowledge

The Prettier configuration line in AGENTS.md

The Prettier configuration line in AGENTS.md

There's a line about Prettier being configured in .prettierrc. The agent can tell that Prettier is being used for several reasons:

  • It can see .prettierrc exists at the root by running ls
  • It can see Prettier in package.json as a dependency
  • It already knows Prettier conventions from its training

There's no reason to spell this out.

The Directory Structure Listing

The entire directory structure section in AGENTS.md

The entire directory structure section in AGENTS.md

An entire directory structure is listed out, but this just repeats the source of truth that exists in the filesystem itself. These navigation pointers can be useful, but only when they point to something that's genuinely hard to find. For example, scripts/seed.ts sits outside the app directory, so it makes sense to highlight it. But listing out app/routes/, app/services/, and app/components/—these are obvious from a directory listing.

Some of these pointers are worth keeping if they provide real navigation value, but the entire directory structure section is mostly redundant.

The Architecture Section Contains Inline Documentation

Here's where things get interesting. The architecture section contains lots of detailed information, but much of it is already documented in the code itself.

When you look at app/db/index.ts, you find:

// The connection is opened lazily, on first use. Opening it at module scope
// made this module side-effectful, which meant Rollup could not drop it from
// the client bundle when a route imported a service purely for its loader -
// dragging better-sqlite3 into the browser. Keep this file side-effect free.

This exact explanation already exists in the code.

comment-markdown.server.ts showing the comment header

comment-markdown.server.ts showing the comment header

Look at app/lib/comment-markdown.server.ts and you'll see:

// ─── Comment Rendering ───
// Deliberately separate from renderMarkdown (~/lib/markdown.server).
//
// renderMarkdown handles lesson content and sales copy, which are written by
// instructors - trusted input, raw HTML allowed through. Comments are written by
// students, so the same treatment would be stored XSS against every reader.

Again, this documentation is already there, inline with the code. The agent will read it.

What Actually Earns Its Place

Some information genuinely earns its place in AGENTS.md. For example, the fact that routing is config-based, not file-based. If an agent creates a route file and doesn't register it in the route table, the route won't work and returns a 404.

Without this guidance, agents will miss this step consistently. This is behavior-changing information that should stay.

The same goes for the vi.mock getter pattern for testing. If you use a plain object instead of a getter function, the test captures the value once at mock time. Every test after the first then runs against a stale, closed database. This fails silently - your tests pass, but they're testing against old data.

The Testing Block Should Go Behind a Pointer

The testing block in AGENTS.md is a full procedure. It teaches you how to write tests with the database mock. This is the natural candidate for a skill extraction.

Instead of keeping this inline in AGENTS.md, it should live behind a pointer. When an agent is writing a test, it should be invited to read the testing-services skill. When it's adding a new route, it should see the adding-a-route skill.

This way, AGENTS.md becomes an index with navigation pointers, not a procedure manual.

Clearing Context and Re-Evaluating

After reading through the whole file once, clear the context window and start fresh. This resets your thinking.

The /context output showing 2.4k tokens

The /context output showing 2.4k tokens

At this point, AGENTS.md is roughly 2.4k tokens. That's about half of where it started. The question now is: can we get more aggressive?

Running /writing-for-agents

Ask the /writing-for-agents skill to do the pruning work:

I want you to find me candidates in AGENTS.md that have single-source-of-truth issues between AGENTS.md and the rest of the stuff on the filesystem. I want you to give me candidates for removal or for putting behind pointers. Basically, I want you to do a whole pruning pass on AGENTS.md, and the ideal state for it should be just a few navigation pointers to different documentation.

The agent will read through the file and the filesystem, checking each claim against its actual source.

It should report back with:

  • Verbatim duplicates that already exist in code comments
  • No-ops that the agent already knows how to do
  • Obvious filesystem facts that don't need stating
  • Lines that genuinely earn their place

After the first pass, you're down to 51 lines. Much better.

The pruned AGENTS.md file after the first pass

The pruned AGENTS.md file after the first pass

The agent has aggressively removed things. It kept the config-based routing requirement, the vi.mock getter pattern, the TypeScript typegen issue, and the dev UI error message mapping.

The agent's report showing what it removed and kept

The agent's report showing what it removed and kept

But there's still more to prune.

A Second Pass: Putting Things Behind Pointers

Now ask the skill for another pass:

I would like you to do another pass for me and look for opportunities where we can take even more stuff out of AGENTS.md and put them behind pointers. I agree with the deletions that you've made, but I think there are more opportunities for putting existing docs behind pointers and writing careful descriptions so that they are grabbed at the right time.

On this second pass, the agent will:

  1. Extract the testing pattern into a testing-services skill
  2. Extract the routing pattern into an adding-a-route skill
  3. Create a triage table for error symptoms and their causes
  4. Keep only the navigation layer in AGENTS.md
The final 31-line AGENTS.md file

The final 31-line AGENTS.md file

The agent is following a principle: task procedures have predictable triggers. You know when you're adding a route. You know when you're writing a test. These belong behind pointers with clear descriptions. Error recovery has unpredictable triggers, so the triage table stays inline.

What the Skills Look Like

The testing-services skill file

The testing-services skill file

The testing-services skill contains the full vi.mock pattern, explains why the getter specifically matters (stale database on test 2+), and includes the single-test invocations:

Use when adding or changing a test under app/services or app/lib, or when a test writes to data.db instead of an in-memory database.
The adding-a-route skill file

The adding-a-route skill file

The adding-a-route skill contains the config-based routing explanation, the two-edit requirement, the filename convention with dots and dollar signs, and the loader/action-authorised-separately rule:

Use when adding or removing a page, URL, or route, or when a new route renders a 404.

The Triage Table

The 'When something breaks' triage table

The 'When something breaks' triage table

What stays in AGENTS.md is a simple triage table that maps symptoms to causes:

SymptomCause
401 "Select a user from the DevUI panel"No user in the session
tsc reports every ./+types/* import missingTypegen has not run. Use npm run typecheck
A test run leaves rows in data.dbThe ~/db mock is wrong

This is exactly what a navigation pointer is for. When something breaks, you don't need the full procedure - you just need to know which lever to pull.

Deleting the Obvious No-Ops

After the agent's second pass, you'll see some things that are still no-ops:

  • A line saying that the comment header convention documents modules
  • A directory listing that repeats the filesystem
  • A pointer to the database migrations skill when the skill itself is already loaded

These can be deleted. The comment header is already obvious from reading the code. The directory listing is already visible. The database migrations skill is already auto-loaded as a skill, so a line in AGENTS.md pointing to it is a third copy of information.

The Final File

By the end, AGENTS.md is just 11 lines:

Requests flow route → service → Drizzle. Routes own HTTP concerns and
rendering; services own data access and use the shared db instance
directly rather than receiving a handle.

## When something breaks

| Symptom | Cause |
| 401 "Select a user from the DevUI panel" | No user in session - use the DevUI panel |
| tsc reports ./+types/* missing | Typegen hasn't run - use npm run typecheck |
| Test run leaves rows in data.db | The ~/db mock is wrong - see testing-services skill |

Every line is doing work. There's no sediment. There's no duplication. There's no telling the agent things it already knows.

The Discipline

The real discipline isn't writing more steering documentation. It's keeping what you have honest.

When you write guidance for an agent, you're creating a maintenance burden. Every line you keep needs to stay current. Every claim you make needs to stay true. The longer the file, the more likely it is to rot, to drift from the actual codebase, to become a liability.

The pruning process forces you to ask hard questions:

  • Does the agent already know this?
  • Is this documented somewhere else?
  • Is this a real pitfall or a no-op?
  • Will this statement still be true in a month?

By the time you're done, what remains is lean and honest. It's the difference between guidance that actually steers behavior and noise that the agent learns to ignore.

Claude Code's Automatic Memory

There's one more source of steering that we haven't discussed, and that is the one that the agent writes for itself.

How Automatic Memory Works

Most harnesses ship with a memory system, one that the agent writes to and reads from without you necessarily asking. As you work, the agent notices things worth remembering. So it notices a correction that you made to its behavior or a preference that you expressed or a fact about how you want work done and then saves it into a local file somewhere.

Those files then get read into the context window in later sessions. Depending on the harness, it's either like an AGENTS.md, pushed in, or as a pointer.

This means, in theory, the agent builds up a picture of how you like to work without you needing to steer it. It's steering itself. It's grabbing the wheel.

Finding Automatic Memory

Claude Code /memory command showing auto-memory is on

Claude Code /memory command showing auto-memory is on

In Claude Code, we can look at this by running /memory here, and we can see that automatic memory is on.

We can see that it uses CLAUDE.md as the name for memory, which is interesting. And there's also an auto-memory section.

Auto-memory folder opened in Chrome showing MEMORY.md file

Auto-memory folder opened in Chrome showing MEMORY.md file

When we press "open auto-memory folder," it opens in Chrome (oddly enough), and there is a little MEMORY.md file in here.

The auto-memory file is stored outside your repo, in Claude Code's per-project state directory, keyed by the current working directory. That's why it never shows up in git status and never gets code-reviewed.

What Auto-Memory Contains

Inside MEMORY.md there's an index of pointers to memory files the agent has written. In this case, there's an entry that reads:

- Editing course repos skill - this is a course repo; the governing skill lives in personal-wiki, not here

That's the agent reading its own memory back at you. It's noticing facts about your project and stashing them for later sessions.

The linked memory file itself uses the same shape as a skill. It has YAML frontmatter with name and description, then a body. The agent is essentially writing itself skills behind your back.

The Problem With Stale Memory

Here's the issue: automatic memory is like auto-sediment. It's sediment that's writing itself, building up stale layers that are very rarely removed by the agent.

The agent writes entries and doesn't remove them. So the file only grows. Every line in it is paying a context load in every session. A preference you had once and changed becomes a wrong assumption the agent keeps trusting. A hint that fit one task becomes a rule that follows you into every task after.

And because you didn't write these lines, you're less likely to go in and prune them.

If you look at the memory metadata, you can see the original session that created it, often weeks old. It's been silently riding along in the context window ever since.

The Recommendation

I've already shown you how ruthlessly I prune AGENTS.md, how much I dislike having the agent steer itself because of all these no-ops and the rubbish that it piles into the context window. Automatic memory is exactly that problem, except now it happens without you deciding what goes in.

So here's what I recommend: go into auto-memory and turn it off.

Turning off auto-memory in Claude Code settings

Turning off auto-memory in Claude Code settings

Now no memories will be stored. This reduces the context window because you don't have the tool in there to create memories. What a relief.

A lot of people ask me about memory systems and whether they should add them into their setups. My answer is: no. You as the user should be in control of how memories are created, how steering is done.

Because if you allow these automatic memories to just accrue and accrue, then you're building up useless sediment in your context.

The whole point of this section is steering on purpose: choosing what earns a place in context, and keeping it current. Automatic memory works against that. It's steering you didn't choose, accumulating where you're not looking.

Quiz

Your harness offers to remember corrections you make and feed them back in later sessions, without you asking. Do you leave it on?

  • No - turn it off and steer with files you wrote
  • Yes - it learns how you work at no effort to you
  • Yes, but read the memory folder before you start
Answer
The agent writes entries and does not remove them, so the file only grows and every line pays context load in every session - that is not free learning, it is sediment writing itself. Reading the folder before each session is work you will not keep doing, and lines you did not write are the ones you are least likely to prune. Turning it off also takes the memory tool out of the window.

Why does an automatic memory file never turn up in a code review?

  • It is kept outside the repo, in per-project state
  • It is written into the repo, but ignored by git
  • It is rebuilt each session, so there is no diff
Answer
It is not in your repository at all, so there is nothing for git to ignore - it sits in the harness's per-project state directory, keyed by the working directory, which is why it never shows in git status. It is not rebuilt each session either: entries written weeks ago are still riding along in the context window.

The agent saved a preference you held three months ago and have since changed your mind about. What happens in today's session?

  • It loads, and the agent acts on the old preference
  • It ages out, since newer corrections replace it
  • You are asked to confirm it before it gets used
Answer
Nothing ages these entries out and nothing asks you about them - the agent writes them and very rarely removes them, so a preference you have changed becomes a wrong assumption it keeps trusting, and a hint that fitted one task follows you into every task after. It goes on paying context load until you go in and delete it yourself.