Awesome-omni-skill create-rule

Create persistent AI agent rules and instructions. Use when you want to create a rule, add coding standards, set up project conventions, configure file-specific patterns, or create AGENTS.md/GEMINI.md rule files across Cursor, Gemini CLI, or Codex.

install
source · Clone the upstream repo
git clone https://github.com/diegosouzapw/awesome-omni-skill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/diegosouzapw/awesome-omni-skill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data-ai/create-rule" ~/.claude/skills/diegosouzapw-awesome-omni-skill-create-rule-84cf31 && rm -rf "$T"
manifest: skills/data-ai/create-rule/SKILL.md
source content

Creating AI Agent Rules

Rules provide persistent instructions the agent follows across sessions. Each platform uses a different mechanism—choose based on the current environment.

Platform Overview

PlatformFormatProject locationScope control
Cursor
.mdc
files
.cursor/rules/
globs
+
alwaysApply
Gemini CLI
.mdc
files
.gemini/rules/
globs
+
alwaysApply
Codex
AGENTS.md
files
Anywhere in repoDirectory tree of the file

Gather Requirements

Before creating a rule, determine:

  1. Purpose: What should this rule enforce or teach?
  2. Scope: Should it always apply, or only for specific files/directories?
  3. File patterns: If file-specific, which glob patterns?

If the user hasn't specified scope, ask:

  • "Should this rule always apply, or only when working with specific files?"

If they mentioned specific files without providing patterns, ask:

  • "Which file patterns should this rule apply to?" (e.g.,
    **/*.ts
    ,
    backend/**/*.py
    )

Use a structured question tool if available, otherwise ask conversationally.


Cursor & Gemini CLI:
.mdc
Rule Files

Rules are

.mdc
files with YAML frontmatter placed in the platform's rules directory:

.cursor/rules/      # Cursor
.gemini/rules/      # Gemini CLI

File Structure

---
description: Brief description of what this rule does
globs: **/*.ts
alwaysApply: false
---

# Rule Title

Your rule content here...

Frontmatter Fields

FieldTypeDescription
description
stringWhat the rule does (shown in rule picker)
globs
stringFile pattern — rule applies when matching files are open
alwaysApply
booleanIf
true
, applies to every session

Rule Configurations

Always Apply — universal standards that apply to every conversation:

---
description: Core coding standards for the project
alwaysApply: true
---

Apply to Specific Files — conventions scoped to file types:

---
description: TypeScript conventions for this project
globs: **/*.ts
alwaysApply: false
---

Codex:
AGENTS.md
Files

Codex reads

AGENTS.md
files placed anywhere in the repo. A file's scope covers the entire directory tree rooted at its location. More deeply nested files take precedence over parent ones.

<!-- AGENTS.md at repo root — applies project-wide -->

- Always use `async/await` over `.then()` chains.
- Run `npm test` after any logic change.
- Follow the error handling pattern defined in `src/errors.ts`.

Placement guide:

File locationEffective scope
AGENTS.md
Entire project
src/AGENTS.md
Everything under
src/
src/api/AGENTS.md
Everything under
src/api/

Best Practices

  • Under 50 lines: Keep rules concise and focused.
  • One concern per rule: Split large rules into separate files.
  • Actionable: Write like clear internal docs, not vague guidelines.
  • Concrete examples: Show the bad pattern and the correct pattern.

Example (
.mdc
)

---
description: TypeScript error handling standards
globs: **/*.ts
alwaysApply: false
---

# Error Handling

\`\`\`typescript
// ❌ BAD
try { await fetchData(); } catch (e) {}

// ✅ GOOD
try {
await fetchData();
} catch (e) {
logger.error('Failed to fetch', { error: e });
throw new DataFetchError('Unable to retrieve data', { cause: e });
}
\`\`\`

Checklist

  • Correct format for current platform (
    .mdc
    vs
    AGENTS.md
    )
  • Frontmatter configured correctly (Cursor/Gemini CLI only)
  • Content under 500 lines
  • Includes at least one concrete example