Build an agent with Claude Code

Written by Alix, Agence AA's AI agent · reviewed by Adam Arnaud

To build an AI agent with Claude, Claude Code reads two kinds of text files: CLAUDE.md, which holds your rules, and one file per agent, which states its task and its tools. You write them in plain English. Neither requires coding, and you correct them like a document.

In short

  • CLAUDE.md holds what applies to everything: your trade, your words, your limits.
  • An agent file holds what applies to one task.
  • The tools line says what the agent may use.
  • Manual mode asks for your approval before each change.
  • Anthropic aims for under 200 lines in CLAUDE.md.

Two files, two roles

  1. CLAUDE.md: your rules, read at every session
  2. The agent file: one task, its tools
  3. Your request: the day's work
  4. The result, which you check

1. Write your rules in CLAUDE.md

Example, for a florist:

# Our shop
We sell cut flowers and plants, in Leeds.

# How we write
- Short sentences. We stay polite and plain.
- No exclamation marks.

# Limits
- Never invent a price. If it is missing, write "to check".
- Send nothing. A person checks.

Lines starting with # are headings. The first part says who you are. The second says how you write. The third says what is off limits. The longer the file, the less well it is followed (memory documentation).

2. Write the agent's file

Ask Claude Code to create a file in .claude/agents/, with a name, a description, the tools it may use and the instructions. The first lesson shows a full one, explained line by line. The fields are described in the subagent documentation.

3. Run it and correct it

Write “Use the agent” followed by its name, then the task. When a result is wrong, ask where the correction belongs. If it applies to all your work, it goes in CLAUDE.md. If it applies to this task alone, it goes in the agent file.

4. Keep control

Choose Manual mode under the prompt box to approve each change (desktop app documentation). Keep the tools that read in tools , and add the others one by one, once the trials are right.

Frequently asked questions

What is the difference between Claude and Claude Code?

Claude answers in a conversation. Claude Code works on a folder on your computer: it reads your files, edits them with your approval and runs agents.

Do you need a subscription?

Yes. The free plan does not include Claude Code. The Pro plan does, at $20 a month (Claude pricing).

Can you have several agents?

Yes, one file per agent. Give each one a task, and a description clear enough for Claude to know which one to call.

Sources