# Agent Instruction File

> A file with the house rules for AI agents in your code.

**Field:** Artificial Intelligence  
**Category:** Working with AI  
**Also known as:** AGENTS.md, Agent Rules File, Project Instructions File

## Think of it like

Think of it like a note on the fridge for a babysitter. It lists the house rules.

## Definition

An agent instruction file is a text file in a project that tells AI coding agents how to work there. It lists things like how to run the tests, which style to follow and which folders not to touch. The agent reads it at the start of each task, so you do not have to repeat yourself. It is usually written in Markdown and kept with the code. Several tools have their own name for the file, and one shared name is catching on.

## Example

Emma's project has a file with four house rules, from running the tests to leaving one folder alone. Her agent follows them in every task. Some tools call it AGENTS.md, and others CLAUDE.md.

## Example code

```markdown
# Project notes for agents

- Run `npm test` before you say a task is done.
- Use two spaces, not tabs.
- Never edit files in `generated/`.
- Ask before adding a new library.
```

Four house rules. The agent reads them at the start of every task.

## Why it matters

You stop typing the same rules in every chat. The agent reads them from the file each time.

## Common mistake

Letting it grow huge. A long file costs tokens on every task and buries the rules that matter.

## Three principles

- **House rules.** How to work here.
- **Read every task.** No need to repeat.
- **Keep it short.** Only what matters.

## Related terms

- [System Prompt](https://learn.benibix.com/term/ai/system-prompt)
- [Agentic Coding](https://learn.benibix.com/term/ai/agentic-coding)
- [Context Engineering](https://learn.benibix.com/term/ai/context-engineering)
- [CLAUDE.md](https://learn.benibix.com/term/ai/claude-md)
- [Custom Instructions](https://learn.benibix.com/term/ai/custom-instructions)
- [Spec-Driven Development](https://learn.benibix.com/term/ai/spec-driven-development)

## Told apart from

- [Agent Skill vs Agent Instruction File](https://learn.benibix.com/compare/agent-skill-vs-agent-instruction-file): People think a skill is just another instruction file, and it is not. An instruction file, such as AGENTS.md, is read on every run, so it costs space each time. A skill shows only its name and a short note until a task needs it. Then the agent loads the full steps. Rules that always apply go in the file. Steps for one kind of job go in a skill.

## Taught in

- [Agentic Coding and AGENTS.md](https://learn.benibix.com/learn/ai-working-with-ai/agentic-coding-and-agents-md): Prompt Engineering, 14/16

![A project folder with a rules file in it. An arrow leads from the file to the agent, which then works on three tasks in turn.](https://learn.benibix.com/diagrams/pr-agent-instruction-file.svg)

---

Source: https://learn.benibix.com/term/ai/agent-instruction-file
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-18
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
