# create-rule

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

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 1200 installs · ★ 1787
- Author: NeoLabHQ
- License: GPL-3.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/NeoLabHQ/context-engineering-kit/tree/HEAD/skills/create-rule/SKILL.md
- Updated: 2026-08-26
- HTML: https://affpapa.org/en/nevibecode/skills/create-rule

## What it 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.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add NeoLabHQ/context-engineering-kit --skill create-rule -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/create-rule/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/create-rule/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add NeoLabHQ/context-engineering-kit --skill create-rule -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/create-rule/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add NeoLabHQ/context-engineering-kit --skill create-rule -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/create-rule/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install NeoLabHQ/context-engineering-kit create-rule
```

2. **Manually: put the files in place**
- File: `.github/skills/create-rule/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add NeoLabHQ/context-engineering-kit --skill create-rule -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/NeoLabHQ/context-engineering-kit --path skills/create-rule
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/create-rule/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add NeoLabHQ/context-engineering-kit --skill create-rule -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/NeoLabHQ/context-engineering-kit/tree/HEAD/skills/create-rule/SKILL.md

## When to use it
- 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
- 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

## Similar
- [create-cowork-plugin](https://affpapa.org/en/nevibecode/skills/create-cowork-plugin.md) — skill · 2900 installs
- [create-skill](https://affpapa.org/en/nevibecode/skills/create-skill.md) — skill · 2800 installs
- [create-agent-skills](https://affpapa.org/en/nevibecode/skills/create-agent-skills.md) — skill · 503 installs
- [ai-shaped-readiness-advisor](https://affpapa.org/en/nevibecode/skills/ai-shaped-readiness-advisor.md) — skill · 2700 installs
- [init](https://affpapa.org/en/nevibecode/skills/init.md) — skill · 1300 installs
- [context-engineering](https://affpapa.org/en/nevibecode/skills/mrgoonie-context-engineering.md) — skill · 495 installs

From the same set: [neolabhq/context-engineering-kit](https://affpapa.org/en/nevibecode/by/neolabhq/context-engineering-kit.md) — 55 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
