---
published: true
id: rules
title: Rules
description: Knowledge captured in João Lopes' learning graph.
tags:
- ai-engineering
- behavioral-modeling
- claude-code
- agent-design
locale: en
resource: https://joaolopes.dev.br/knowledge/concepts/en/rules/
created: '2026-03-21'
---

# Rules
Path-scoped markdown files in the .claude/rules/ directory that provide modular, conditional instructions to Claude Code based on which files the model is working with.

## Definition
In Anthropic's terminology, rules are modular markdown files in .claude/rules/ that can be scoped to specific file paths using glob patterns in YAML frontmatter. Rules without a paths field load at session start; path-scoped rules load on demand when the model reads matching files. Rules are distinct from instructions (CLAUDE.md files loaded by directory hierarchy) — they solve the scaling problem of monolithic CLAUDE.md by making context conditional. Like instructions, rules are passive: they are loaded into context but the model may not follow them. For enforcement, see hooks.

## Source
- [How Claude Remembers Your Project — Anthropic Docs](https://docs.anthropic.com/en/docs/claude-code/memory)

## Related
- [Markdown](/concepts/en/markdown.md)
- [Linter](/concepts/en/linter.md)
- [Lifecycle](/concepts/en/lifecycle.md)
