Sub topic 9
Working alongside CLAUDE.md and other instruction files
This chapter assumes you can write a basic AGENTS.md, know where it lives in a repository, and understand that the nearest file applies to the files you edit. Here you will learn how to keep that file useful when some tools look for a different filename.
Why more than one file exists
AGENTS.md is a shared convention, but not every tool reads it. Some tools look for their own filename, such as CLAUDE.md. Some teams also keep tool-specific files for editors or review bots.
If you copy the same rules into each file, the copies drift apart. One file says to run npm test. Another still says to run yarn test. An agent then follows whichever file it happens to read.
The goal is one source of truth. Shared facts go in AGENTS.md. Tool-specific files hold only what is unique to that tool, or they point back to AGENTS.md.
Option 1: a symbolic link
A symbolic link (symlink) is a file that points to another file. If a tool reads CLAUDE.md, the link makes it read the content of AGENTS.md.
# Keep one source of truth for tools that read a different filename
ln -s AGENTS.md CLAUDE.mdRun this in the directory that holds AGENTS.md. Commit the link so teammates get it too.
Use a symlink when the tool needs nothing beyond the shared rules. It is the simplest option, and nothing can drift because there is only one file.
Option 2: an import
Some tools let one instruction file import another. Claude Code supports an @ reference, so CLAUDE.md can pull in AGENTS.md and then add its own notes.
# CLAUDE.md
@AGENTS.md
## Claude-specific notes
- Prefer running the single-file test command while iterating.Use an import when you need a few extra lines for one tool. The shared rules still live in one place, and the extra notes stay short.
Choosing between them
| Situation | Better choice |
|---|---|
| The tool needs no special rules | Symlink |
| The tool needs a few extra notes | Import |
| Your tool does not support imports | Symlink, or keep the extra notes in AGENTS.md |
| Your platform handles symlinks poorly, such as some Windows setups | Import, or a short file that tells the reader to see AGENTS.md |
Check your tool's documentation for the import syntax it supports. A tool that does not understand @AGENTS.md will treat it as plain text and skip the shared rules.
Common errors
- Duplicated rules. Copying AGENTS.md into CLAUDE.md creates two files to maintain. Link or import instead.
- Conflicting rules. If a tool-specific file contradicts AGENTS.md, you cannot predict which one the agent follows. Resolve the conflict in one place.
- Broken links. A symlink created with the wrong relative path points to nothing. List the file with
ls -l CLAUDE.mdand confirm the target isAGENTS.md. - Tool-specific content in AGENTS.md. Notes such as "use Claude's plan mode" confuse other agents. Move them to the tool's own file.
- Nested files left out. In a monorepo, each nested AGENTS.md needs its own link or import if a tool reads only its own filename.
Summary of the approach
- Write the shared rules in AGENTS.md.
- For each tool with its own filename, add a symlink or an import.
- Put only tool-specific notes in the tool's file.
- Check that no rules are duplicated or contradictory.
Exercise
Your repository has AGENTS.md. A teammate uses a tool that reads only CLAUDE.md, and they want to add one note that applies only to that tool. Which approach fits, and what does the file contain?
Show answer
Use an import. Create CLAUDE.md that contains @AGENTS.md followed by a short section with the tool-specific note. A symlink would not work here because it cannot hold extra content without changing AGENTS.md for every tool.
Exercise
A CLAUDE.md symlink exists, but the agent ignores your test command. Name two checks you can run.
Show answer
Run ls -l CLAUDE.md to confirm the link points to AGENTS.md and is not broken. Then ask the agent to repeat a specific rule from the file. Also check that the tool is reading the directory that holds the link, since nested directories need their own.