create_rule
Skill38 starsChanged 2 months agoMITView on GitHub
Create Rule
In this repository101 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/CLAUDE.mdCLAUDE.md
- .cursor/rules/autonomous_execution.mdcCursor rule
- .cursor/rules/cursor_rules_editing.mdcCursor rule
- .cursor/rules/cursor_rules_sync.mdcCursor rule
- .cursor/rules/cursor_rules_sync_requirement.mdcCursor rule
- site_pages/llms.txtllms.txt
- advisorySkill
- analyzeSkill
- auditSkill
- commitSkill
- create-planSkill
- create_planSkill
- create-prototypeSkill
- create_prototypeSkill
- create_prSkill
- create-releaseSkill
- create_releaseSkill
- create-ruleSkill
- debugSkill
- draft-illustrationSkill
- draft_illustrationSkill
- endSkill
- evaluate_positioningSkill
- final-reviewSkill
- final_reviewSkill
- fix-feature-bugSkill
- fix_feature_bugSkill
- learnSkill
- manage-error-debuggingSkill
- manage_error_debuggingSkill
- neversight_learn_skills.dev_obviously_awesomeSkill
- process_issuesSkill
- process_prsSkill
- publish-planSkill
- publish_planSkill
- publishSkill
- pullSkill
- pushSkill
- recover_sqlite_databaseSkill
- releaseSkill
- report-errorSkill
- report_errorSkill
- reportSkill
- reviewSkill
- run-feature-workflowSkill
- run_feature_workflowSkill
- setup-commandsSkill
- setup_commandsSkill
- setup-cursor-copiesSkill
- setup_cursor_copiesSkill
- store-neotomaSkill
- store_neotomaSkill
- sync-env-from-1passwordSkill
- sync_env_from_1passwordSkill
- analyzeSkill
- auditSkill
- commitSkill
- create-planSkill
- create-prototypeSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
16 rules. About 0 are common, 9 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
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
- Very specific: line 11
Create a new rule file with _rules suffix and automatically create symlink in .claude/rules/.
- Very specific: line 13
SUBMODULE MODE: If a submodule name is provided (e.g., /create-rule foundation), create the rule in that submodule.
- Distinctive: line 31
Create rule file in submodule
- Distinctive: line 32
Run setup script to create symlink (if applicable)
- Very specific: line 37
Create rule file in docs/{location}/{name}_rules.md
- Distinctive: line 39
Run setup script to create symlink
- Distinctive: line 82
Use RFC 2119 language (MUST, SHOULD, MUST NOT)
- Very specific: line 95
Create file at docs/{location}/{name}_rules.md with content:
- Distinctive: line 189
Run foundation setup script:
- Very specific: line 194
Verify symlink created in .claude/rules/:
- Very specific: line 215
If submodule is foundation, run setup script from main repository:
- Very specific: line 220
Verify symlink created (for foundation rules, they're prefixed with foundation-)
- Distinctive: line 234
If submodule not found: Exit with error message
- Distinctive: line 235
If location directory doesn't exist in repo mode: Offer to create it or exit
- Distinctive: line 236
If file already exists: Warn and ask to overwrite or exit
- Distinctive: line 237
If setup script fails: Report error but keep the created file
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
<!-- Source: .cursor/skills/create-rule/SKILL.md -->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'sdocs/directory.
Workflow Overview
If submodule name provided:
- Verify submodule exists
- Determine submodule rule location
- Prompt user for rule details
- Create rule file in submodule
- Run setup script to create symlink (if applicable)
- Exit after submodule rule creation
If no submodule name provided (default - repo mode):
- Prompt user for rule details
- Create rule file in
docs/{location}/{name}_rules.md - Include standard Agent Instructions template
- Run setup script to create symlink
- Verify symlink created
Tasks
Step 1: Determine Scope
If submodule name provided:
- Verify submodule exists:
if ! git submodule status <submodule_name> >/dev/null 2>&1; then echo "❌ Submodule not found: <submodule_name>" exit 1 fi - Determine submodule rule location:
- For
foundationsubmodule:foundation/agent_instructions/cursor_rules/ - For other submodules: Check for standard rule directories or prompt user
- For
- 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:
- Rule file name (without
_rules.mdsuffix)- Example: "entity_resolution" will become "entity_resolution_rules.md"
- Validate: alphanumeric with underscores only
- Location in
docs/directory- Options:
conventions,foundation,subsystems,architecture,developer, etc. - Validate: directory must exist or ask to create
- Options:
- Rule purpose and scope
- Brief description of what this rule ensures
- What triggers loading this rule
- Key constraints/MUST/SHOULD rules
- List of main rules this document will enforce
- Use RFC 2119 language (MUST, SHOULD, MUST NOT)
Submodule mode prompts:
- Rule file name (without
_rules.mdcsuffix for foundation submodule, or without.mdcfor foundation submodule - MUST use.mdcextension for foundation rules) - Rule purpose and scope
- 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:
- Run foundation setup script:
./foundation/scripts/setup-cursor-rules.sh - 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
- Expected symlink name:
- 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:
- If submodule is
foundation, run setup script from main repository:./foundation/scripts/setup-cursor-rules.sh - Verify symlink created (for foundation rules, they're prefixed with
foundation-) - 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 creationExamples
Example 1: Create Repository Rule
/create-rulePrompts:
- 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 foundationPrompts:
- 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)
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
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.

