Skip to content
Skills Library
AI & agents · Writing

rules-authoring

/rules-authoring

Guide to writing .claude/rules/*.md files — auto-applied constraints scoped by file patterns. Use when creating or updating rules for code conventions, quality standards, or file-specific guidance.

Repository
crouton-kit ↗
Licence
GPL-3.0
Last repository change
02.10.2026

Assessment and security

95/ 100Class: good
Format20 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 02.10.2026, without references to retired models or APIs.

Licence

GPL-3.0, otwarta.

What it does and when to use it

Guide to writing .claude/rules/*.md files — auto-applied constraints scoped by file patterns. Use when creating or updating rules for code conventions, quality standards, or file-specific guidance.

Original author description

Guide to writing .claude/rules/*.md files — auto-applied constraints scoped by file patterns. Use when creating or updating rules for code conventions, quality standards, or file-specific guidance.

How it works

  1. Structure
  2. Path Patterns
  3. Writing Constraints
  4. When to Use Rules vs Other Tools
  5. Anti-Patterns
Original SKILL.md headings · 53 lines, 250 words
SKILL.md preview
---
name: rules-authoring
description: Guide to writing .claude/rules/*.md files — auto-applied constraints scoped by file patterns. Use when creating or updating rules for code conventions, quality standards, or file-specific guidance.
user-invocable: false
paths:
  - ".claude/rules/**/*.md"
  - "**/rules/**/*.md"
---

# Writing Rules

Rules are constraints Claude follows automatically when working with matching files. They live in `.claude/rules/` or a plugin's `rules/` directory.

## Structure

```markdown
---
paths:
  - "src/api/**/*.ts"
  - "**/*.test.ts"
---

Declarative constraints here.
```

## Path Patterns

- `**/*.ts` — all TypeScript files
- `src/**/*` — everything under src/
- `{src,lib}/**/*.ts` — multiple directories
- Omit `paths` entirely for rules that apply everywhere

Rules without `paths` load every session. Rules with `paths` only load when Claude works with matching files.

## Writing Constraints

**Be declarative** — state what should/shouldn't be done, not step-by-step procedures.

**Be specific** — "Use 2-space indentation" not "format properly."

**Skip the obvious** — don't restate best practices Claude already knows. Only specify what's unique to your project.

**One topic per file** — `testing.md`, `security.md`, not `everything.md`. Organize with subdirectories for grouping.

**Provide alternatives** — never write "Don't do X" without saying what to do instead.

## When to Use Rules vs Other Tools

- **Rules**: File-type-specific conventions that are advisory (Claude should follow but there's no hard enforcement)
- **CLAUDE.md**: Universal project context loaded every session
- **Hooks**: Must be enforced deterministically — cannot be ignored
- **Skills**: Reference material loaded on-demand, not automatically

## Anti-Patterns

- Procedural instructions (use commands or skills instead)
- Rules that apply to every file type (use CLAUDE.md or omit `paths`)
- Duplicating CLAUDE.md content
- Over-broad path patterns that match unrelated files
- Rules longer than ~30 lines (split into multiple files or use a skill)

Versions

The database has no other skills named rules-authoring.

Identical content appears in 1 other GitHub folders. We show one copy with the highest score.

Database snapshot: 13.11.2026 · package version 83b5cecefac4 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100rule-creator
    Create path-scoped .claude/rules/ for Claude Code projects. Use when adding coding conventions, framework patterns, or domain-specific rules that auto-inject when matching files are touched.
  • 95skills-authoring
    Guide to writing SKILL.md files for Claude Code. Use when creating skills that provide on-demand reference, methodology, or workflow guidance.
  • 85claude-md-authoring
    Best practices for writing effective CLAUDE.md files. Use when creating, updating, or auditing CLAUDE.md files for projects or directories.
  • 100create-rule
    Use when creating, writing, or updating a Claude Code rule file (.claude/rules/*.md or ~/.claude/rules/*.md), or when asking about rule format, path scoping, or rule best practices.
  • 100authoring-claude-md
    Creating and maintaining CLAUDE.md project memory files and .claude/rules/ rule files that provide non-obvious codebase context. Use when (1) creating a new CLAUDE.md for a project, (2) adding architectural patterns or design decisions to existing CLAUDE.md, (3) capturing…
  • 100vibe-rules
    Use when rules files change, when checking for duplicate or conflicting rules across ~/.claude/rules/common/, .claude/rules/, and CLAUDE.md, or when an agent has created new rules that may overlap with existing ones. Do not use for skill authoring or flow governance.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.