Skip to main content
rule CX Codex

_template — Claude Code rule: structure and installation

_template — a rule-file scaffold with fields for its title and impact, plus sections for contrasting incorrect and correct code.

no license ★ 1,064 updated 2026-01-21

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

What _template does

_template is a file outline, not a ready-made instruction for an agent. It provides space for a title, an impact level, a short rationale, contrasting code samples, and a reference link. Replace the sample labels and code with details from the rule you want to write.

For Claude Code, put the file at .claude/rules/_template.md. Placeholders such as Rule Title Here and example() do not define a specific agent behavior. Write the rule itself before using the scaffold as a project instruction.

What it helps with

  • create an outline for a rule file
  • record a rule’s impact and rationale
  • contrast incorrect and correct code
  • add a reference link to a rule

Example prompts for the agent

  • Draft a Claude Code rule about error handling using _template.
  • Fill in _template with a rule for code formatting and replace its sample content.
  • Create a rule file that compares incorrect and correct code using the _template structure.

How to install _template

Manually: put the files in place

.claude/rules/_template.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 _template

How do I install _template in Claude Code?

Place the file in your project at .claude/rules/_template.md. Then replace the sample title, explanation, and code with the content of your rule.

What does _template do?

It provides a layout for a rule file, including an impact field and sections for contrasting code examples. It does not define a specific agent behavior on its own.

What should I replace in _template?

Replace the sample headings, explanation, code snippets, and reference link with material for your rule. The placeholders do not describe a concrete rule.

Similar IDE rules

All IDE rules for Agent setup: memory, context, orchestration →

From the same set20

The whole set →
js-cache-property-access js-cache-property-access guides Claude Code to store deep object properties and array bounds in local variables before executing JavaScript loops. CX Codex +1 ★ 1,064repo stars js-set-map-lookups The js-set-map-lookups rule recommends using a Set when code repeatedly checks array membership. It applies to repeated lookups, such as filtering items by ID. CX Codex +1 ★ 1,064repo stars rendering-activity rendering-activity — a Claude rule that tells the agent to keep costly React components inside <Activity> so hiding them does not throw away state. CX Codex +1 ★ 1,064repo stars rendering-svg-precision rendering-svg-precision — a rule for Claude Code that reduces SVG coordinate precision to one decimal place. Applies when creating icons or editing graphics. CX Codex +1 ★ 1,064repo stars async-parallel async-parallel — a Claude rule that sends independent async calls through Promise.all() instead of awaiting them one by one. Useful when a handler piles up sequential awaits. CX Codex +1 ★ 1,064repo stars rerender-derived-state The rerender-derived-state rule favors derived boolean state over continuously changing values, reducing React re-renders. It fits responsive UI logic. CX Codex +1 ★ 1,064repo stars js-combine-iterations js-combine-iterations tells the Claude agent to replace several filter or map passes over the same array with one loop that fills the results as it goes. CX Codex +1 ★ 1,064repo stars bundle-dynamic-imports bundle-dynamic-imports guides Claude Code to lazy-load heavy components using next/dynamic with SSR disabled. Keeps your initial client bundle lean to protect TTI and LCP metrics. CX Codex +1 ★ 1,064repo stars

Project sponsors

Companies that keep this analytics open