Skip to content
BENIBIX Learn

Agentic Coding and AGENTS.md

Level 5 · Prompts for code

How a coding agent works through a task on its own. How to write a task it can finish, and what goes in the AGENTS.md file it reads first.

Course contentsLesson 14 of 16

After this lesson you can

  • Write a task a coding agent can finish and you can check
  • Write a short agent instruction file
  • Review an agent's changes before keeping them

12 mincovers 3 glossary entries

Worth reading first: Code Generation and Completion

How a coding agent works, and what to tell it

Agentic coding hands a task to an AI that can act, not just suggest. It reads files, edits code, runs the tests and reads the results, then does it again until the task is done. An agent instruction file, often named AGENTS.md, tells it how your project works. Over 60,000 open projects use one.

Your job moves from typing to directing and checking. You set the goal, the agent does the steps, and you review what it changed. A good task for an agent is one you can check quickly: a failing test, a small feature or a rename across many files.

The prompt for an agent is a task, not a question. Say what done looks like. Fix the login bug is vague. The login test fails on an empty password, make it pass without changing the test, tells the agent where to look and what not to touch.

An agent instruction file holds what every task needs. How to run the tests, which style to follow and which folders to leave alone. The agent reads it at the start of each task, so you stop repeating yourself. It is plain Markdown, kept in the project with the code.

Keep the file short and true. Every line in it is sent with every task, so it costs tokens each time. A long file buries the rules that matter. When the agent keeps making the same mistake, add one line about it. When a line stops being true, delete it.

Different tools look for different names. AGENTS.md is a shared name that many tools read. Some tools have their own, such as CLAUDE.md for Claude Code. Many teams keep one file and point the others at it, so the rules live in one place.

Review is still yours. An agent can make the tests pass and still do the wrong thing, such as changing a test to fit the bug. Read every changed line before you keep it, the way you would read a new teammate's first work.

markdown
# AGENTS.md

## Commands
- Run the tests: npm test
- Check the types: npm run typecheck

## Rules
- Write TypeScript, never plain JavaScript.
- Do not edit anything in the vendor folder.
- Ask before adding a new package.
A short instruction file. It says how to run the checks, and lists the three rules the agent kept breaking.
The agent loops until the tests pass. The last step is always a person reading the change.

Worked example

Jack's agent runs every test

Jack's agent ran every test in the project after each small change, and each run took 9 minutes. A simple task took over an hour.

He adds one line to AGENTS.md: run only the tests for the files you changed, then the full set once at the end. The next task takes 15 minutes.

The words for this lesson3

Check yourself

What belongs in an AGENTS.md file?

Finished this lesson?

Marking it complete also marks its 3 glossary entries learned, which updates your roadmap and your saved page. 0 are already marked.