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.
Best use case
create-rule is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
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.
Teams using create-rule should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/create-rule/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How create-rule Compares
| Feature / Agent | create-rule | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
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.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
SKILL.md Source
# 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
| Platform | Format | Project location | Scope control |
| ---------- | ----------------- | ---------------- | -------------------------- |
| Cursor | `.mdc` files | `.cursor/rules/` | `globs` + `alwaysApply` |
| Gemini CLI | `.mdc` files | `.gemini/rules/` | `globs` + `alwaysApply` |
| Codex | `AGENTS.md` files | Anywhere in repo | Directory 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
```markdown
---
description: Brief description of what this rule does
globs: **/*.ts
alwaysApply: false
---
# Rule Title
Your rule content here...
```
### Frontmatter Fields
| Field | Type | Description |
| ------------- | ------- | -------------------------------------------------------- |
| `description` | string | What the rule does (shown in rule picker) |
| `globs` | string | File pattern — rule applies when matching files are open |
| `alwaysApply` | boolean | If `true`, applies to every session |
### Rule Configurations
**Always Apply** — universal standards that apply to every conversation:
```yaml
---
description: Core coding standards for the project
alwaysApply: true
---
```
**Apply to Specific Files** — conventions scoped to file types:
```yaml
---
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.
```markdown
<!-- 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 location | Effective 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`)
```markdown
---
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 exampleRelated Skills
kitt-create-slash-commands
Expert guidance for creating slash commands. Use when working with slash commands, creating custom commands, understanding command structure, or learning YAML configuration.
kitt-create-plans
Create hierarchical project plans optimized for solo agentic development. Use when planning projects, phases, or tasks that the AI agent will execute. Produces agent-executable plans with verification criteria, not enterprise documentation. Handles briefs, roadmaps, phase plans, and context handoffs.
hyrule-navigator
Autonomous navigation agent for Oracle of Secrets. Uses static map data and dynamic RAM state to localize Link and route him to destinations.
framer-motion-rules
Defines framer motion is being used for animations
flow-engineer-rule
Guide for creating persistent AI rules (coding standards, project conventions, file-specific patterns). Use when users want to create a rule, add coding standards, set up project conventions, configure file-specific patterns, or ask about rules placement. Works across IDEs (Cursor, Claude Code, Antigravity, OpenAI Codex, OpenCode).
cursor-rules-synchronizer
Synchronizes Cursor Rules (.mdc files in .cursor/rules/) to CLAUDE.md by generating a Rules section with context-efficient descriptions and usage instructions. Use when setting up Cursor Rules for the first time, after adding or modifying rules, or when the Rules section in CLAUDE.md is missing or outdated.
cursor-rules-review
Audit Cursor IDE rules (.mdc files) against quality standards using a 5-gate review process. Validates frontmatter (YAML syntax, required fields, description quality, triggering configuration), glob patterns (specificity, performance, correctness), content quality (focus, organization, examples, cross-references), file length (under 500 lines recommended), and functionality (triggering, cross-references, maintainability). Use when reviewing pull requests with Cursor rule changes, conducting periodic rule quality audits, validating new rules before committing, identifying improvement opportunities, preparing rules for team sharing, or debugging why rules aren't working as expected.
create-workflow
Create Jazz workflow automation files (WORKFLOW.md). Use this for scheduling Jazz agents to run recurring tasks. For OS-level scripts/commands, use create-system-routine.
create-prompt
Expert prompt engineering for creating effective prompts for Claude, GPT, and other LLMs. Use when writing system prompts, user prompts, few-shot examples, or optimizing existing prompts for better performance.
create-expert-skill
Create production-ready skills from expert knowledge. Extracts domain expertise and system ontologies, uses scripts for deterministic work, loads knowledge progressively. Use when building skills that must work reliably in production.
create-event-handlers
Sets up RabbitMQ event publishers and consumers following ModuleImplementationGuide.md Section 9. RabbitMQ only (no Azure Service Bus). Creates publishers with DomainEvent (tenantId preferred), consumers with handlers, naming {domain}.{entity}.{action}, required fields (id, type, version, timestamp, tenantId, source, data). Use when adding event-driven communication, async workflows, or integrating via events.
create-custom-prompt
Prompt for creating custom prompt files