mgiovani/ai-arsenal / skills/create-rule
create-rule
VerifiedCreate a new memory/instruction rule for whatever AI coding tool a project actually uses, a CLAUDE.md entry or .claude/rules/*.md file for Claude Code, an AGENTS.md entry for Codex/Cursor/Copilot/Gemini-CLI-style tools, or a .cursor/rules/*.mdc file for Cursor. Use when the user runs /create-rule or asks to add a project rule, user/personal rule, coding standard, style guide entry, or workflow instruction to memory, AGENTS.md, or CLAUDE.md. Not for creating skills or slash commands (use create-skill). Not for discovering or installing existing third-party skills (use find-skills).
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 4.5 KB |
| evals/evals.json | config | 3.2 KB |
| evals/trigger-eval.json | config | 1.8 KB |
| references/memory-hierarchy.md | markdown | 4.9 KB |
| references/rule-examples.md | markdown | 4.3 KB |
references/memory-hierarchy.md
View on GitHub# Memory Hierarchy Reference
Every AI coding tool has its own place for standing project instructions. Detect which
one the project uses (see SKILL.md step 2) before writing anything.
## Contents
- [Claude Code](#claude-code)
- [AGENTS.md-style tools (Codex, Cursor, Copilot, Gemini CLI, OpenCode, ...)](#agentsmd-style-tools-codex-cursor-copilot-gemini-cli-opencode-)
- [Cursor native rules](#cursor-native-rules)
- [Glob pattern reference (Claude Code `paths` / Cursor `globs`)](#glob-pattern-reference-claude-code-paths--cursor-globs)
- [Category organization (Claude Code `.claude/rules/`, Cursor `.cursor/rules/`)](#category-organization-claude-code-clauderules-cursor-cursorrules)
## Claude Code
Loads memory from multiple locations, most specific wins:
| Type | Location | Purpose | Shared With |
|------|----------|---------|-------------|
| **Enterprise** | OS-specific, see below | Organization-wide policies | All org users |
| **Project** | `./CLAUDE.md` or `./.claude/CLAUDE.md` | Team-shared project instructions | Team via git |
| **Project Rules** | `./.claude/rules/*.md` | Modular, topic-specific rules | Team via git |
| **User** | `~/.claude/CLAUDE.md` | Personal preferences (all projects) | Just you |
| **User Rules** | `~/.claude/rules/*.md` | Personal modular rules | Just you |
| **Project Local** | `./CLAUDE.local.md` | Personal project preferences | Just you |
Enterprise managed policy path (deployed by IT, not something this skill writes to):
| OS | Path |
|----|------|
| macOS | `/Library/Application Support/ClaudeCode/CLAUDE.md` |
| Linux/WSL | `/etc/claude-code/CLAUDE.md` |
| Windows | `C:\ProgramData\ClaudeCode\CLAUDE.md` |
These are managed-deployment paths and can vary by organization: verify against
https://code.claude.com/docs/en/memory before relying on one, and never write to them
from this skill.
Priority: more specific overrides general; project rules override user rules;
path-specific rules only apply to matching files; enterprise rules are a baseline that
project rules refine.
### Frontmatter (`.claude/rules/*.md` only, never on `CLAUDE.md`)
```yaml
---
paths: src/**/*.ts
# Supports glob patterns and brace expansion
paths: src/**/*.{ts,tsx}
# Multiple patterns with comma
paths: {src,lib}/**/*.ts, tests/**/*.test.ts
---
```
### Import syntax (CLAUDE.md only)
```markdown
@path/to/file.md
```
Includes the referenced file's content into the memory context.
## AGENTS.md-style tools (Codex, Cursor, Copilot, Gemini CLI, OpenCode, ...)
A single tool-agnostic `AGENTS.md` at the repo root, read natively by these tools:
no frontmatter, no per-topic file split. This repo's own `AGENTS.md` (canonical,
tool-neutral) + `CLAUDE.md` (imports it via `@AGENTS.md` and adds Claude-only content)
is a live worked example of the pairing. When a project has `AGENTS.md` and no
Claude-specific files, add a new `##` section to it rather than creating a separate
file: the format has no concept of splitting rules across files.
## Cursor native rules
Cursor also supports its own format independent of `AGENTS.md`:
| Location | Purpose |
|----------|---------|
| `.cursor/rules/*.mdc` | Modular project rules, one file per topic |
| `.cursorrules` (legacy, repo root) | Older single-file format: don't create new ones, only append if it's the only thing present |
### Frontmatter (`.cursor/rules/*.mdc`)
```yaml
---
description: When this rule applies (used for auto-attachment)
globs: ["src/api/**/*.ts"]
alwaysApply: false
---
```
`alwaysApply: true` includes the rule in every request regardless of `globs`.
## Glob pattern reference (Claude Code `paths` / Cursor `globs`)
| Pattern | Matches |
|---------|---------|
| `**/*.ts` | All TypeScript files in any directory |
| `src/**/*` | All files under `src/` directory |
| `*.md` | Markdown files in project root only |
| `src/components/*.tsx` | React components in specific directory |
| `**/*.{ts,tsx}` | Both .ts and .tsx files anywhere |
| `{src,lib}/**/*.ts` | TypeScript in src/ or lib/ directories |
## Category organization (Claude Code `.claude/rules/`, Cursor `.cursor/rules/`)
Both tools support nested directories for organizing many rules:
```
.claude/rules/
├── code-style/
│ ├── formatting.md # Indentation, line length, etc.
│ ├── naming.md # Variable/function naming conventions
│ └── imports.md # Import organization
├── testing/
│ ├── unit-tests.md # Unit testing conventions
│ ├── integration.md # Integration testing
│ └── mocking.md # Mock patterns
├── security/
│ ├── authentication.md # Auth patterns
│ ├── validation.md # Input validation
│ └── secrets.md # Secret handling
├── workflow/
│ ├── git.md # Git conventions
│ ├── pr-reviews.md # PR review process
│ └── deployment.md # Deployment procedures
└── api-design.md # API design guidelines
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |