Skip to main content
skill CX Codex

create-rule — Claude Code skill: write agent rules

A skill that walks you through writing a rule file in .claude/rules/ so your agent stops repeating the same mistake.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add NeoLabHQ/context-engineering-kit --skill create-rule -a claude-code
Open on GitHub

What create-rule does

The skill guides you through creating files in .claude/rules/. Those files load into every agent session and act as standing orders: behavioral constraints, code standards, quality gates, project conventions.

The core of the method is contrastive examples. Each rule follows a description–Incorrect–Correct template, showing the mistake an agent would plausibly make and then the smallest fix. That pairing leaves less room for an agent to argue its way around the rule. The skill also covers which bad examples are useless and why the Correct block should not be a full rewrite.

Rules come in two kinds: global ones, and path-scoped ones that use paths in the frontmatter and load only when matching files are touched. Keep each file to 50–200 words, one rule per file, code samples under 20 lines. If the guidance only matters for one task, it belongs in a skill instead.

What it helps with

  • turn a repeated agent mistake into a rule
  • write a rule with Incorrect and Correct examples
  • scope a rule to specific files with paths
  • decide between a rule, a skill and CLAUDE.md
  • keep a rule within 50–200 words

Example prompts for the agent

  • The agent swallowed the exception again — create a rule for error handling
  • Add a rule for src/api/**/*.ts: input validation is required
  • It rewrote the whole file instead of patching one function. Turn that into a rule

How to install create-rule

1Skills CLI (Vercel)

npx skills add NeoLabHQ/context-engineering-kit --skill create-rule -a claude-code

2Manually: put the files in place

~/.claude/skills/create-rule/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/create-rule/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about create-rule

How do I install create-rule in Claude?

Run npx skills add NeoLabHQ/context-engineering-kit --skill create-rule -a claude-code. The skill lands in ~/.claude/skills/create-rule/SKILL.md.

What does create-rule do?

It helps you write a rule file for .claude/rules/ using a template with contrastive examples. Those files load into every agent session.

How is a rule different from a skill?

A rule loads every session and sets behavioral constraints, while a skill loads on demand and describes a procedure. Task-specific guidance belongs in a skill.

Similar skills

All skills for Agent setup: memory, context, orchestration →

From the same set55

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor