create-rule

Create valid Claude Code rule files with YAML frontmatter and path scoping.

9|Updated Mar 22, 2026
One-click install
npx skills add https://github.com/paultyng/skill-issue --skill create-rule-paultyng
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-rule
Source: https://github.com/paultyng/skill-issue/tree/main/skills/create-rule
Command: npx skills add https://github.com/paultyng/skill-issue --skill create-rule-paultyng

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill eliminates the frustration of writing ineffective Claude Code rule files that are too vague, incorrectly scoped, or conflict with existing rules, which leads to inconsistent AI behavior and wasted context window space across your projects.

Core Features & Use Cases

  • Rule Format & Structure Guidance: Provides the exact YAML frontmatter and markdown structure for valid rule files, including optional path scoping for file-type, test file, or domain-specific rules.
  • Scoping Decision Support: Helps you choose between universal always-load rules for global behaviors and path-scoped rules for language-specific or directory-specific instructions, avoiding unnecessary context bloat.
  • Anti-Pattern Avoidance: Flags common mistakes like vague wording, duplicate rules, contradictions, and over-specification, with clear good/bad examples to ensure your rules are actionable and effective.
  • Use Case Example: If you want to enforce 2-space indentation for all TypeScript files and require Conventional Commits for all git operations, this Skill guides you to create two separate, correctly scoped rule files that work as expected without conflicts.

Quick Start

Ask the AI to create a new path-scoped rule for Go files that requires passing context.Context as the first parameter on all I/O functions, and it will generate a valid, properly formatted rule file ready to save to your project's .claude/rules/ directory.

Frequently Asked Questions about create-rule

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

FAQPage Schema
How do I create Claude Code rules that enforce coding standards without conflicts?

To create Claude Code rules, generate valid YAML frontmatter and markdown files with proper path scoping. This ensures your coding standards are enforced consistently without vague instructions or context window bloat.

How do I scope Claude Code rules for specific file types and test files?

Scope Claude Code rules by applying path glob patterns within the rule file's YAML frontmatter. This targets specific file types, test files, or domain directories, preventing unnecessary context bloat from universal always-load rules.

What is the maximum length for a Claude Code rule file?

The maximum length for a Claude Code rule file is 200 lines. Adhering to this limit ensures your path-scoped rules remain concise, actionable, and do not waste context window space.

Why are my Claude Code rule files causing inconsistent AI behavior?

Claude Code rule files cause inconsistent AI behavior when they contain vague wording, duplicate rules, or contradictions. Avoid these anti-patterns by using clear, path-scoped instructions with correct format compliance.

Where should I store shared project rules versus personal global rules in Claude Code?

Store shared project-specific Claude Code rules in the .claude/rules/ directory, and personal all-project rules in ~/.claude/rules/. This separates universal always-load rules from project-scoped instructions.

Can I use path-scoped rules to enforce Conventional Commits for git operations?

Yes, you can create separate, correctly scoped Claude Code rule files to enforce Conventional Commits for git operations and other specific workflows, ensuring they work as expected without conflicts.