Glosario de Claude Code

.claude/rules/

The .claude/rules/ directory holds project-specific instructions, splitting CLAUDE.md into smaller topic files.

También llamado: claude rules, path-specific rules, project rules, paths frontmatter

The .claude/rules/ directory is a location for organizing project-specific instructions into multiple markdown files, rather than a single large CLAUDE.md. Each file within this directory represents a distinct topic, such as testing.md or api-design.md. These files are discovered recursively, allowing for further organization into subdirectories.

Rules placed in .claude/rules/ without a paths frontmatter field are loaded by default at the start of a session, similar to the main CLAUDE.md file. However, rules that include a paths field are considered path-scoped. These path-scoped rules are only loaded when Claude is actively working with files that match the specified glob patterns, for example, src/**/*.{ts,tsx}. This mechanism helps manage the context window by loading relevant instructions only when needed, improving efficiency. Path-scoped rules are triggered when Claude reads files matching the pattern, not necessarily on every tool use.

Personal rules can be placed in ~/.claude/rules/. These global rules apply to all projects and are loaded before project-specific rules, effectively giving project rules higher precedence. The system supports symlinks, enabling the use of a shared set of rules across multiple projects by linking them into each project's .claude/rules/ directory.

It's important to distinguish between these rules and skills. Rules are loaded into the context either at the start of a session or when matching files are opened. For instructions that are task-specific and do not require constant presence in the context, a skill is the more appropriate mechanism. Similar to rules, SKILL.md files also have a paths field in their frontmatter, which controls when a skill automatically activates based on file matching.

← Todos los términos del glosario