Back to all rules / Format and vendor rules

import-outside-root

@import reaches outside the project.

warning by default Format and vendor rules Inline suppression allowed

Source: Claude Code docs: How Claude remembers your project (code.claude.com), read 14 October 2026.

On GitHub: the rule doc and the tests.

Jump to another rule89

What it catches#

@import reaches outside the project.

An @path import that reaches outside the project: a home-folder path such as @~/.claude/prefs.md, or a relative path that climbs above the root.

Why it matters#

Claude Code asks for approval before loading external imports, and teammates will not have the file.

Bad example#

# CLAUDE.md

@~/.claude/my-preferences.md

Claude Code treats an import outside the working directory as external and shows an approval dialog the first time; if the person declines, the import stays off. Teammates do not have the file at all, so the project instructions differ from one machine to the next. claude -p never shows the dialog, so in scripts and CI the import loads only if someone already approved it in an interactive session.

Good example#

# CLAUDE.md

@docs/conventions.md

Personal preferences go in ~/.claude/CLAUDE.md, which loads for every project without a dialog, or in CLAUDE.local.md, which is gitignored.

How to fix#

Move the imported content into the repository, or move the import to a user-scope file (~/.claude/CLAUDE.md, ~/.claude/rules/) where external imports are trusted as your own configuration.

Suppress or configure#

For one finding, put a comment on the line above it. The reason after -- is optional but worth writing:

<!-- asitis-disable-next-line import-outside-root -- why this one is fine -->

For a whole file:

<!-- asitis-disable-file import-outside-root -- why this file is an exception -->

For every file, turn it off or change its severity in .asitisrc.json:

{ "rules": { "import-outside-root": "off" } }

A .asitisrc.json overrides entry limits a change to some paths, and a baseline (asitis lint --format json --write-baseline) accepts today's findings so only new ones fail the build.

Source#

Claude Code docs: How Claude remembers your project, read on 14 October 2026.

See what an agent changed in your CLAUDE.md. Keep or revert each change.

The linter is free and needs no signup. I'm also building a desktop editor for the markdown your agents write and read. It shows what an agent changed since you last looked, lets you keep or revert each change, and never touches a line you didn't edit. No release date yet. One email to confirm, one when the paid beta opens, one when 1.0 ships. $29 once for a founding licence, with 24 months of updates.

Or add the linter to CI, no email needed.

Your address is stored with Cloudflare, which hosts this site. No IP address is kept. See the privacy policy.

Back to all rules

This page is generated from the plugin's rule registry. Edit it on GitHub. False positive? Open an issue with the line it fired on.