create-rule

create-rule is a skill for Claude Code, Codex from paultyng/skill-issue. It costs 48 tokens per session (1,016 once invoked), scanned A, original, MIT.

A guide for creating instruction files for Claude Code, an AI coding assistant. These rules can apply to every project session or only when working with matching file paths.

In plain words
What is it for?
Use it to write or update .claude/rules files, choose path matching, and understand when to use rules, CLAUDE.md, or skills.
Why use it?
It helps prevent project instructions, reusable workflows, and file-specific guidance from being placed in the wrong kind of file. It also explains where shared and personal rules belong.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/paultyng/skill-issue/create-rule
Any agent
npx skills add paultyng/skill-issue --skill create-rule
Clone the repo
git clone --depth 1 https://github.com/paultyng/skill-issue

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for create-rule

README.md
[![agentmods](https://agentmods.dev/badge/skills/paultyng/skill-issue/create-rule.svg)](https://agentmods.dev/skills/paultyng/skill-issue/create-rule)
Your own site
<a href="https://agentmods.dev/skills/paultyng/skill-issue/create-rule"><img src="https://agentmods.dev/badge/skills/paultyng/skill-issue/create-rule.svg" alt="Measured on agentmods" height="20"></a>
Per session 48 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,016 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00048 $0.01016
Opus 5 $0.00024 $0.00508
Sonnet 5 $0.00010 $0.00203
Haiku 4.5 $0.00005 $0.00102

Measured 3d ago against content hash dd8dab42fef7, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

create-rule scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/create-rule/SKILL.md · 99 lines

How it starts

The opening of the file, as written. The whole thing — 99 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Create Rule

Rules vs CLAUDE.md vs Skills

Choose the right mechanism before writing anything:

Mechanism When to use Loads
Rule Behavioral instructions scoped to a topic or file type Every session (or on path match)
CLAUDE.md Broad project context: build commands, architecture, workflows Every session
Skill Repeatable on-demand workflows Only when invoked

If the instruction only makes sense for certain file types (e.g. Go, test files), use a path-scoped rule. If it's a repeatable task workflow, use a skill instead.

Storage Locations

Scope Path
Personal, all projects on this machine ~/.claude/rules/<topic>.md
Project, shared with team via git .claude/rules/<topic>.md

Rules in subdirectories are discovered recursively (e.g. .claude/rules/frontend/react.md works).

Rule File Format

---
paths:            # optional; omit for always-load
  - "**/*.go"
  - "**/*_test.go"
---

# rule-name

Instructions...

No paths frontmatter → rule loads every session. paths present → rule loads only when Claude opens a matching file.

Path Scoping Decision

Use always-load (no frontmatter) for:

  • Universal behaviors: commit style, escalation policy, output verbosity
  • Toolchain choices: task runner, package manager, CI tooling

Use path-scoped for:

  • Language conventions: **/*.go, **/*.ts, **/*.py
  • Test files: **/*_test.go, **/*.test.ts, **/*.spec.ts
  • Domain directories: src/api/**/*, e2e/**/*.go, migrations/**/*.sql

See references/rule-patterns.md for glob pattern examples.

Writing Effective Rules

  • Specific and verifiable: "Use 2-space indentation" not "format code nicely"
  • One topic per file with a descriptive filename (testing.md, api-design.md)
  • Under 200 lines. Longer files reduce adherence; split if growing large
  • Markdown structure: use headers and bullets, not dense paragraphs
  • No contradictions across rule files; audit when adding new ones
  • Use RFC 2119 key words for requirement levels (MUST / SHOULD / MAY), sparingly and only for genuine requirements. See the normative-language rule. For a requirement that is also frequently violated, add a short "Frequently missed:" lead-in.

Read the full file on GitHub · 99 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 99 lines · 48 tokens per session scan A dd8dab42fef7

Subscribe to this mod's changes

create-rule is a skill published in the GitHub repository paultyng/skill-issue (9 stars, last pushed 22d ago), licensed MIT. It adds 48 tokens to every session and 1,016 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.