agentleFS
markmhendricksonmarkmhendrickson/neotoma/.claude/skills/create-rule/SKILL.md

create-rule

Skill38 starsChanged 2 months agoMITView on GitHub

Create Rule

19 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use review-bugbot, update-cli-config and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • 0mlkrizzz655335vSkill

    review-bugbot

    缺陷导向代码审查。用 Bugbot 子代理找 bug。

    Also in 5 projects that use this

  • PandelisZSkill

    update-cli-config

    View and modify Cursor CLI configuration settings in ~/.cursor/cli-config.json. Use when the user wants to change CLI settings, configure permissions, switch approval mode, enable vim mode, toggle display options, configure sandbox, or manage any CLI preferences.

    Also in 7 projects that use this

  • 0mlkrizzz655335vSkill

    origin

    origin CLI 管理。安装、登录、更新、修复 origin.cursor.com 的 CLI。"disabled-environments:

    Also in 3 projects that use this

  • Tsumugii24Skill

    split-to-prs

    Split current work into small reviewable PRs. Use when the user asks to split a chat, set of changes, branch, or PR.

    Also in 7 projects that use this

  • MicrosoftSkill

    create-hook

    Create a hook (.json) to enforce policy or automate agent lifecycle events.

    Also in 9 projects that use this

  • testdino-hqSkill

    shell

    Google's official Shell scripting style guide. Covers Bash scripting, naming conventions, error handling, portability, and shell best practices.

    Also in 7 projects that use this

  • +3 more from 0mlkrizzz655335v

The file

Show its rules and text

We split this skill into the rules it gives an agent

16 rules. 0 are common, 9 are distinctive, and 7 are very specific to this project.

  • 0

    Common

    Most of the 19 edited versions we read keep these.

  • 9

    Distinctive

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Create a new rule file with _rules suffix and automatically create symlink in .claude/rules/.

    line 19
  2. Very specific:

    SUBMODULE MODE: If a submodule name is provided (e.g., /create-rule foundation), create the rule in that submodule.

    line 21
  3. Distinctive:

    Create rule file in submodule

    line 39
  4. Distinctive:

    Run setup script to create symlink (if applicable)

    line 40
  5. Very specific:

    Create rule file in docs/{location}/{name}_rules.md

    line 45
  6. Distinctive:

    Run setup script to create symlink

    line 47
  7. Distinctive:

    Use RFC 2119 language (MUST, SHOULD, MUST NOT)

    line 90
  8. Very specific:

    Create file at docs/{location}/{name}_rules.md with content:

    line 103
  9. Distinctive:

    Run foundation setup script:

    line 197
  10. Very specific:

    Verify symlink created in .claude/rules/:

    line 202
  11. Very specific:

    If submodule is foundation, run setup script from main repository:

    line 223
  12. Very specific:

    Verify symlink created (for foundation rules, they're prefixed with foundation-)

    line 228
  13. Distinctive:

    If submodule not found: Exit with error message

    line 242
  14. Distinctive:

    If location directory doesn't exist in repo mode: Offer to create it or exit

    line 243
  15. Distinctive:

    If file already exists: Warn and ask to overwrite or exit

    line 244
  16. Distinctive:

    If setup script fails: Report error but keep the created file

    line 245

“Common” is measured: kept by at least 6 in 10 of the 19 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md
<!-- Source: foundation/.cursor/skills/create-rule/SKILL.md -->

name: create-rule description: Create Cursor rule for persistent AI guidance. triggers:

  • create rule
  • /create_rule
  • create-rule

Create Rule

Create a new rule file with _rules suffix and automatically create symlink in .claude/rules/.

SUBMODULE MODE: If a submodule name is provided (e.g., /create-rule foundation), create the rule in that submodule. If no submodule name is provided, create in the main repository's docs/ directory.

Command

create-rule [submodule_name]

Inputs

  • submodule_name (optional string): Submodule name to create rule in (e.g., "foundation"). If omitted, creates rule in main repository's docs/ directory.

Workflow Overview

If submodule name provided:

  1. Verify submodule exists
  2. Determine submodule rule location
  3. Prompt user for rule details
  4. Create rule file in submodule
  5. Run setup script to create symlink (if applicable)
  6. Exit after submodule rule creation

If no submodule name provided (default - repo mode):

  1. Prompt user for rule details
  2. Create rule file in docs/{location}/{name}_rules.md
  3. Include standard Agent Instructions template
  4. Run setup script to create symlink
  5. Verify symlink created

Tasks

Step 1: Determine Scope

If submodule name provided:

  1. Verify submodule exists:
    if ! git submodule status <submodule_name> >/dev/null 2>&1; then
      echo "❌ Submodule not found: <submodule_name>"
      exit 1
    fi
  2. Determine submodule rule location:
    • For foundation submodule: foundation/agent_instructions/cursor_rules/
    • For other submodules: Check for standard rule directories or prompt user
  3. Set context for submodule rule creation

If no submodule name provided:

  • Set context for main repository rule creation in docs/ directory

Step 2: Prompt User for Rule Details

Repository mode prompts:

  1. Rule file name (without _rules.md suffix)
    • Example: "entity_resolution" will become "entity_resolution_rules.md"
    • Validate: alphanumeric with underscores only
  2. Location in docs/ directory
    • Options: conventions, foundation, subsystems, architecture, developer, etc.
    • Validate: directory must exist or ask to create
  3. Rule purpose and scope
    • Brief description of what this rule ensures
    • What triggers loading this rule
  4. Key constraints/MUST/SHOULD rules
    • List of main rules this document will enforce
    • Use RFC 2119 language (MUST, SHOULD, MUST NOT)

Submodule mode prompts:

  1. Rule file name (without _rules.mdc suffix for foundation submodule, or without .mdc for foundation submodule - MUST use .mdc extension for foundation rules)
  2. Rule purpose and scope
  3. Key constraints/MUST/SHOULD rules

Step 3: Create Rule File

Repository mode:

Create file at docs/{location}/{name}_rules.md with content:

# {Rule Title}

**Reference:** `docs/{reference_doc}.md` — Related documentation (if applicable)

{Brief description of what this rule ensures}

## Purpose

{Expanded purpose from user input}

## Trigger Patterns

When any of the following occur:

- {Trigger pattern 1}
- {Trigger pattern 2}
- {Trigger pattern 3}

## Agent Actions

### Step 1: {Action Title}

{Description of what agent should do}

### Step 2: {Action Title}

{Description of what agent should do}

## Constraints

### MUST

1. {MUST constraint 1}
2. {MUST constraint 2}

### SHOULD

1. {SHOULD constraint 1}
2. {SHOULD constraint 2}

### MUST NOT

1. {MUST NOT constraint 1}
2. {MUST NOT constraint 2}

## Examples

### Example 1: {Example Title}

{Example description and code/steps}

---

## Agent Instructions

### When to Load This Document

Load this document when:

- {Trigger condition 1}
- {Trigger condition 2}

### Required Co-Loaded Documents

- {Required document 1}
- {Required document 2}

### Constraints Agents Must Enforce

1. {Constraint to enforce 1}
2. {Constraint to enforce 2}

### Forbidden Patterns

- {Anti-pattern 1}
- {Anti-pattern 2}

### Validation Checklist

- [ ] {Validation item 1}
- [ ] {Validation item 2}

Submodule mode:

For foundation submodule, create file following foundation cursor-rules pattern (simpler structure without Agent Instructions section since these are loaded automatically).

Step 4: Run Setup Script

Repository mode:

  1. Run foundation setup script:
    ./foundation/scripts/setup-cursor-rules.sh
  2. Verify symlink created in .claude/rules/:
    • Expected symlink name: {location}_{name}_rules.md
    • Example: docs/conventions/entity_resolution_rules.md → .claude/rules/conventions_entity_resolution_rules.md
  3. Output success message:
    ✅ Rule created successfully!
    
    File: docs/{location}/{name}_rules.md
    Symlink: .claude/rules/{location}_{name}_rules.md
    
    The rule is now available to all Cursor agents in this repository.
    
    Next steps:
    1. Review the generated rule file and fill in any remaining details
    2. Test the rule by triggering its conditions
    3. Update related documentation to reference this rule if needed

Submodule mode:

  1. If submodule is foundation, run setup script from main repository:
    ./foundation/scripts/setup-cursor-rules.sh
  2. Verify symlink created (for foundation rules, they're prefixed with foundation-)
  3. Output success message:
    ✅ Rule created in submodule successfully!
    
    File: {submodule}/{rule_path}/{name}{suffix}.mdc (for foundation submodule, use .mdc extension)
    Symlink: .claude/rules/{prefix}{name}.mdc (if applicable)
    
    The rule is now available to all repositories using this submodule.

Error Handling

  • If submodule not found: Exit with error message
  • If location directory doesn't exist in repo mode: Offer to create it or exit
  • If file already exists: Warn and ask to overwrite or exit
  • If setup script fails: Report error but keep the created file

Configuration

Optional configuration in foundation-config.yaml:

agent_instructions:
  rules:
    default_location: "docs/conventions"  # Default location for new rules
    template_path: null  # Custom template path (optional)
    auto_run_setup: true  # Automatically run setup script after creation

Examples

Example 1: Create Repository Rule

/create-rule

Prompts:

  • Rule file name: entity_resolution
  • Location: subsystems
  • Purpose: "Ensure consistent entity resolution patterns across codebase"
  • Key constraints: "MUST use deterministic merging, MUST NOT introduce randomness"

Creates:

  • docs/subsystems/entity_resolution_rules.md
  • .claude/rules/subsystems_entity_resolution_rules.md (symlink)

Example 2: Create Foundation Submodule Rule

/create-rule foundation

Prompts:

  • Rule file name: testing_patterns
  • Purpose: "Enforce consistent testing patterns"
  • Key constraints: "MUST include unit tests, SHOULD use fixtures"

Creates:

  • foundation/agent_instructions/cursor_rules/testing_patterns.mdc
  • .claude/rules/foundation_testing_patterns.mdc (symlink)

Required Documents

Load before starting:

  • foundation/scripts/setup-cursor-rules.sh (setup script)
  • docs/conventions/documentation_standards_rules.md (if creating repo rule)
  • foundation-config.yaml (configuration)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.