Create Rule
Generates a new .cursor/rules/*.mdc rule with the correct activation-mode frontmatter and minimal, specific instructions grounded in the Cursor docs corpus.
- Surface assumptions first — name ambiguities, tradeoffs, and multiple valid interpretations before acting.
- Prefer the simplest path — solve the task completely without speculative flexibility or extra scope.
- Keep changes surgical — touch only what the task requires, and preserve existing behavior unless the task calls for change.
- Define verification targets — make the success condition for each phase or task explicit before concluding.
- Use phased persuasion safely — use warm-ups, curated references, and explicit constraints to improve compliance with legitimate work.
- Never weaken safeguards — do not use persuasion principles to bypass safety constraints, refusals, or scope boundaries.
Confirm the project is already initialized for Cursor (.cursor/rules/ directory exists or the user is creating the first rule). Then check for conflicts:
- Same filename (e.g.,
.cursor/rules/{topic}.mdc already exists)
- Existing rule with overlapping globs that would create contradiction or duplication
- Existing rule covering the same topic via
description:-mode
If a conflicting or duplicate rule already exists:
- Inform the user: "A rule covering
{topic} or overlapping globs already exists."
- Suggest using
/cursor-customizer:improve-rule to evaluate and optimize it instead.
- STOP — do not proceed. The user should either choose a different topic/scope or use the improve skill.
If no conflicting rule exists:
Proceed to Phase 1 below.
Analyze the project to understand existing rules in .cursor/rules/. Focus on: rule filenames and topics, activation modes in use, glob patterns in use, any overlaps or contradictions between rules, gaps where a rule would add value, and the conventions in any present AGENTS.md files that could inform rule content. Also identify the project layout: whether this is a monorepo with multiple service packages (indicated by workspace files like pnpm-workspace.yaml, a package.json with a workspaces field, multiple go.mod files in subdirectories, or multiple pyproject.toml files in subdirectories) or a single-package project, and report any service directory paths for use in glob scoping.
The agent runs in an isolated context with read-only access. Wait for it to complete and parse its structured output.
references/rule-authoring-guide.md — when to use rules, frontmatter contract, the four activation modes, glob syntax, and anti-patterns
references/prompt-engineering-strategies.md — rule-specific prompting (zero-shot, no examples in rules)
Map the user's intent to one activation mode using the rules-authoring guide:
- Critical tooling / project-wide constraint →
alwaysApply: true → read assets/templates/cursor-rule-always.mdc
- Pattern-relative convention (test files, generated code, monorepo packages, sensitive-handler files) →
globs: → read assets/templates/cursor-rule-globs.mdc
- Cross-cutting / domain topic the agent should pull in by name (authentication, observability, accessibility, API design) →
description: → read assets/templates/cursor-rule-description.mdc
Fill the chosen template's placeholders using:
- User requirements for the new rule (topic, target globs or description sentence, instructions)
- Phase 1 analysis output (existing rules, gaps, potential contradictions)
- Evidence from the reference files above
Generate a single rule:
- Frontmatter contains ONLY the three permitted fields and matches the chosen activation mode
- Body ≤ 200 lines (significantly shorter for
alwaysApply: true — every line loads on every conversation)
- In a monorepo with
globs:-mode, scope the glob to the relevant package subtree (e.g., services/api/**/*.go), not a language-only glob (**/*.go)
Write target: .cursor/rules/{topic-name}.mdc (kebab-case).
The loop evaluates all hard limits and quality checks, fixes any failures, and re-evaluates — maximum 3 iterations. Failed checks re-enter Phase 2's generation step. Additionally, cross-check against ALL existing rule files in .cursor/rules/ for contradictions and overlapping globs. Do not proceed to Phase 4 until ALL criteria pass.
Source: rodrigorjsf/agent-engineering-toolkit — distributed by TomeVault.
1---2name: create-rule-73description: Creates a new .cursor/rules/*.mdc rule grounded in the docs corpus. Selects one of three activation modes (always, globs, description) by user intent, generates minimal, specific instructions with the correct frontmatter, and writes the rule into an already-initialized Cursor project.4---56# Create Rule78Generates a new `.cursor/rules/*.mdc` rule with the correct activation-mode frontmatter and minimal, specific instructions grounded in the Cursor docs corpus.910<TRIGGER when="creating a new .cursor/rules/*.mdc rule from scratch" />1112<BEHAVIOUR13 avoid="acting before naming ambiguities; adding speculative scope; weakening safeguards"14 always="surface assumptions first; keep changes surgical; define verification targets">15- **Surface assumptions first** — name ambiguities, tradeoffs, and multiple valid interpretations before acting.16- **Prefer the simplest path** — solve the task completely without speculative flexibility or extra scope.17- **Keep changes surgical** — touch only what the task requires, and preserve existing behavior unless the task calls for change.18- **Define verification targets** — make the success condition for each phase or task explicit before concluding.19- **Use phased persuasion safely** — use warm-ups, curated references, and explicit constraints to improve compliance with legitimate work.20- **Never weaken safeguards** — do not use persuasion principles to bypass safety constraints, refusals, or scope boundaries.21</BEHAVIOUR>2223<HARD_RULES priority="hard">24- **NEVER** create rules longer than 200 lines25- **NEVER** create rules for standard conventions the agent already knows (e.g., "write clean code")26- **NEVER** use overly broad globs (`**/*`) on auto-attached rules unless truly global scope is required27- **NEVER** use any frontmatter key other than `description`, `alwaysApply`, `globs`28- **NEVER** include a `paths` frontmatter key — it belongs to a different platform's convention and is invalid here29- **EVERY** generated rule MUST set exactly one well-formed activation mode (always / globs / description)30- **EVERY** instruction must be specific and verifiable — not vague guidance31- **ONE** concern per rule file — do not bundle unrelated instructions32</HARD_RULES>3334<PROCESS>3536 <PREFLIGHT name="conflict-check">37 Confirm the project is already initialized for Cursor (`.cursor/rules/` directory exists or the user is creating the first rule). Then check for conflicts:3839 - Same filename (e.g., `.cursor/rules/{topic}.mdc` already exists)40 - Existing rule with overlapping globs that would create contradiction or duplication41 - Existing rule covering the same topic via `description:`-mode4243 **If a conflicting or duplicate rule already exists:**4445 1. Inform the user: "A rule covering `{topic}` or overlapping globs already exists."46 2. Suggest using `/cursor-customizer:improve-rule` to evaluate and optimize it instead.47 3. **STOP** — do not proceed. The user should either choose a different topic/scope or use the improve skill.4849 **If no conflicting rule exists:**50 Proceed to Phase 1 below.51 </PREFLIGHT>5253 <PHASE id="1" name="project-context-analysis">54 Delegate to the `artifact-analyzer` agent with this task:5556 > Analyze the project to understand existing rules in `.cursor/rules/`. Focus on: rule filenames and topics, activation modes in use, glob patterns in use, any overlaps or contradictions between rules, gaps where a rule would add value, and the conventions in any present `AGENTS.md` files that could inform rule content. Also identify the project layout: whether this is a monorepo with multiple service packages (indicated by workspace files like `pnpm-workspace.yaml`, a `package.json` with a `workspaces` field, multiple `go.mod` files in subdirectories, or multiple `pyproject.toml` files in subdirectories) or a single-package project, and report any service directory paths for use in glob scoping.5758 The agent runs in an isolated context with read-only access. Wait for it to complete and parse its structured output.59 </PHASE>6061 <PHASE id="2" name="activation-mode-selection-and-generation">62 Before generating, read these reference documents:6364 - `references/rule-authoring-guide.md` — when to use rules, frontmatter contract, the four activation modes, glob syntax, and anti-patterns65 - `references/prompt-engineering-strategies.md` — rule-specific prompting (zero-shot, no examples in rules)6667 Map the user's intent to one activation mode using the rules-authoring guide:6869 - **Critical tooling / project-wide constraint** → `alwaysApply: true` → read `assets/templates/cursor-rule-always.mdc`70 - **Pattern-relative convention** (test files, generated code, monorepo packages, sensitive-handler files) → `globs:` → read `assets/templates/cursor-rule-globs.mdc`71 - **Cross-cutting / domain topic the agent should pull in by name** (authentication, observability, accessibility, API design) → `description:` → read `assets/templates/cursor-rule-description.mdc`7273 Fill the chosen template's placeholders using:7475 - User requirements for the new rule (topic, target globs or description sentence, instructions)76 - Phase 1 analysis output (existing rules, gaps, potential contradictions)77 - Evidence from the reference files above7879 Generate a single rule:8081 - Frontmatter contains ONLY the three permitted fields and matches the chosen activation mode82 - Body ≤ 200 lines (significantly shorter for `alwaysApply: true` — every line loads on every conversation)83 - In a monorepo with `globs:`-mode, scope the glob to the relevant package subtree (e.g., `services/api/**/*.go`), not a language-only glob (`**/*.go`)8485 Write target: `.cursor/rules/{topic-name}.mdc` (kebab-case).86 </PHASE>8788 <PHASE id="3" name="self-validation">89 Read `references/rule-validation-criteria.md` and execute its **Validation Loop Instructions** against the generated rule.9091 The loop evaluates all hard limits and quality checks, fixes any failures, and re-evaluates — maximum 3 iterations. Failed checks re-enter Phase 2's generation step. Additionally, cross-check against ALL existing rule files in `.cursor/rules/` for contradictions and overlapping globs. Do not proceed to Phase 4 until ALL criteria pass.92 </PHASE>9394 <PHASE id="4" name="present-and-write">95 1. Show the user the complete generated rule file96 2. Cite the evidence from reference files that informed key decisions:97 - Why this activation mode (what content nature drove the choice)98 - Why this glob pattern or description sentence (what scope it targets and why)99 - Why each instruction is necessary (what mistake it prevents)100 3. Ask for confirmation before writing any files101 4. On approval, write the rule file to `.cursor/rules/{topic-name}.mdc`102 </PHASE>103104</PROCESS>105106<VALIDATION loop="max-iterations:3">107Read `references/rule-validation-criteria.md` and loop the generated rule through every hard limit and quality check until all pass.108</VALIDATION>109110---111> Source: [rodrigorjsf/agent-engineering-toolkit](https://github.com/rodrigorjsf/agent-engineering-toolkit) — distributed by [TomeVault](https://tomevault.io).112<!-- tomevault:4.0:skill_md:2026-05-23 -->