Home

Rules

Path-scoped wards that activate on file touch.

CurrentReviewed 2026-03-31

Overview

Rules are path-scoped markdown files in .claude/rules/ that automatically activate when Claude touches matching files. Unlike CLAUDE.md which loads globally, rules are contextual — the tailwind rule fires only when editing CSS, the prisma rule fires only when touching schema files. This keeps context lean and instructions relevant.

Current Progress

  • 8 rules active: tailwind, prisma, auth, i18n, testing, deployment, cowork-bridge, org-refs
  • Path-scoped activation working for all file types
  • User-level rules in ~/.claude/rules/ for cross-project

Areas of Improvement

  • Missing rules for: Stripe webhooks, email templates, API routes
  • Rules don't have versioning — no way to track rule drift across repos
  • Could add rule for Playwright test patterns

References

Setup

  1. Create .claude/rules/ directory in your repo
  2. Add markdown files with frontmatter specifying file globs
  3. Rules auto-activate when matching files are touched
  4. Use user rules at ~/.claude/rules/ for personal cross-project rules

Usage

  • tailwind.md — CSS-first config, OKLCH colors, RTL logical properties
  • prisma.md — Schema conventions, migration workflow, query patterns
  • auth.md — Auth.js v5 patterns, session handling, JWT config
  • i18n.md — Arabic/English dictionaries, RTL/LTR layout rules
  • testing.md — Vitest config, Playwright patterns, coverage thresholds

Config Files

.claude/rules/*.md
~/.claude/rules/*.md