Agent skill

Creating Claude Rules Files

by pr-pm in pr-pm/prpm

Shows how to write .claude/rules/ files correctly: paths frontmatter instead of globs, quoted glob patterns, global rules and conversion of Cursor rules.

MITAuto-check passedAgent Workflows

Install Creating Claude Rules Files

skills CLI
$ npx skills add pr-pm/prpm --skill creating-claude-rules -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install pr-pm/prpm creating-claude-rules --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/pr-pm/prpm.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/creating-claude-rules .claude/skills/creating-claude-rules && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
creating-claude-rules
GitHub stars
122
Used in
2 other repos
Token cost
~551 tokens
SKILL.md length
128 words
Files
1
Skills in repo
35
Repo updated
First seen
Licence
MIT

At a glance

Shows how to write .claude/rules/ files correctly: paths frontmatter instead of globs, quoted glob patterns, global rules and conversion of Cursor rules.

  • Creating new rules in a project's .claude/rules/ folder
  • SKILL.md covers Overview, When to Use, Quick Reference and Frontmatter, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Fixing rule files that use globs where Claude expects paths

What it does

Files in .claude/rules/ are modular instructions tied to particular files through glob patterns, and they load automatically with the same priority as CLAUDE.md. This skill is a quick reference for writing them properly, built around a comparison table of the Claude and Cursor formats.

Claude rules use a paths field in the frontmatter, as a list or a single pattern, where Cursor uses globs. A rule that should always apply simply leaves out paths, or leaves out the frontmatter entirely, instead of using Cursor's alwaysApply flag. The skill shows the common mistakes, including unquoted patterns, tabulates glob patterns such as **/*.ts and {src,lib}/**/*.ts, notes that files are found recursively so subdirectories can organize them, and links to the Claude Code documentation.

When your agent uses it

  • Creating new rules in a project's .claude/rules/ folder
  • Fixing rule files that use globs where Claude expects paths
  • Migrating Cursor rules to the Claude format
  • Organizing project-specific conventions into scoped rule files

Example prompts

  • “Create a rule in .claude/rules that applies only to files under src/api.”
  • “My rules file uses globs and alwaysApply, so convert it to the Claude format.”
  • “Migrate our Cursor rules into .claude/rules.”
  • “Split our TypeScript conventions into one global rule and one rule for test files.”

What it can do on your machine

Read from SKILL.md and the folder at commit 5f993e6. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are yaml and markdown).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • code.claude.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Creating Claude Rules Files loads about 551 tokens when it runs. Until then it costs about 47 tokens; SKILL.md has 128 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~47
When it runs · the whole SKILL.md, loaded when a task matches
~551

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from pr-pm/prpm at commit 5f993e6, republished under its MIT licence (© pr-pm). 128 words, ~551 tokens.

Download SKILL.mdSave it as .claude/skills/creating-claude-rules/SKILL.md (or your agent's skills folder).
name
creating-claude-rules
description
Use when creating or fixing .claude/rules/ files - provides correct paths frontmatter (not globs), glob patterns, and avoids Cursor-specific fields like alwaysApply

Creating Claude Rules

Overview

Rules in .claude/rules/ are modular instructions scoped to specific files via glob patterns. They load automatically with same priority as CLAUDE.md.

When to Use

  • Creating new rules in .claude/rules/
  • Fixing rules that use wrong frontmatter (globs instead of paths)
  • Migrating Cursor rules to Claude format
  • Organizing project-specific conventions

Quick Reference

FieldClaudeCursor
Path patternspathsglobs
Always applyOmit pathsalwaysApply: true
DescriptionNot documenteddescription

Frontmatter

Path-Scoped Rules
yaml
---
paths:
  - "src/api/**/*.ts"
  - "tests/**/*.test.ts"
---

Or single pattern:

yaml
---
paths: src/**/*.{ts,tsx}
---
Global Rules

Omit frontmatter entirely - applies to all files:

markdown
# TypeScript Conventions

Use .js extensions in imports.

Common Mistakes

yaml
# ❌ WRONG - globs is Cursor format
---
globs:
  - "**/*.ts"
---

# ✅ CORRECT - Claude uses paths
---
paths:
  - "**/*.ts"
---
yaml
# ❌ WRONG - alwaysApply is Cursor-only
---
alwaysApply: true
---

# ✅ CORRECT - just omit paths for global rules
# (no frontmatter needed)
yaml
# ❌ WRONG - unquoted patterns
---
paths:
  - **/*.ts
---

# ✅ CORRECT - quote glob patterns
---
paths:
  - "**/*.ts"
---

Directory Structure

.claude/rules/
├── testing.md          # Path-scoped or global
├── typescript.md
└── frontend/           # Subdirectories supported
    └── react.md

Files discovered recursively. Use subdirectories to organize.

Glob Patterns

PatternMatches
**/*.tsAll .ts files anywhere
src/**/*Everything under src/
*.mdMarkdown in root only
**/*.{ts,tsx}.ts and .tsx files
{src,lib}/**/*.ts.ts in src/ or lib/

Reference

https://code.claude.com/docs/en/memory#modular-rules-with-claude/rules/

© pr-pm, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/creating-claude-rules of pr-pm/prpm.

Open the folder on GitHubat commit 5f993e6

Used in 2 other repositories

We found 2 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 2 other GitHub owners. This page covers the copy in pr-pm/prpm, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Creating Claude Rules Files next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Creating Claude Rules Files compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Creating Claude Rules Files this skillpr-pm/prpm1222 repos~551Automated safety check: PassMIT
Using Agent Skillsaddyosmani/agent-skills103k4 repos~2.4kAutomated safety check: PassMIT
Claude ReflectBayramAnnakov/claude-reflect1.7k2 repos~627Automated safety check: PassMIT
Writing For Agentsbestofjs/bestofjs3.1k19 repos~2.7kAutomated safety check: PassMIT
Neat-Freak Knowledge CloseoutKKKKhazix/khazix-skills21k—~1.9kAutomated safety check: PassMIT
Task Observerrebelytics/one-skill-to-rule-them-all3.2k1 repos~12kAutomated safety check: PassCC-BY-4.0

Similar skills

  • Using Agent Skills

    addyosmani/agent-skills

    Meta-skill for choosing which workflow skill fits the task at hand, plus always-on habits: surface assumptions, stop on confusion, push back, keep it simple and stay in scope.

    103k GitHub starsUsed in 4 repos~2.4k tokens
    Agent WorkflowsAuto-check passed
  • Claude Reflect

    BayramAnnakov/claude-reflect

    Self-learning system that captures corrections during sessions and reminds users to run /reflect to update CLAUDE.md.

    1.7k GitHub starsUsed in 2 repos~627 tokens
    Agent WorkflowsAuto-check passed
  • Writing For Agents

    bestofjs/bestofjs

    Writing documents for agents. An agent skill from bestofjs/bestofjs.

    3.1k GitHub starsUsed in 19 repos~2.7k tokens
    Agent WorkflowsAuto-check passed
  • Neat-Freak Knowledge Closeout

    KKKKhazix/khazix-skills

    Brings project docs, agent rule files, authorized memory and leftover workspace files back in line with what the code and runtime actually do at the end of a work session.

    21k GitHub stars~1.9k tokensUpdated 6 days ago
    Agent WorkflowsAuto-check passed
  • Task Observer

    rebelytics/one-skill-to-rule-them-all

    Monitors task execution for skill improvement opportunities.

    3.2k GitHub starsUsed in 1 repo~12k tokens
    Agent WorkflowsAuto-check passed
  • SkillOpt Sleep Cycle

    microsoft/SkillOpt

    Official

    Runs an on-demand or nightly sleep cycle that reviews past Claude Code sessions and proposes validated updates to CLAUDE.md and skills.

    18k GitHub stars~2.3k tokensUpdated yesterday
    Agent WorkflowsAuto-check passed

More from pr-pm/prpm

All 35 skills in this repo
  • Reference for writing Claude Code agent files: location, frontmatter fields, validation limits, tool and model choices, and the required content format.

    122 GitHub starsUsed in 3 repos~4k tokens
    Auto-check passed
  • Covers how to build, configure and publish Claude Code hooks: event types, exit codes, JSON I/O, and PRPM packaging.

    122 GitHub starsUsed in 2 repos~3.9k tokens
    Auto-check: notes
  • Reference for writing portable Agent Skills packages, covering SKILL.md frontmatter limits, name rules, directory layout and where Codex CLI, GitHub Copilot and Amp look for skills.

    122 GitHub starsUsed in 1 repo~1.5k tokens
    Auto-check passed
  • A skill your agent uses when building custom Kiro AI agents or when user asks for agent configurations - provides JSON structure, tool configuration, prompt patterns, and security best practices for…

    122 GitHub starsUsed in 1 repo~1.9k tokens
    Auto-check passed
  • A skill your agent uses when creating OpenCode agents - provides markdown format with YAML frontmatter, mode/tools/permission configuration, and best practices for specialized AI assistants

    122 GitHub starsUsed in 1 repo~2k tokens
    Auto-check passed
  • A skill your agent uses when implementing Stripe webhook endpoints and getting 'Raw body not available' or signature verification errors - provides raw body parsing solutions and subscription period…

    122 GitHub starsUsed in 1 repo~1.8k tokens
    Auto-check passed

Categories

Questions about Creating Claude Rules Files

What does Creating Claude Rules Files do?

Shows how to write .claude/rules/ files correctly: paths frontmatter instead of globs, quoted glob patterns, global rules and conversion of Cursor rules. md. This skill is a quick reference for writing them properly, built around a comparison table of the Claude and Cursor formats.

When should I use Creating Claude Rules Files?

Creating Claude Rules Files fits situations like: creating new rules in a project's .claude/rules/ folder; fixing rule files that use globs where Claude expects paths; migrating Cursor rules to the Claude format; organizing project-specific conventions into scoped rule files.

How do I install Creating Claude Rules Files in Claude Code?

Run `npx skills add pr-pm/prpm --skill creating-claude-rules -a claude-code`. Or copy the skill folder (.claude/skills/creating-claude-rules in pr-pm/prpm) into .claude/skills/creating-claude-rules in your project. Claude Code loads it when a task matches its description.

How do I install Creating Claude Rules Files in Codex?

Run `npx skills add pr-pm/prpm --skill creating-claude-rules -a codex`. Or copy the skill folder (.claude/skills/creating-claude-rules in pr-pm/prpm) into .agents/skills/creating-claude-rules in your project. Codex loads it when a task matches its description.

Can I use Creating Claude Rules Files in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add pr-pm/prpm --skill creating-claude-rules -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/creating-claude-rules, .gemini/skills/creating-claude-rules, .github/skills/creating-claude-rules and .opencode/skills/creating-claude-rules in your project.

What does Creating Claude Rules Files need to run?

SKILL.md names no scripts, command-line tools or credentials: Creating Claude Rules Files is instructions for the agent only.

Does Creating Claude Rules Files access the network?

SKILL.md names 1 domain. As links in the text: code.claude.com. This is read from the text; nothing was executed.

Is Creating Claude Rules Files safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Creating Claude Rules Files use?

Creating Claude Rules Files is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Creating Claude Rules Files use?

About 551 tokens (SKILL.md is roughly 2.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Creating Claude Rules Files?

Skills that share tags, products or a category with Creating Claude Rules Files: Using Agent Skills (addyosmani/agent-skills, 103k stars), Claude Reflect (BayramAnnakov/claude-reflect, 1.7k stars), Writing For Agents (bestofjs/bestofjs, 3.1k stars) and Neat-Freak Knowledge Closeout (KKKKhazix/khazix-skills, 21k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Creating Claude Rules Files?

pr-pm (a GitHub organization) maintains it in pr-pm/prpm, which has 122 GitHub stars. The repository holds 35 skills in this directory. The repository was last updated on October 6, 2026.

Source: pr-pm/prpm on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.