/rcc:writing-rulesfrom rcc
Creates path-scoped convention rules in .claude/rules/ that auto-inject into matching contexts. Use when adding project conventions or scoping guidelines.
Ships in rcc. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Writing rules IS creating focused, path-scoped conventions that load only when they are relevant.
paths: is a real load gate. Per the official spec: "Rules without a paths field are loaded unconditionally and apply to all files. Path-scoped rules trigger when Claude reads files matching the pattern, not on every tool use." Rules without paths: load at launch with the same priority as .claude/CLAUDE.md; rules with paths: cost nothing until Claude touches a matching file.
Core principle: Rules = small, focused conventions, scoped with paths: so they stay out of context until needed. CLAUDE.md = top-level project identity, build commands, gotchas — always resident, so keep it under 200 lines. Hard rules that must never be bypassed = hooks (instruction compliance is ~70%, not 100%).
Follow task initialization protocol.
Tasks: 0. Fetch latest official rule/skill spec
Announce: "Created 7 tasks (0–6). Starting execution..."
| Phase | Focus | What You Do |
|---|---|---|
| Analysis | Understanding | Identify what convention needs enforcement |
| Scope Definition | Targeting | Determine which files need this convention |
| Design | Planning | Structure rule content and path patterns |
| Implementation | Creation | Write clear, specific configuration rules |
| Optimization | Refinement | Streamline scope and improve clarity |
Goal: Pull the current Anthropic spec for path-scoped rules / skill frontmatter before designing — never trust cached memory.
Action:
Skill tool: fetching-claude-docs
component: memory
question: "CLAUDE.md auto-loading behavior, .claude/rules/ directory loading,
nested CLAUDE.md per directory, @ import syntax, token cost"
Verification: Received YAML with non-empty spec_excerpt. Use as authoritative reference. If the fetched spec contradicts anything in this SKILL, the fetched spec wins — record the contradiction so this SKILL can be corrected.
Goal: Understand what convention to encode and where it applies.
Questions to answer, in order:
Verification: Can state the convention in one sentence, name the file glob it applies to (or justify why it is genuinely cross-cutting), and confirm it isn't a hard rule (which would belong in a hook).
Goal: Work on matching files WITHOUT the rule. Note where convention is forgotten.
Process:
Verification: Documented at least 1 instance where convention was not followed.
Goal: Create rule file addressing the gaps you documented.
~/.claude/rules/ # User-level (applies to every project)
.claude/rules/ # Project-level (this project only)
├── code-style.md # Unscoped (no paths:) — loads at launch, every session
├── api/
│ └── conventions.md # paths: ["src/api/**"] ← loads only on matching files
└── testing/
└── guidelines.md # paths: ["**/*.test.ts"]
All .md files are discovered recursively, so subdirectories are just organization.
---
paths: # Omit only for genuinely cross-cutting rules
- "src/api/**/*.ts"
---
# Rule Title
- Constraint 1 (imperative: "MUST", "NEVER")
- Constraint 2
paths: — loaded at launch, every session, same priority as .claude/CLAUDE.md. Costs tokens in every conversation.paths: — loaded when Claude reads a file matching the glob, not on every tool use. Costs nothing until then. This is the reason to scope aggressively.~/.claude/rules/ loads before project rules, giving project rules higher priority.Key constraints:
paths: — this genuinely gates loading. Omit it only when the rule really applies to all work.See references/examples.md for good/bad rule examples by domain.
Content validation checks:
| Check | Fail condition | Action |
|---|---|---|
| Line count | > 50 lines | Must simplify or split |
| Procedural content | Contains numbered steps, multi-line code blocks | Extract to skill, rule keeps principle only |
| paths missing | Content targets specific file types but no paths: | Add it — this is free context savings, not just documentation |
| paths too broad | paths: "**/*" or similar | Equivalent to unscoped but lazier; either narrow it or drop paths: entirely |
| Hard rule | Says "MUST NEVER" about destructive/irreversible action | Move to hook (deterministic enforcement); a rule alone is ~70% reliable |
| Load budget | Adding this rule pushes CLAUDE.md + all unscoped rules > 200 lines | Warn, simplify, merge, or scope with paths: |
Verification:
paths: scoping it (or a stated reason why it is genuinely cross-cutting)Goal: Verify rule file structure is correct.
Checklist:
.claude/rules/ (nested subdirectories are fine — discovery is recursive)paths: glob (or none, deliberately, for a cross-cutting rule)Verification: All checklist items pass.
Goal: Have rule reviewed by rule-reviewer subagent.
Agent tool:
- subagent_type: "rcc:rule-reviewer"
- prompt: "Review rule at [path]"
Interpret YAML output:
pass: true → Proceed to Task 6pass: false → Fix all issues listed, re-run reviewer, repeat until pass: trueVerification: rule-reviewer returns YAML with pass: true.
Goal: Verify rule actually activates on matching files.
Process:
paths: patternVerification:
These thoughts mean you're rationalizing. STOP and reconsider:
All of these mean: You're about to create a weak rule. Follow the process.
| Excuse | Reality |
|---|---|
| "CLAUDE.md is overkill" | If it applies broadly to all work, it belongs in CLAUDE.md. |
| "Unscoped rules are fine" | Unscoped = loaded at launch in every session, forever. Add paths:. |
| "50 lines is arbitrary" | Long rules dilute adherence, and unscoped ones bill every session. |
| "I can add procedures here" | Rules = what. Skills = how. Keep them separate. |
| "One comprehensive rule" | Multiple focused rules > one bloated rule. |
paths: scope tagsWhat SKILL.md sets; muted values are Claude Code's defaults
23 skills in this plugin
/advising-architectureValidates component-type choices for agent system work, classifying knowledge as CLAUDE.md vs rule vs skill vs agent vs hook and checking for conflicts. Use when starting any skill/agent/rule workflow to validate approach. Use when classifying knowledge type. Use when checking for component conflicts./analyzing-agent-systemsScans project structure and agent system components, runs 11-category weakness analysis, and produces actionable restructuring recommendations. Use when analyzing an existing agent system for weaknesses. Use when user says "analyze agent system", "check agent setup", "audit agent config". Use when called by migrating-agent-systems or refactoring-skills./npx claudepluginhub wayne930242/reflexive-claude-code --plugin rccOther plugins' skills for the same job