By Abhijith N M · Reviewed 24 October 2026 · Editorial standards
A team wrote one rule for its code-review bot. Never approve a change that adds a network call inside a database migration. They put it in the repository's CLAUDE.md file and in the project instructions on claude.ai.
In Claude Code the rule held. Through their API service it did not. The bot approved the migration. Its API request carried a system prompt written eight months earlier, and no CLAUDE.md at all.
Same model, same words in the rule, different channel. Each surface loads its instructions from a different place.
| Surface | Where instructions live | What it can reach |
|---|---|---|
| Claude Code | CLAUDE.md, settings.json, Skills, commands, agents | The repository, the shell, and the files you permit |
| Desktop | App instructions, plus local files through connectors | Local files and connected tools, on your machine |
| claude.ai | Project instructions and the conversation itself | The conversation and any connected integration |
| API and SDKs | The system prompt, messages and tools you send | Only what your code puts in the request |
The API row is the one that surprises people. There is no inheritance. If a rule matters to an API call, your code must send it and your code must check the result.
A content boundary is the line between what stays inside one system and what leaves it. Four questions draw the line: which data leaves the process, which identity acts, what is retained, and what is logged.
For the code-review bot, the diff leaves only through the API request, so the request is the boundary. A rule that needs the whole repository belongs in Claude Code. It also fits server-side prompt assembly that reads the repository first. It does not belong in a chat message that a reviewer might forget to send.
The bot's output is consumed by a pull-request commenter. That makes the schema an interface between two systems, and interfaces get reviewed.
Prefer small closed sets to free text: a severity enum, a rule_id enum, a positive integer line number. Mark the fields downstream code depends on as required. An empty required field is a broken release, not a model quirk.
Change the schema the way you change a public endpoint. Add optional fields inside a version. Rename or remove a field only in a new schema_version, with a migration for the consumer. A rename that ships on a Friday is a refactor with no test.
FINDING_SCHEMA = {
"required": ("rule_id", "severity", "file", "line", "message"),
"severity": ("blocking", "advisory"),
"rule_id": ("NET-001", "SEC-004", "STYLE-010"),
"max_message": 140,
}
def validate(finding):
errors = []
for key in FINDING_SCHEMA["required"]:
if key not in finding:
errors.append("missing " + key)
if finding.get("severity") not in FINDING_SCHEMA["severity"]:
errors.append(f"severity {finding.get('severity')!r} not allowed")
if finding.get("rule_id") not in FINDING_SCHEMA["rule_id"]:
errors.append(f"rule {finding.get('rule_id')!r} not in the schema")
line = finding.get("line")
if not isinstance(line, int) or line < 1:
errors.append("line must be a positive integer")
if len(finding.get("message", "")) > FINDING_SCHEMA["max_message"]:
errors.append("message over the length limit")
return errors
FINDINGS = [
{"rule_id": "NET-001", "severity": "blocking", "file": "migrations/0042.py",
"line": 18, "message": "Network call inside a migration."},
{"rule_id": "SEC-004", "severity": "critical", "file": "api/auth.py",
"line": 7, "message": "Access token written to the log."},
{"rule_id": "STYLE-010", "severity": "advisory", "file": "models.py",
"line": 0, "message": "Rename for clarity."},
]
for finding in FINDINGS:
errors = validate(finding)
print(finding["file"], "|", "ok" if not errors else "; ".join(errors))Duplicating rules across four surfaces guarantees that three of them are stale. Keep one rules file in the repository. Import it into CLAUDE.md, and inject the same text into the system prompt at build time.
CLAUDE.md section and the API system prompt from that file in the build.Take your code-review rule and follow it to each surface.
Key takeaways
Each surface loads instructions from a different place; the API inherits nothing.
Repository rules and settings reach Claude Code; the API sees only the request body.
A content boundary answers four questions: what leaves, who acts, what is kept, what is logged.
A schema is an interface: closed sets, required fields, and additive changes inside a version.
A prompt is not an access control; permissions and validators belong in code.
Written and edited by the nexGenCoders team. Spotted a mistake? Tell us and we will fix it.
Don't lose this lesson
Create a free account to save your progress, keep your streak, and work toward a shareable certificate.