@mallardbay/cursor-rules 1.0.10 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,10 +1,17 @@
1
1
  # Cursor Rules
2
2
 
3
- A tool for managing Cursor IDE rules across different environment types with shared base configurations.
3
+ A tool for managing Cursor IDE rules and Claude Code configuration across different environment types with shared base configurations.
4
4
 
5
5
  ## Overview
6
6
 
7
- This project provides a structured way to manage Cursor IDE rules for different development environments while maintaining a shared base configuration. It supports three main environment types:
7
+ This project provides a structured way to manage AI agent rules and skills for different development environments while maintaining a shared base configuration. It generates:
8
+
9
+ - **Cursor IDE**: `.cursor/rules/*.mdc` files and `.cursor/skills/*/SKILL.md` files
10
+ - **Claude Code**: A combined `CLAUDE.md` file and `.claude/skills/*/SKILL.md` files
11
+ - **Codex**: `.codex/skills/*/SKILL.md` files
12
+ - **Cross-platform Skills**: Skills are automatically copied to all three platform directories for maximum compatibility
13
+
14
+ It supports three main environment types:
8
15
 
9
16
  - `frontend`: Basic frontend development rules
10
17
  - `frontend-lib`: Extended rules for frontend library development, inheriting from frontend rules
@@ -45,12 +52,13 @@ npx @mallardbay/cursor-rules backend
45
52
 
46
53
  ## Project Structure
47
54
 
48
- The rules are organized in the following directory structure:
55
+ The rules and skills are organized in the following directory structure:
49
56
 
50
57
  ```
51
58
  .cursor/
52
59
  ├── shared/
53
- └── rules/ # Shared base rules
60
+ ├── rules/ # Shared base rules
61
+ │ └── skills/ # Shared skills (installable workflows)
54
62
  ├── frontend/
55
63
  │ └── rules/ # Frontend-specific rules
56
64
  ├── frontend-lib/
@@ -66,6 +74,41 @@ The rules follow an inheritance pattern:
66
74
  - All environments include the shared base rules
67
75
  - `frontend-lib` inherits rules from both `frontend` and `frontend-lib` directories
68
76
 
77
+ ## Output
78
+
79
+ Running the setup script generates:
80
+
81
+ ```
82
+ your-project/
83
+ ├── .cursor/
84
+ │ ├── rules/ # Cursor IDE rules (*.mdc files)
85
+ │ │ ├── code-quality.mdc
86
+ │ │ ├── testing.mdc
87
+ │ │ └── ...
88
+ │ └── skills/ # Cursor Skills (installable workflows)
89
+ │ ├── example-skill/
90
+ │ │ └── SKILL.md
91
+ │ └── create-pr/
92
+ │ └── SKILL.md
93
+ ├── .claude/
94
+ │ └── skills/ # Claude Code Skills (same skills)
95
+ │ ├── example-skill/
96
+ │ │ └── SKILL.md
97
+ │ └── create-pr/
98
+ │ └── SKILL.md
99
+ ├── .codex/
100
+ │ └── skills/ # Codex Skills (same skills)
101
+ │ ├── example-skill/
102
+ │ │ └── SKILL.md
103
+ │ └── create-pr/
104
+ │ └── SKILL.md
105
+ └── CLAUDE.md # Claude Code configuration (combined rules)
106
+ ```
107
+
108
+ The `CLAUDE.md` file combines all applicable rules into a single file, with YAML frontmatter stripped for compatibility with Claude Code.
109
+
110
+ Skills are automatically discovered by Cursor, Claude Code, and Codex, and can be invoked with `/skill-name` in chat. The setup script copies skills to all three platform directories for cross-platform compatibility.
111
+
69
112
  ## Development
70
113
 
71
114
  ### Adding New Rules
@@ -73,14 +116,39 @@ The rules follow an inheritance pattern:
73
116
  1. Create `.mdc` files in the appropriate rules directory
74
117
  2. Rules will be automatically copied to `.cursor/rules/` when running the setup script
75
118
 
119
+ ### Adding New Skills
120
+
121
+ 1. Create a skill directory in `.cursor/shared/skills/your-skill-name/`
122
+ 2. Add a `SKILL.md` file with YAML frontmatter and instructions
123
+ 3. Optionally add `scripts/`, `references/`, or `assets/` directories
124
+ 4. Skills will be automatically copied to `.cursor/skills/`, `.claude/skills/`, and `.codex/skills/` when running the setup script for cross-platform compatibility
125
+ 5. See [SKILLS.md](SKILLS.md) for detailed documentation
126
+
76
127
  ### Directory Structure
77
128
 
78
129
  - `bin/setup-cursor.sh`: Main setup script
79
130
  - `.cursor/shared/rules/`: Shared base rules
131
+ - `.cursor/shared/skills/`: Shared skills (installable workflows)
80
132
  - `.cursor/frontend/rules/`: Frontend-specific rules
81
133
  - `.cursor/frontend-lib/rules/`: Frontend library-specific rules
82
134
  - `.cursor/backend/rules/`: Backend-specific rules
83
135
 
136
+ ## Skills
137
+
138
+ This repository includes example Cursor Skills that can be installed:
139
+
140
+ - **example-skill**: Template for creating new skills
141
+ - **create-pr**: Workflow for creating well-structured pull requests
142
+ - **prep-for-pr**: Prepare your branch for a PR by checking and fixing code quality issues
143
+ - **review-pr**: Systematically review someone else's PR with code quality, security, and standards checks
144
+ - **address-pr-feedback**: Find PR by branch, review feedback, create plan, implement fixes, and resolve GitHub conversations
145
+
146
+ See [SKILLS.md](SKILLS.md) for complete documentation on:
147
+ - Creating new skills
148
+ - Installing skills from GitHub
149
+ - Skill structure and format
150
+ - Best practices
151
+
84
152
  ## License
85
153
 
86
154
  [Add your license information here]
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
  # setup-cursor.sh — frontend & frontend-lib layering with shared base
3
+ # Also generates CLAUDE.md for Claude Code
3
4
 
4
5
  set -e
5
6
 
@@ -11,15 +12,28 @@ if [ -z "$ENV_TYPE" ]; then
11
12
  exit 1
12
13
  fi
13
14
 
14
- SCRIPT_PATH="$(realpath "$0")"
15
- SRC_DIR="$(cd "$(dirname "$SCRIPT_PATH")/.." && pwd)"
15
+ # Get the real path of the script (portable across Mac/Linux)
16
+ get_real_path() {
17
+ local path="$1"
18
+ cd "$(dirname "$path")" && echo "$(pwd -P)/$(basename "$path")"
19
+ }
20
+ SCRIPT_PATH="$(get_real_path "$0")"
21
+ SRC_DIR="$(cd "$(dirname "$SCRIPT_PATH")/.." && pwd -P)"
16
22
 
17
23
  SHARED_DIR="$SRC_DIR/.cursor/shared/rules"
18
24
  FRONTEND_DIR="$SRC_DIR/.cursor/frontend/rules"
19
25
  FRONTEND_LIB_DIR="$SRC_DIR/.cursor/frontend-lib/rules"
20
26
  BACKEND_DIR="$SRC_DIR/.cursor/backend/rules"
27
+ SHARED_SKILLS_DIR="$SRC_DIR/.cursor/shared/skills"
21
28
 
22
29
  mkdir -p .cursor/rules
30
+ mkdir -p .cursor/skills
31
+ mkdir -p .claude/skills
32
+ mkdir -p .codex/skills
33
+
34
+ # Temporary file to collect CLAUDE.md content
35
+ CLAUDE_MD_TEMP=$(mktemp)
36
+ trap 'rm -f "$CLAUDE_MD_TEMP"' EXIT
23
37
 
24
38
  copy_rules() {
25
39
  local DIR="$1"
@@ -29,20 +43,69 @@ copy_rules() {
29
43
  fi
30
44
  }
31
45
 
46
+ copy_skills() {
47
+ local DIR="$1"
48
+ if [ -d "$DIR" ]; then
49
+ echo "Copying skills from: $DIR"
50
+ # Copy each skill directory to all three locations for cross-platform compatibility
51
+ for skill_dir in "$DIR"/*; do
52
+ if [ -d "$skill_dir" ] && [ -f "$skill_dir/SKILL.md" ]; then
53
+ skill_name=$(basename "$skill_dir")
54
+ echo " - Copying skill: $skill_name"
55
+ # Copy to Cursor, Claude, and Codex skill directories
56
+ cp -r "$skill_dir" .cursor/skills/ 2>/dev/null || true
57
+ cp -r "$skill_dir" .claude/skills/ 2>/dev/null || true
58
+ cp -r "$skill_dir" .codex/skills/ 2>/dev/null || true
59
+ fi
60
+ done
61
+ fi
62
+ }
63
+
64
+ # Append rules to CLAUDE.md (strips YAML frontmatter)
65
+ append_to_claude_md() {
66
+ local DIR="$1"
67
+ if [ -d "$DIR" ]; then
68
+ for file in "$DIR"/*.mdc; do
69
+ [ -f "$file" ] || continue
70
+ # Add separator
71
+ echo "" >> "$CLAUDE_MD_TEMP"
72
+ echo "---" >> "$CLAUDE_MD_TEMP"
73
+ echo "" >> "$CLAUDE_MD_TEMP"
74
+ # Strip YAML frontmatter (content between --- markers) and append
75
+ awk '
76
+ BEGIN { in_frontmatter=0; found_end=0 }
77
+ /^---$/ && !found_end {
78
+ if (in_frontmatter) { found_end=1; next }
79
+ else { in_frontmatter=1; next }
80
+ }
81
+ !in_frontmatter || found_end { print }
82
+ ' "$file" >> "$CLAUDE_MD_TEMP"
83
+ done
84
+ fi
85
+ }
86
+
32
87
  # Always include shared rules
33
88
  copy_rules "$SHARED_DIR"
89
+ append_to_claude_md "$SHARED_DIR"
90
+
91
+ # Always include shared skills
92
+ copy_skills "$SHARED_SKILLS_DIR"
34
93
 
35
94
  # Inheritance handling
36
95
  case "$ENV_TYPE" in
37
96
  frontend)
38
97
  copy_rules "$FRONTEND_DIR"
98
+ append_to_claude_md "$FRONTEND_DIR"
39
99
  ;;
40
100
  backend)
41
101
  copy_rules "$BACKEND_DIR"
102
+ append_to_claude_md "$BACKEND_DIR"
42
103
  ;;
43
104
  frontend-lib)
44
105
  copy_rules "$FRONTEND_DIR"
45
106
  copy_rules "$FRONTEND_LIB_DIR"
107
+ append_to_claude_md "$FRONTEND_DIR"
108
+ append_to_claude_md "$FRONTEND_LIB_DIR"
46
109
  ;;
47
110
  *)
48
111
  echo "Unknown environment type: $ENV_TYPE"
@@ -50,4 +113,16 @@ case "$ENV_TYPE" in
50
113
  ;;
51
114
  esac
52
115
 
53
- echo ".cursor/rules setup complete for '$ENV_TYPE'"
116
+ # Generate CLAUDE.md
117
+ mv "$CLAUDE_MD_TEMP" CLAUDE.md
118
+ trap - EXIT
119
+ echo "CLAUDE.md generated for Claude Code"
120
+
121
+ if [ -d ".cursor/skills" ] && [ "$(ls -A .cursor/skills 2>/dev/null)" ]; then
122
+ echo "Skills installed in:"
123
+ echo " - .cursor/skills/ (Cursor)"
124
+ echo " - .claude/skills/ (Claude Code)"
125
+ echo " - .codex/skills/ (Codex)"
126
+ fi
127
+
128
+ echo "Setup complete for '$ENV_TYPE' (Cursor + Claude + Codex)"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mallardbay/cursor-rules",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "description": "Mallard Bay shared cursor rules",
5
5
  "main": "bin/setup-cursor.sh",
6
6
  "repository": "git@github.com:mallardbay/cursor-rules.git",