Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Caseproof AI Rules

Universal, IDE-agnostic AI coding rules for Caseproof WordPress plugins.

Write rules once as modular .rule.md files, compile them for any AI coding assistant.

Supported IDEs

Target Output
Cursor .cursor/rules/*.mdc (one file per rule)
Claude Code CLAUDE.md (single file)
GitHub Copilot .github/copilot-instructions.md
Windsurf .windsurfrules

Quick Start

# Clone and install
git clone git@github.com:caseproof/ai-rules.git caseproof-rules
cd caseproof-rules
npm install && npm run build

# List available presets
node dist/index.js list

# Build rules for your IDE
node dist/index.js build --preset membercore-connect --target cursor --output ../membercore-connect
node dist/index.js build --preset membercore-connect --target claude --output ../membercore-connect

# Build all targets at once
node dist/index.js build --preset membercore-connect --target all --output ../membercore-connect

# Preview without writing files
node dist/index.js build --preset membercore-connect --target cursor --output ../membercore-connect --dry-run

# Validate all presets and rules
node dist/index.js validate

Architecture

Rule Layers

Rules are stacked in priority order. Higher layers can override lower ones.

Priority 100-199  →  rules/base/              (Universal WordPress)
Priority 200-299  →  rules/frameworks/         (Ground Level, etc.)
Priority 300-399  →  rules/plugins/            (Plugin-specific)
Priority 400-499  →  commands/                 (Guardrails)

Rule Format

Each .rule.md file is plain Markdown with YAML frontmatter:

---
id: "base/security"
description: "WordPress security guardrails"
layer: "base"
priority: 110
alwaysApply: true
globs:
  - "**/*.php"
tags:
  - "security"
---

# Security Requirements

Content here...

Template Variables

Base rules use {{VARIABLE}} placeholders that get substituted from the preset config:

Variable Example
{{TEXT_DOMAIN}} membercore-connect
{{PLUGIN_PREFIX}} mccon
{{PLUGIN_CONSTANT_PREFIX}} MCCON
{{TABLE_PREFIX}} mccon_
{{PLUGIN_NAME}} membercore-connect

Presets

Presets define which layers to include and what variables to substitute:

{
  "name": "membercore-connect",
  "variables": {
    "TEXT_DOMAIN": "membercore-connect",
    "PLUGIN_PREFIX": "mccon"
  },
  "layers": [
    "base/*",
    "frameworks/ground-level/*",
    "plugins/membercore-connect/*"
  ],
  "commands": ["commands/rail"]
}

Available Presets

Preset Layers Description
membercore-connect base + ground-level + plugin Messaging/communication add-on
memberpress base Membership plugin
memberpress-coachkit base + ground-level Coaching and group management
memberpress-courses base LMS add-on
memberpress-downloads base Digital file protection
memberpress-corporate base Sub-account management
easy-affiliate base Affiliate program management

All presets include the commands/rail guardrail by default. Add "includeReference" to opt into 10up best practices deep-dives.

Adding a New Plugin

  1. Create presets/my-plugin.json with your plugin's variables and layers
  2. Optionally add plugin-specific rules in rules/plugins/my-plugin/
  3. Run node dist/index.js build --preset my-plugin --target cursor --output ../my-plugin

Adding a New Rule

  1. Create a .rule.md file in the appropriate layer directory
  2. Add YAML frontmatter with id, layer, priority, etc.
  3. Use {{VARIABLE}} placeholders for plugin-specific values
  4. Run node dist/index.js validate to verify

npm Script Aliases

Add these to your plugin's package.json for convenience:

{
  "scripts": {
    "rules:cursor": "cd ../caseproof-rules && npm run build && node dist/index.js build --preset my-plugin --target cursor --output $INIT_CWD",
    "rules:claude": "cd ../caseproof-rules && npm run build && node dist/index.js build --preset my-plugin --target claude --output $INIT_CWD",
    "rules:all": "cd ../caseproof-rules && npm run build && node dist/index.js build --preset my-plugin --target all --output $INIT_CWD"
  }
}

Then from your plugin directory: npm run rules:cursor

Reference Rules (Optional)

The rules/reference/ directory contains curated 10up Engineering Best Practices. These are opt-in — add them to your preset's includeReference array:

{
  "includeReference": [
    "reference/10up-php",
    "reference/10up-performance",
    "reference/10up-javascript",
    "reference/10up-css",
    "reference/10up-security"
  ]
}

These add ~1000 lines of additional context. Use selectively to stay within IDE context limits.

Project Structure

caseproof-rules/
├── rules/
│   ├── base/                    # Universal WordPress rules (6 files)
│   ├── frameworks/ground-level/ # Ground Level framework rules (4 files)
│   ├── plugins/                 # Plugin-specific rules
│   └── reference/               # 10up best practices (opt-in, 5 files)
├── commands/                    # Guardrail commands
├── presets/                     # Named layer combinations (7 presets)
└── src/                         # CLI build tool (TypeScript)

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages