write-rules

Generate modular .claude/rules files for global or path-scoped conventions.

16|5|Updated Dec 3, 2025
One-click install
npx skills add https://github.com/wayne930242/Reflexive-Claude-Code --skill write-rules
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: write-rules
Source: https://github.com/wayne930242/Reflexive-Claude-Code/tree/main/skills/write-rules
Command: npx skills add https://github.com/wayne930242/Reflexive-Claude-Code --skill write-rules

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill creates modular rule files for conventions and guidelines under .claude/rules, enabling consistent policy enforcement across projects. Use for path-specific coding conventions or shared project guidelines.

Core Features & Use Cases

  • Global vs Path-Scoped Rules: Global rules apply to all contexts; path-scoped rules target specific files.
  • Structured Format: Encourages concise, imperative conventions with minimal boilerplate.
  • Validation Guidance: Helps ensure rules are not duplicated and are easy to audit.

Quick Start

Create a global rule at .claude/rules/code-style.md or a path-scoped convention under a targeted path like src/api/**/*.ts.

Frequently Asked Questions about write-rules

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I define coding conventions for my project using YAML rules?▼

Create modular .claude/rules files in YAML or Markdown format to codify project conventions. Rules apply globally or to specific file paths using patterns like src/api/**, enforcing consistent guidelines across your codebase without procedural overhead.

Can I scope rules to specific file paths instead of applying them globally?▼

Yes. Path-scoped rules target specific files or directories using path patterns. Define separate rules under .claude/rules for different contexts—for example, src/api/**, tests, or workflows—each enforcing targeted coding conventions for that scope.

What's the best way to organize project guidelines so they auto-inject into Claude Code context?▼

Structure concise, imperative rules under .claude/rules as YAML or Markdown files, keeping each under 50 lines. Claude Code automatically loads these rules into context, applying global or path-specific conventions without manual configuration.

How do I avoid duplicating conventions across multiple rule files?▼

Audit your .claude/rules directory to ensure each file addresses a distinct scope or concern. Use global rules for shared standards and path-scoped rules only for file-specific conventions, minimizing overlap and maintenance burden.

What are the constraints when writing rules for Claude Code?▼

Rules must stay under 50 lines, avoid procedural content, and use YAML or Markdown format. Define either global scope (all contexts) or path-scoped scope (specific files); this structure ensures rules remain auditable and easy to maintain.