Skip to main content
rule CX Codex

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

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/rules/index.md
Open on GitHub

What 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.md

The paths frontmatter field limits the files

Step 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

Similar IDE rules

All IDE rules for Code review and refactoring →

From the same set10

The whole set →
baseline-java The baseline-java Claude Code rule adds Java checks for security, concurrency, and exception handling. It applies during Java code review. CX Codex +1 ★ 517repo stars spring-performance spring-performance is a Claude Code rule for Spring/JPA practices and performance tuning. It guides agents working on Java code, database queries, and server settings. CX Codex +1 ★ 517repo stars spring-performance The spring-performance Claude Code rule sets Spring/JPA and performance checks. It flags issues in validation, transactions, queries, and batch operations. CX Codex +1 ★ 517repo stars concurrency This Claude Code rule sets Java concurrency guidelines. It covers thread pools, locks, shared records, and other sources of concurrent access bugs. CX Codex +1 ★ 517repo stars exception-logging exception-logging — a rule for Claude Code that enforces Java exception handling and logging standards. Runs during code review to catch empty catch blocks, unmasked data, and missing transaction rollbacks. CX Codex +1 ★ 517repo stars naming-format The naming-format Claude Code rule sets Java naming and formatting conventions. It covers classes, methods, constants, and control flow. CX Codex +1 ★ 517repo stars testing-engineering The testing-engineering Claude Code rule sets expectations for unit tests, project structure, and dependencies. It covers application layers, exception handling, and domain models. CX Codex +1 ★ 517repo stars code-review-gate The code-review-gate Claude Code skill reviews code changes before a commit or PR merge. It gathers the diff, checks test quality, and records issues. CX Codex +1 ★ 517repo stars

Project sponsors

Companies that keep this analytics open