index — Claude Code rule: purpose and installation
The index Claude Code rule describes the built-in code review files and how the tool locates them. A project rule pack replaces the built-in pack instead of merging with it.
MIT ★ 517 updated 2026-11-16
.claude/rules/index.mdWhat index does
index lists the built-in rule files, including checks for Java, concurrency, security, Spring, and testing. Some files contain prose guidance; baseline-java.md has nine baseline rules for machine-checkable and semantic review.
The search order is $CODE_REVIEW_RULES_DIR, the project’s .code-review/rules/ directory, then the built-in references/rules/ folder. A project pack replaces the built-in pack in full. The bash "$CODE_REVIEW_SKILL_DIR/scripts/rule-grep" script follows the same order and runs regexes from Detection pattern lines. It requires bash and the CODE_REVIEW_SKILL_DIR variable.
Each rule uses a heading with an ID and a severity of HIGH, MEDIUM, or LOW. A finding without a rule ID does not count as evidence. Custom regexes should stay narrow to limit false positives.
What it helps with
- identify the files in the built-in rule pack
- set the search priority for rule directories
- write checks with a rule ID and severity
- scan code with regex patterns from rules
Example prompts for the agent
- Review this Java code against the rules listed in
index. - Scan the project with the rule regex patterns and include the ID for each finding.
How to install index
Manually: put the files in place
.claude/rules/index.mdThe paths frontmatter field limits the files
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.cursor/rules/index.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.github/instructions/index.instructions.mdThe applyTo field sets which files it applies to
Manually: put the files in place
.devin/rules/index.mdManually: put the files in place
.clinerules/index.mdStep by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use
Questions about index
How do I install index in Claude Code?
Place the file at .claude/rules/index.md.
What does index do?
It lists the built-in rule files and explains their lookup order. It also describes the rule format and regex scanning.
What does the index regex scan require?
It requires bash and the CODE_REVIEW_SKILL_DIR variable, which points to the skill directory. The script is $CODE_REVIEW_SKILL_DIR/scripts/rule-grep.
Source text
index.md · MIT
# Rule pack This index lists the built-in rule files and their purposes; see the [repo-guard probe](../probes/repo-guard.md) for the loading and checking flow. ## Location priority 1. `$CODE_REVIEW_RULES_DIR` 2. Project root `.code-review/rules/` 3. Skill built-in: `references/rules/` A project-provided rule pack replaces the built-in pack entirely (it is not merged). `bash "$CODE_REVIEW_SKILL_DIR/scripts/rule-grep"` uses the same priority order. ## Built-in files | File | Type | Content | |---|---|---| | `baseline-java.md` | Machine-checkable / semantic check | 9 baseline rules | | `concurrency.md` | Prose | Thread pools, SimpleDateFormat, lock ordering | | `exception-logging.md` | Prose | Exception catching, transaction rollback, logging | | `naming-format.md` | Prose | Naming and formatting | | `oop-collection.md` | Prose | Immutability, defensive programming, collections | | `spring-performance.md` | Prose | Spring / JPA / transactions / performance | | `testing-engineering.md` | Prose | Unit-test conventions | | `security.md` | Prose | Security baseline | ## Rule file format Each rule has one heading, followed by an optional `Detection pattern` line: ```markdown ### SEC-001 [HIGH] SQL string concatenation Why this rule matters. **Detection pattern** (any hit is a violation): - `regex-one` - `regex-two` ``` - The heading must be `### <rule-id> [<severity>] <title>`; the severity is one of `HIGH` / `MEDIUM` / `LOW` - Backtick fragments in `Detection pattern` are extracted by `bash "$CODE_REVIEW_SKILL_DIR/scripts/rule-grep"` and run as regexes - Rules without a detection pattern do not participate in regex scanning - **The rule ID is the finding's evidence**; a judgment without an ID does not count - Legacy localized rule packs may use their own detection-marker label; `rule-grep` accepts the supported aliases ## Constraints - Only write your team's own rules; do not copy internal standards of unknown origin - Keep regexes as narrow as possible; prefer missing a hit over producing many false positives
© kyy-logs · MIT · kyy-logs/code-review-gate-skill