Sub topic 9
Working alongside CLAUDE.md and other instruction files
This chapter assumes you have a working AGENTS.md at the repository root, know how nested files and precedence work, and can create symbolic links on the command line. It covers what to do when different tools look for different filenames.
Why several instruction files exist
AGENTS.md is a shared convention, but not every tool reads it. Some tools look for their own filename and ignore everything else. Claude Code reads CLAUDE.md. Other tools use files such as .github/copilot-instructions.md, GEMINI.md, or rule files under a .cursor/ directory. The exact names and the tools that support AGENTS.md change over time, so check each tool's documentation before you rely on a particular behavior.
If you write a separate file for every tool, you get the same problem you have with duplicated documentation. The build command changes, you update one file, and the others go stale. Different agents then follow different rules in the same repository.
The goal of this chapter is one source of truth. You keep shared guidance in AGENTS.md and make other files either point to it or add only what is specific to one tool.
Decide what is shared and what is tool-specific
Before you choose a technique, sort your instructions into two groups.
- Shared: setup, build, test and lint commands, code style, directory layout, pull request rules. Every agent needs these, and they belong in AGENTS.md.
- Tool-specific: settings that only make sense for one product, such as a slash command, a permission mode, or a feature that only that tool has.
Most repositories have far more shared content than tool-specific content. If a tool-specific file grows large, check whether some of it is really shared guidance that should move to AGENTS.md.
Option 1: a symbolic link
A symbolic link (symlink) is a filesystem entry that points to another file. A tool that opens CLAUDE.md reads the content of AGENTS.md.
# Keep one source of truth for tools that read a different filename
ln -s AGENTS.md CLAUDE.mdRun this from the repository root. The link target AGENTS.md is relative to the directory that contains the link, so the same command works in a nested package directory when both files sit in that directory.
Git stores a symlink as a small entry that records the target path. After you commit it, collaborators on Linux and macOS get a working link when they clone.
Symlinks have limits:
- On Windows, creating symlinks may need developer mode or elevated rights, and Git must be configured to check them out as links. Otherwise the link can appear as a plain text file that contains only the path
AGENTS.md. The tool then reads that one line and gets no useful instructions. - Some archive formats, zip downloads, and sync tools do not preserve symlinks.
- You cannot add tool-specific notes. Both names show the same content.
Check the result after cloning on each platform your team uses. cat CLAUDE.md should print the full AGENTS.md text.
Option 2: an import reference
Claude Code supports importing another file into CLAUDE.md with an @ reference. Then CLAUDE.md can be a short file that pulls in AGENTS.md and adds its own notes.
# CLAUDE.md
@AGENTS.md
## Claude-specific notes
- Prefer running the single-file test command while iterating.The @AGENTS.md line tells the tool to load that file's content at that point. The notes below it apply only when Claude Code reads the file. Other agents read AGENTS.md directly and never see them.
An import is the better choice when you have a real tool-specific instruction, or when your team works on Windows and you want to avoid symlink problems. It costs you a small file that you must keep in place.
Import syntax is a feature of the tool, not of Markdown. In a tool that does not support @ references, the line shows up as literal text and the shared content is not loaded. Confirm support in the tool's documentation, and test it (see the verification section below).
Option 3: a pointer in plain words
Some tools have no import syntax and no AGENTS.md support, but they can follow a plain sentence. A short tool-specific file can say:
# Instructions
Read AGENTS.md in the repository root before making changes and follow it.This relies on the agent opening another file by itself, so it is the least reliable option. It may work well in an agent that can read files and poorly in a tool that only injects the instruction file into its prompt. Use it only when the other options are not available, and test it.
Comparing the options
| Approach | Shared content | Tool-specific additions | Main risk |
|---|---|---|---|
| Symlink | Identical text under both names | Not possible | Broken links on Windows or in archives |
| Import (`@AGENTS.md`) | Loaded by the tool at read time | Yes, in the same file | Tool must support imports |
| Plain-words pointer | Agent must open the file itself | Yes | Agent may skip the pointer |
| Full copy | Duplicated text | Yes | Copies drift apart |
Avoid the full copy unless a tool leaves you no other choice. If you must copy, generate the copy from AGENTS.md in a script or a CI step and commit the result, so a person never edits it by hand.
How the choices fit together
Nested files and tool-specific files
The directory rules from the earlier chapters still apply. The tool-specific file has to sit where that tool looks for it. In a monorepo, if packages/web/AGENTS.md exists and a tool needs CLAUDE.md there, create the link or the import in packages/web/ as well.
repo/
├── AGENTS.md
├── CLAUDE.md # symlink or import of AGENTS.md
└── packages/
└── web/
├── AGENTS.md
└── CLAUDE.md # symlink or import of packages/web/AGENTS.mdA common mistake is to link only the root file. An agent that works in packages/web/ then follows the root guidance and misses the package rules, because the tool never saw the nested AGENTS.md.
Precedence between files of different names is defined by each tool. If a repository has both AGENTS.md and CLAUDE.md in the same directory, and the tool reads both, it may combine them, prefer one, or load both in a specific order. Do not guess. When the two files say different things, the outcome is unpredictable, which is why one source of truth matters.
Conflicts and contradictions
Duplication is most harmful when copies disagree. Suppose AGENTS.md says to run npm test, and an old .github/copilot-instructions.md says to run yarn test. One agent follows each file, and the results differ between tools, which is hard to debug.
To find stale files, search for the commands you use:
# List instruction files that mention a test command
grep -rn --include="*.md" -e "npm test" -e "yarn test" -e "pnpm test" .Then compare the results with your AGENTS.md. Remove or replace any file that contradicts it.
Tool-specific files that are not Markdown
Some tools use other formats, such as rule files with front matter that says which paths a rule covers. These formats can scope a rule to a glob like src/**/*.ts. AGENTS.md has no such field, since it has no required structure. If a tool needs that scoping, put the scoped rule in the tool's file, and keep it short. Point readers to AGENTS.md for everything else, so the two do not diverge.
Checklist for a mixed-tool repository
- Put all shared guidance in AGENTS.md.
- List the tools your team uses and the filename each one reads.
- For each tool that does not read AGENTS.md, choose a symlink or an import.
- Create the file in every directory that has its own AGENTS.md, if the tool needs it there.
- Delete or regenerate old tool files that copy AGENTS.md.
- Add a note to your pull request template or contributing guide: "Edit AGENTS.md, not the generated or linked files."
- Test each tool by asking it something only the instructions can answer.
Exercises
Exercise
Your team uses Claude Code, which reads CLAUDE.md, and another agent that reads AGENTS.md. Two developers use Windows, and you also want one Claude-only note about running single test files. Which approach fits best, and what does the CLAUDE.md file contain?
Show answer
Use an import, not a symlink. A symlink may break on Windows and cannot hold the Claude-only note. CLAUDE.md contains the line @AGENTS.md, followed by a short section such as "## Claude-specific notes" with the single-file test advice. Then test that Claude Code actually loads the shared rules.
Exercise
A monorepo has AGENTS.md at the root and in packages/api/. You created a CLAUDE.md symlink only at the root. An agent that works in packages/api/ ignores the API test command. What is the likely cause and the fix?
Show answer
The tool never found a CLAUDE.md in packages/api/, so it only used the root guidance. Create a CLAUDE.md link (or import file) in packages/api/ that points to the AGENTS.md in that directory, then verify by asking the agent for the API test command.
Exercise
After cloning on Windows, a colleague reports that cat CLAUDE.md prints only the text AGENTS.md. What happened, and name two ways to fix it?
Show answer
Git checked out the symlink as a plain text file containing the target path, so the tool reads one useless line. Fix it by enabling symlink support (developer mode and Git's core.symlinks setting) and re-cloning, or by replacing the symlink with a CLAUDE.md that imports AGENTS.md using @AGENTS.md.