Add path-scoped rules, mechanical enforcement, and React no-useEffect rule#2
Conversation
Move path-specific guidance (TDD, code quality, testing patterns, TypeScript conventions) from CLAUDE.md templates into dedicated .claude/rules/ files with globs: YAML frontmatter for native Claude Code path-scoping. Rules only load when Claude works on matching files, reducing context bloat. - Add 4 rule templates: tdd.md, code-quality.md, testing.md, typescript.md - Slim global-claude.md from ~308 to ~241 lines (removes ~67 lines) - Slim project-claude.md by removing duplicated quality rules - Add "Adding New Rules" section with enforcement hierarchy guidance - Add "Rule Enforcement Hierarchy" principle to operating principles - Update install-enforcement.js to copy rules/ to target .claude/rules/ - Update SKILL.md to document rules installation for all stacks https://claude.ai/code/session_012hMekSRkdWfhdBKvpQYv7Z
- Add rules/ directory to file tree with glob descriptions - Add Rules step to setup table - Update Two-Tier section to three-layer system (CLAUDE.md + rules/ + docs/) - Add "What Belongs Where" guidance for rules vs CLAUDE.md vs docs/ - Update progressive disclosure to four tiers (1, 1.5, 2, 3) - Expand "Keep in CLAUDE.md" table with rules/ column - Update "Linters over instructions" best practice row https://claude.ai/code/session_012hMekSRkdWfhdBKvpQYv7Z
Add Factory.ai and Akshay Kothari (Notion COO) to the industry best practices section. Modify existing rows rather than duplicating: Factory added to "Linters over instructions", Akshay added to "Mechanical enforcement". One new row for "Grep-ability" (genuinely new concept). Add .claude/rules/ history note documenting v2.0.64 introduction. Save full competitive analysis as reference file with honest gap assessment (what's worth doing vs. what's theater). https://claude.ai/code/session_012hMekSRkdWfhdBKvpQYv7Z
- ESLint: add max-lines-per-function (50), no-console, import/no-default-export - New check-test-colocation.js script blocks commits missing colocated tests - Expand rules/typescript.md with named exports and absolute imports rationale - Update pre-commit hook (now 6 checks), install script, README, and tests https://claude.ai/code/session_012hMekSRkdWfhdBKvpQYv7Z
His complaint — agents bloat abstractions, copy-paste code, and ignore style guidance in AGENTS.md — is the real-world case for why mechanical enforcement matters more than advisory prose. Added to source bullet and "Linters over instructions" row. https://claude.ai/code/session_012hMekSRkdWfhdBKvpQYv7Z
Stronger hook: the person who coined "context engineering" admits agents ignore his instructions. The answer isn't better prose — it's mechanical enforcement. https://claude.ai/code/session_012hMekSRkdWfhdBKvpQYv7Z
…extjs Bans direct useEffect in favor of five replacement patterns (derived state, data-fetching libraries, event handlers, useMountEffect, key props). install-enforcement.js now accepts --framework flag and only copies react.md for React-based frameworks. Inspired by: https://gist.github.com/alvinsng/5dd68c6ece355dbdbd65340ec2927b1d https://claude.ai/code/session_012hMekSRkdWfhdBKvpQYv7Z
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (15)
📝 WalkthroughWalkthroughThis PR introduces a path-scoped rules system within Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Extracts path-scoped rules, adds mechanical enforcement from competitive analysis, and improves README framing.
Path-scoped rules extraction
global-claude.mdandproject-claude.mdinto dedicated.claude/rules/files:tdd.md,code-quality.md,testing.md,typescript.mdglobs:frontmatter for automatic activation by file patternMechanical enforcement improvements (from Factory.ai analysis)
check-test-colocation.js— blocks commits whensrc/files lack matching test filesmax-lines-per-functionandno-consoleto ESLint base configcompetitive-analysis.mdreference docReact no-useEffect rule
templates/rules/react.md— bans directuseEffect, teaches 5 replacement patternsinstall-enforcement.jsnow accepts--frameworkflag, only installsreact.mdforvite/nextjsSKILL.mdPhase 4 updated to pass--frameworkthroughREADME updates
check-test-colocation.jsto customization tableTest plan
/setupwith--framework=vite— verify all 5 rule files includingreact.mdare copied/setupwith--framework=express— verifyreact.mdis not copiedmax-lines-per-functionandno-consoletests/scripts/install-enforcement.test.jsstill passesSummary by CodeRabbit
New Features
Documentation