Home/Blog/How to Make CLAUDE.md Import AGENTS.md
Blog

How to Make CLAUDE.md Import AGENTS.md

P
promptstudio
How to Make CLAUDE.md Import AGENTS.md

Claude Code reads CLAUDE.md. Cursor reads AGENTS.md. If you write both from memory, the policy list drifts by Friday. This post is not the broader keep-one-AGENTS.md essay already on the blog. It is the adapter job: a CLAUDE.md that imports the canon, without inventing scripts, stack versions, or a second philosophy.

The matching generator is the CLAUDE.md Adapter that Imports AGENTS.md prompt. Browse related cards in the PromptDig library (Browse more prompts). When a filled run survives, share the version you actually use (Share a prompt).

Canon stays AGENTS.md; CLAUDE.md is a translation

AGENTS.md remains the always-on policy: what the repo is for, commands that actually run, PR bar, refuse list, path exceptions. CLAUDE.md should point at that file and restate only what Claude Code needs to find it.

Do not paste Cursor mdc YAML globs into CLAUDE.md and expect them to work. Claude will treat them as prose and ignore the glob. Translate path exceptions as headings or short when-you-touch-this-folder paragraphs, in the same words as the canon.

If a command is not in AGENTS.md or the tree, it is not in CLAUDE.md. Inventing a strict e2e script because it sounds right is how Claude Code runs a command that does not exist and then rewrites package.json.

Import, do not fork a second policy

The adapter should say, in some form: read AGENTS.md first; if this file and AGENTS.md conflict, AGENTS.md wins. Product memory is not a third policy. Memory that contradicts the canon is a bug, not a preference.

Keep the refuse list verbatim. If the canon forbids invented IDs and live network in unit tests, those sentences copy. Paraphrase is how a live-API ban becomes "prefer mocks" and a live call lands in a PR.

Install path is the repo root CLAUDE.md, or a nested CLAUDE.md only if the canon already has nested agent files. Do not sprinkle CLAUDE.md into every package for coverage.

Related cards in the library cover Cursor mdc and Copilot instructions.md. Use those as sibling adapters. Do not merge all three hosts into this file.

Edge cases and a checklist that does not invent versions

If AGENTS.md names Node 20 because the tree pins it, CLAUDE.md may repeat that pin. If no version is pinned, write unknown and omit it. Use-the-latest-LTS is an invented upgrade.

Monorepos: say which package Claude should treat as cwd for commands that the canon already scoped. Do not invent a package graph.

Validation: open CLAUDE.md next to AGENTS.md and diff the refuse list. Run one listed command. Confirm Claude Code actually loads the root file. Confirm you did not leave Cursor front matter in the Claude file.

Gaps: missing commands, unstated test runners, host-specific tools the user never named. Do not backfill those to look complete.

This is repo policy for a coding assistant, not legal or HR advice. Strip any credentials from a paste before they hit the prompt.

Fill the card, then run

Paste AGENTS.md, or the parts you treat as canon. Name commands that already run. Leave versions blank if the tree does not pin them.

Goal: [CLAUDE.md that imports AGENTS.md]
AGENTS.md paste or path: [Canon]
Stack versions I can prove from the tree: [or unknown]
Constraints: [Monorepo cwd, nested files, memory vs canon]
Forbidden: [Invented scripts, Cursor YAML globs, new refuse list]
Acceptance checks: [Refuse list verbatim, commands exist, AGENTS.md wins]

You do not need two brains in one repo. You need one canon and a Claude-shaped door. When a run keeps the refuse list word-for-word and refuses a fake e2e script, share that filled adapter. The Cursor and Copilot forks should be regenerated the same day.

If you add a refuse-item later, add it to AGENTS.md first, then re-run this adapter. Drift starts when someone just patches CLAUDE.md during a session and forgets the canon.