|
| 1 | +# Claude Code Agent Guidelines |
| 2 | + |
| 3 | +This document provides guidance for you as the Claude Code agent on how to work with this project's context rules system. |
| 4 | + |
| 5 | +## Rule Location and Structure |
| 6 | + |
| 7 | +This project uses **Cursor's Context Rules** system located in `.cursor/rules/`. **ALWAYS** read and load the content of relevant rules from this directory into context when working on the codebase. |
| 8 | + |
| 9 | +### Discovering Available Rules |
| 10 | + |
| 11 | +Read all files in the `.cursor/rules/` directory to discover what rules are available. Each rule file uses the `.mdc` extension (Markdown with frontmatter). |
| 12 | + |
| 13 | +## Rule File Format |
| 14 | + |
| 15 | +Each rule file uses **Markdown with YAML frontmatter**: |
| 16 | + |
| 17 | +```markdown |
| 18 | +--- |
| 19 | +description: Brief description of what this rule covers |
| 20 | +globs: file,patterns,**/*,that,trigger,this,rule |
| 21 | +alwaysApply: false |
| 22 | +--- |
| 23 | + |
| 24 | +# Rule Title |
| 25 | + |
| 26 | +Content of the rule in Markdown format... |
| 27 | +``` |
| 28 | + |
| 29 | +### Frontmatter Properties |
| 30 | + |
| 31 | +- **`description`**: A concise explanation of what the rule covers |
| 32 | +- **`globs`**: Comma-separated file patterns that trigger this rule (uses glob syntax) |
| 33 | +- **`alwaysApply`**: Boolean indicating if you should always apply this rule regardless of file context |
| 34 | + |
| 35 | +## Using Rules as Claude Code |
| 36 | + |
| 37 | +### Mandatory Rule Loading |
| 38 | + |
| 39 | +You **MUST**: |
| 40 | + |
| 41 | +1. Read all rule files in `.cursor/rules/` to understand available rules |
| 42 | +2. Load and follow the patterns and conventions defined in applicable rules |
| 43 | +3. Apply all rules that have `alwaysApply: true` to every operation |
| 44 | +4. Load context-specific rules based on the files you're modifying (matching globs) |
| 45 | + |
| 46 | +### When to Load Rules |
| 47 | + |
| 48 | +Load rules in these scenarios: |
| 49 | + |
| 50 | +- **File modifications**: Check globs in rule frontmatter to determine which rules apply to the files being changed |
| 51 | +- **New feature development**: Load relevant domain-specific rules based on file patterns and descriptions |
| 52 | +- **Code reviews**: Apply project standards and patterns from applicable rules |
| 53 | +- **Planning tasks**: Consult rules for architectural guidance and best practices |
| 54 | + |
| 55 | +### Rule Selection Strategy |
| 56 | + |
| 57 | +1. **Always apply** rules with `alwaysApply: true` |
| 58 | +2. **Match file patterns** - load rules whose globs match the files you're working with |
| 59 | +3. **Domain context** - load language/technology-specific rules based on descriptions and file patterns |
| 60 | +4. **Multiple rules** - load and apply multiple rules simultaneously when they apply to your current task |
| 61 | + |
| 62 | +### Reading Rules Into Context |
| 63 | + |
| 64 | +Access the `.cursor/rules/` directory and read rule file contents. Parse the frontmatter to determine: |
| 65 | + |
| 66 | +- Whether the rule applies to your current task (`alwaysApply` or matching `globs`) |
| 67 | +- What the rule covers based on the `description` |
| 68 | +- Which files trigger the rule based on `globs` patterns |
| 69 | + |
| 70 | +## Important Notes |
| 71 | + |
| 72 | +- **Do NOT duplicate rule content** in your responses - reference and follow the rules instead |
| 73 | +- **Always check all rules** - examine the directory contents to ensure you don't miss any rules |
| 74 | +- **Follow rule hierarchies** - general project rules combined with specific technology rules |
| 75 | +- **Use rules for consistency** - ensure all code changes align with established patterns |
| 76 | +- **Parse frontmatter carefully** - use the metadata to determine rule applicability |
| 77 | + |
| 78 | +Treat these rules as **mandatory guidance** that you must follow for all code changes and development activities within this project. |
0 commit comments