Skills vs Rules in Claude Code and Cursor: When to Use Each
Developers setting up Claude Code or Cursor often ask: should this go in a rule or a skill? They paste a 40-step release checklist into CLAUDE.md, then wonder why Claude ignores half of it. Or they create a skill for "use 2-space indent" and it never loads.
Rules are persistent instructions — loaded every session or when matching files are read. They shape how Claude behaves while editing.
Skills are on-demand playbooks — loaded when you invoke them or when the task clearly matches. They shape how Claude completes a specific workflow.
Related: How to Use Claude Code Effectively · Skills vs MCP vs Subagents
One-line definitions
| Rules | Skills | |
|---|---|---|
| What it is | Persistent instruction file | On-demand workflow playbook |
| Analogy | House rules on the wall | Recipe card you pull out when cooking |
| Loaded | Every session, or when matching files are read | When invoked (/skill-name) or task matches description |
| Best for | Conventions, constraints, "always do X" | Multi-step procedures, checklists, domain workflows |
| Context cost | Paid upfront (or on file read) | Paid only when used |
Rules = always-on behavior. Skills = sometimes-on procedure.
Where rules and skills live
Claude Code
| Type | Path | Scope |
|---|---|---|
| Root rules | CLAUDE.md or .claude/CLAUDE.md | Every session |
| Modular rules | .claude/rules/*.md | Every session, or on demand if path-scoped |
| Path-scoped rules | .claude/rules/api.md with paths: | When Claude reads matching files |
| Skills | .claude/skills/{name}/SKILL.md | On invoke or auto when relevant |
Cursor
| Type | Path | Scope |
|---|---|---|
| Project rules | .cursor/rules/*.mdc | When rule's glob/trigger matches |
| Skills | .cursor/skills/{name}/SKILL.md | On invoke or auto when relevant |
Cursor rules use .mdc with optional globs / alwaysApply. Claude Code rules use plain .md with optional paths: frontmatter. The concept is the same.
Side-by-side comparison
| Dimension | Rules | Skills |
|---|---|---|
| Primary job | Tell agent how to behave | Tell agent how to complete a task |
| Typical content | Style, conventions, boundaries | Step-by-step checklist, scripts |
| Length | Short — bullets and constraints | Can be longer — procedures OK |
| Trigger | Session start or file path match | /release or description match |
| Good example | "API handlers return { data, error }" | "Ship a release: bump version, changelog, tag, deploy" |
| Bad example | 30-step deploy checklist | "Use TypeScript strict mode" |
When to use rules
Put content in rules when:
- It applies every time Claude touches certain files
- It's a constraint or convention, not a procedure
- Removing it would cause Claude to make repeated mistakes
- It's short — a few bullets, not a runbook
Good rule topics
- Build and test commands
- Code style (indent, naming, error envelope format)
- Project layout
- Security boundaries
- File-type conventions
When to use skills
Put content in a skill when:
- It's a multi-step workflow (5+ steps with order)
- It only applies sometimes
- It includes scripts, templates, or reference files
- You want to invoke it explicitly (
/ship-blog-post) - It would bloat CLAUDE.md if pasted there
Good skill topics
- Ship a blog post
- Run a production database migration safely
- Triage a failing CI check
- Create a pull request with team template
Write the description field like a search query — vague descriptions mean the skill never auto-loads.
Example: a rule file
File: .claude/rules/testing.md
---
paths:
- "**/*.test.ts"
- "**/*.spec.ts"
- "tests/**/*"
---
# Testing conventions
- Use Vitest, not Jest
- One `describe` block per exported function
- Mock external HTTP at the boundary, not internal helpers
- Run `pnpm test path/to/file.test.ts` after editing a test file
- Never skip tests without a comment explaining why
Why this is a rule: Constraints that apply whenever Claude edits test files — no multi-step workflow.
Cursor equivalent
---
globs: "**/*.{test,spec}.ts,tests/**"
---
# Testing conventions
(same bullets)
Example: a skill file
File: .claude/skills/ship-blog-post/SKILL.md
---
name: ship-blog-post
description: >-
Publish a stackcone blog post — md source, HTML page, posts.json,
sitemap.xml, syntax highlighting. Use when user asks to ship or
publish a blog post.
---
# Ship a blog post
## Steps
1. Write `blog/md/{slug}.md` (markdown source, not public URL).
2. Write `blog/posts/{slug}/index.html` (canonical published page).
3. Download hero images to `blog/images/{slug}/` — no hotlinks.
4. Add entry to `blog/posts.json` with author "Amar Kumar".
5. Add URL to `sitemap.xml`.
6. Update static listing in `blog/index.html`.
7. Run `python3 _dev/apply_highlights.py blog/posts/{slug}/index.html`.
## Do not
- Create redirect stub files
- Generate AI hero images when real logos exist
Optional supporting files:
.claude/skills/ship-blog-post/
├── SKILL.md
├── template-snippet.md
└── scripts/check-sitemap.sh
Invoke manually: /ship-blog-post my-new-slug
Same task — wrong vs right
| Task | Wrong | Right |
|---|---|---|
| Always run tests before committing | Skill with one bullet | Rule in CLAUDE.md |
| How we deploy to production | 25-step deploy in CLAUDE.md | Skill deploy-production/SKILL.md |
| React components use named exports | Skill with vague description | Path-scoped rule for src/components/** |
| Fix GitHub issue #842 | Rule in CLAUDE.md | Skill with disable-model-invocation: true |
How they compose with CLAUDE.md
CLAUDE.md → facts true everywhere (build cmd, layout, git rules)
.claude/rules/ → conventions scoped by topic or file path
.claude/skills/ → procedures you run on demand
Example stack:
CLAUDE.md # pnpm test, never push main, project map
.claude/rules/
├── python-style.md # no paths → loads every session
├── api-design.md # paths: src/api/**
└── database.md # paths: src/db/**
.claude/skills/
├── add-endpoint/SKILL.md
├── run-migration/SKILL.md
└── incident/SKILL.md
Run /context to see what's loaded. If the list is huge, move procedures to skills and narrow rules with paths.
Decision flowchart
Is this a multi-step procedure (5+ ordered steps)?
YES → Skill
NO → Does it apply every session regardless of task?
YES → CLAUDE.md or unconditional .claude/rules/*.md
NO → Does it apply only when editing certain files?
YES → Path-scoped rule (paths: or globs:)
NO → CLAUDE.md if short; skill if rare workflow
Common mistakes
- Release checklist in CLAUDE.md — move to a skill.
- Style rules in a skill — belongs in a rule.
- Vague skill description — write like a search query.
- Duplicate content — same instruction in three places.
- Giant skill — split by trigger.
- Rules without paths in monorepos — frontend rules loading during backend work.
- Expecting rules to enforce — use
settings.jsonor hooks for hard blocks.
FAQ
What is the difference between skills and rules in Claude Code?
Rules are persistent instructions for conventions and constraints. Skills are on-demand playbooks for multi-step workflows.
Should a release checklist be a rule or a skill?
A skill. Multi-step procedures belong in SKILL.md, not CLAUDE.md.
Can a skill reference a rule?
Yes. Rules set defaults; skills orchestrate workflows that respect them.
Rules vs CLAUDE.md?
CLAUDE.md is the root rules file. .claude/rules/ splits it into modules. Use paths: to defer loading.
Skills vs MCP?
Rules and skills are instructions. MCP is plumbing to external systems. See Skills vs MCP vs Subagents.
Bottom line
- Rules — how Claude should behave (constraints, conventions, always-on facts)
- Skills — how Claude should complete a task (checklists, workflows, on demand)
Sticky note on your monitor → rule. Runbook in a drawer → skill.