@mallardbay/cursor-rules 1.0.30 → 1.0.32
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.
|
@@ -14,7 +14,9 @@ alwaysApply: false
|
|
|
14
14
|
- Functions: camelCase
|
|
15
15
|
- Constants: UPPER_SNAKE_CASE
|
|
16
16
|
- Types: PascalCase
|
|
17
|
-
-
|
|
17
|
+
- Exported functions/components should be defined before non-exported helpers
|
|
18
|
+
- Types should be defined at the bottom of files or moved into separate `types` files when reused across files
|
|
19
|
+
- Keep React component props near component definitions for readability
|
|
18
20
|
- PropTypes should be defined before component definitions
|
|
19
21
|
- Prefer using alias for importing components. Only use relative for tests or when there's a direct sibling
|
|
20
22
|
|
|
@@ -69,6 +69,12 @@ These principles apply to all code changes and should guide every implementation
|
|
|
69
69
|
### Testing and Linting
|
|
70
70
|
- **Lint and test files related to your changes** before completing work
|
|
71
71
|
- Run linters on modified files and fix issues
|
|
72
|
+
- Use `yarn lint:quiet` for quick iterations
|
|
73
|
+
- Use `yarn lint:quiet:slow` for deeper checks but slower when wrapping up
|
|
74
|
+
- **Never disable eslint rules** to make lint errors go away—fix the underlying issues instead
|
|
75
|
+
- Do not add `eslint-disable` comments unless there's a legitimate, documented reason
|
|
76
|
+
- Do not modify eslint config files to disable rules that are flagging real problems
|
|
77
|
+
- If a rule seems incorrect, investigate why it exists and fix the code properly
|
|
72
78
|
- Run tests for affected modules, not the entire test suite unnecessarily
|
|
73
79
|
- For large changes: **use test sharding**—split tests across multiple runs
|
|
74
80
|
- **Do not run all tests in parallel** when dealing with many changes
|
|
@@ -108,11 +114,18 @@ These principles apply to all code changes and should guide every implementation
|
|
|
108
114
|
4. **Check git history** to understand why code exists as it does
|
|
109
115
|
5. **Identify related files** that might be affected
|
|
110
116
|
6. **Ask clarifying questions** if requirements are unclear
|
|
117
|
+
7. **Use MCP servers when available**—leverage Model Context Protocol servers for enhanced capabilities
|
|
118
|
+
- **Context7 MCP**: Use the context7 MCP server when available to retrieve up-to-date documentation and code examples for libraries
|
|
119
|
+
- If context7 MCP is not available, suggest adding it to improve access to library documentation
|
|
120
|
+
- **Suggest useful MCP servers**: When appropriate, suggest popular and useful MCP servers that could enhance development workflow based on the task at hand
|
|
121
|
+
- Consider MCP servers for documentation, testing, debugging, and other development tasks
|
|
111
122
|
|
|
112
123
|
### During Implementation
|
|
113
124
|
1. Make **small, incremental changes**
|
|
114
125
|
2. **Test as you go**—verify each change works before moving on
|
|
115
126
|
3. **Lint frequently**—don't accumulate lint errors
|
|
127
|
+
- Use `yarn lint:quiet` for quick iterations
|
|
128
|
+
- Use `yarn lint:quiet:slow` for deeper checks when wrapping up
|
|
116
129
|
4. **Follow existing patterns**—don't reinvent the wheel
|
|
117
130
|
5. **Use semantic names**—code should be self-documenting
|
|
118
131
|
6. **Keep functions focused**—one responsibility per function
|
|
@@ -122,6 +135,8 @@ These principles apply to all code changes and should guide every implementation
|
|
|
122
135
|
1. **Clean up failed attempts**—remove experimental code
|
|
123
136
|
2. **Remove unused code**—imports, variables, functions
|
|
124
137
|
3. **Run linters** on modified files
|
|
138
|
+
- Use `yarn lint:quiet` for quick iterations
|
|
139
|
+
- Use `yarn lint:quiet:slow` for deeper checks when wrapping up
|
|
125
140
|
4. **Run relevant tests**—not the entire suite unless necessary
|
|
126
141
|
5. **Verify the change works** end-to-end
|
|
127
142
|
6. **Check for side effects**—ensure changes don't break unrelated code
|
|
@@ -143,6 +158,7 @@ These principles apply to all code changes and should guide every implementation
|
|
|
143
158
|
- ❌ Functions that do multiple unrelated things
|
|
144
159
|
- ❌ Leaving commented-out code or debugging statements
|
|
145
160
|
- ❌ Skipping tests or linting "to save time"
|
|
161
|
+
- ❌ Disabling eslint rules instead of fixing the underlying issues
|
|
146
162
|
- ❌ Running entire test suite for small changes
|
|
147
163
|
- ❌ Leaving experimental code after failed attempts
|
|
148
164
|
- ❌ Premature optimization without profiling
|
|
@@ -14,7 +14,9 @@ Be as strictly as possible where it delivers clear value—specifically in preve
|
|
|
14
14
|
|
|
15
15
|
### File Organization
|
|
16
16
|
|
|
17
|
-
-
|
|
17
|
+
- Keep exported functions/components before non-exported helpers
|
|
18
|
+
- Place most types at the bottom of files or in separate `types` files when shared across files
|
|
19
|
+
- Keep React component props near the component definition for readability
|
|
18
20
|
- Define PropTypes before component definitions
|
|
19
21
|
|
|
20
22
|
## Best Practices
|
|
@@ -7,6 +7,14 @@ alwaysApply: true
|
|
|
7
7
|
|
|
8
8
|
These principles apply to all code changes and should guide every implementation decision.
|
|
9
9
|
|
|
10
|
+
## Project Setup
|
|
11
|
+
|
|
12
|
+
- Install dependencies with `yarn`
|
|
13
|
+
- Run the project locally with `yarn start`
|
|
14
|
+
- Run tests with `yarn test`
|
|
15
|
+
- For large test suites, use sharding: `JEST_SHARD=1/n yarn test` where `n` is the total number of shards (never more than 10)
|
|
16
|
+
- Example: `JEST_SHARD=1/3 yarn test`, `JEST_SHARD=2/3 yarn test`, `JEST_SHARD=3/3 yarn test`
|
|
17
|
+
|
|
10
18
|
## Core Principles
|
|
11
19
|
|
|
12
20
|
### DRY (Don't Repeat Yourself)
|
|
@@ -75,8 +83,8 @@ These principles apply to all code changes and should guide every implementation
|
|
|
75
83
|
- Do not add `eslint-disable` comments unless there's a legitimate, documented reason
|
|
76
84
|
- Do not modify eslint config files to disable rules that are flagging real problems
|
|
77
85
|
- If a rule seems incorrect, investigate why it exists and fix the code properly
|
|
78
|
-
- Run tests for affected modules, not the entire test suite unnecessarily
|
|
79
|
-
- For large changes: **use test sharding
|
|
86
|
+
- Run tests with `yarn test` for affected modules, not the entire test suite unnecessarily
|
|
87
|
+
- For large changes: **use test sharding** via `JEST_SHARD=1/n yarn test`—split tests across multiple shards (never more than 10)
|
|
80
88
|
- **Do not run all tests in parallel** when dealing with many changes
|
|
81
89
|
- Tests should be **clear, fast, and minimize setup duplication**
|
|
82
90
|
- Use shared test utilities and fixtures to reduce boilerplate
|
|
@@ -143,7 +151,7 @@ These principles apply to all code changes and should guide every implementation
|
|
|
143
151
|
|
|
144
152
|
### When Changes Are Large
|
|
145
153
|
1. **Consider splitting** into multiple smaller PRs
|
|
146
|
-
2. **Use test sharding
|
|
154
|
+
2. **Use test sharding** (`JEST_SHARD=1/n yarn test`)—run tests in batches, not all at once (max 10 shards)
|
|
147
155
|
3. **Review incrementally**—make sure each part works before moving on
|
|
148
156
|
4. **Document the approach**—explain why changes are structured this way
|
|
149
157
|
5. **Check impact** on related systems and files
|
package/README.md
CHANGED
|
@@ -112,10 +112,28 @@ your-project/
|
|
|
112
112
|
└── AGENTS.md # Codex IDE configuration (combined rules)
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
-
Both `CLAUDE.md` and `AGENTS.md` combine all applicable rules into single files, with YAML frontmatter stripped for compatibility. Each file
|
|
115
|
+
Both `CLAUDE.md` and `AGENTS.md` combine all applicable rules into single files, with YAML frontmatter stripped for compatibility. Each file opens with a header comment that states the file is **auto-generated** (do not edit by hand) and that **project-specific rules** belong in `AGENTS_LOCAL.md`, plus which tool consumes the file.
|
|
116
116
|
|
|
117
117
|
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.
|
|
118
118
|
|
|
119
|
+
### Project-Local Rules (`AGENTS_LOCAL.md`)
|
|
120
|
+
|
|
121
|
+
If your project needs additional rules beyond what the shared configuration provides, create an `AGENTS_LOCAL.md` file in your project root. Its content will be automatically appended to both `CLAUDE.md` and `AGENTS.md` when the setup script runs.
|
|
122
|
+
|
|
123
|
+
This is useful for:
|
|
124
|
+
- Project-specific conventions or architectural decisions
|
|
125
|
+
- Team-level overrides or additions
|
|
126
|
+
- Context that only applies to a single repository
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
your-project/
|
|
130
|
+
├── AGENTS_LOCAL.md # Your project-specific rules (checked into version control)
|
|
131
|
+
├── CLAUDE.md # Generated (includes AGENTS_LOCAL.md content)
|
|
132
|
+
└── AGENTS.md # Generated (includes AGENTS_LOCAL.md content)
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
`AGENTS_LOCAL.md` is meant to be checked into version control, while `CLAUDE.md` and `AGENTS.md` are generated and should be gitignored.
|
|
136
|
+
|
|
119
137
|
## Development
|
|
120
138
|
|
|
121
139
|
### Adding New Rules
|
package/bin/setup-cursor.sh
CHANGED
|
@@ -92,8 +92,16 @@ This file provides custom instructions and project context for $tool_name.
|
|
|
92
92
|
|
|
93
93
|
$description
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
AUTO-GENERATED — DO NOT EDIT THIS FILE BY HAND. It is produced by
|
|
96
|
+
@mallardbay/cursor-rules when you run the setup script (e.g. npx @mallardbay/cursor-rules <env-type>).
|
|
97
|
+
Any manual changes will be overwritten on the next run.
|
|
98
|
+
|
|
99
|
+
Content sources: shared and environment-specific rules copied into .cursor/rules/ as *.mdc files,
|
|
100
|
+
combined here with YAML frontmatter stripped.
|
|
101
|
+
|
|
102
|
+
PROJECT-SPECIFIC RULES: Add or edit AGENTS_LOCAL.md in the project root (commit that file).
|
|
103
|
+
On the next setup run, its contents are appended to both CLAUDE.md and AGENTS.md. Do not put
|
|
104
|
+
long-lived project-only guidance only in this file — use AGENTS_LOCAL.md instead.
|
|
97
105
|
|
|
98
106
|
For more information:
|
|
99
107
|
- $tool_name: See official documentation
|
|
@@ -226,6 +234,19 @@ case "$ENV_TYPE" in
|
|
|
226
234
|
;;
|
|
227
235
|
esac
|
|
228
236
|
|
|
237
|
+
# Append project-local AGENTS_LOCAL.md if it exists
|
|
238
|
+
if [ -f "$PROJECT_DIR/AGENTS_LOCAL.md" ]; then
|
|
239
|
+
echo "Found AGENTS_LOCAL.md — appending project-local rules"
|
|
240
|
+
echo "" >> "$CLAUDE_MD_TEMP"
|
|
241
|
+
echo "---" >> "$CLAUDE_MD_TEMP"
|
|
242
|
+
echo "" >> "$CLAUDE_MD_TEMP"
|
|
243
|
+
cat "$PROJECT_DIR/AGENTS_LOCAL.md" >> "$CLAUDE_MD_TEMP"
|
|
244
|
+
echo "" >> "$AGENTS_MD_TEMP"
|
|
245
|
+
echo "---" >> "$AGENTS_MD_TEMP"
|
|
246
|
+
echo "" >> "$AGENTS_MD_TEMP"
|
|
247
|
+
cat "$PROJECT_DIR/AGENTS_LOCAL.md" >> "$AGENTS_MD_TEMP"
|
|
248
|
+
fi
|
|
249
|
+
|
|
229
250
|
# Generate both CLAUDE.md and AGENTS.md
|
|
230
251
|
mv "$CLAUDE_MD_TEMP" "$PROJECT_DIR/CLAUDE.md"
|
|
231
252
|
mv "$AGENTS_MD_TEMP" "$PROJECT_DIR/AGENTS.md"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mallardbay/cursor-rules",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.32",
|
|
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",
|
|
@@ -18,6 +18,15 @@
|
|
|
18
18
|
"publishConfig": {
|
|
19
19
|
"access": "public"
|
|
20
20
|
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"test": "echo 'No tests yet'",
|
|
23
|
+
"test:ci": "echo 'No tests yet'",
|
|
24
|
+
"lint:quiet": "echo 'No linting configured yet'",
|
|
25
|
+
"release": "semantic-release"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"semantic-release": "^24.0.0"
|
|
29
|
+
},
|
|
21
30
|
"bin": {
|
|
22
31
|
"cursor-rules": "bin/setup-cursor.sh"
|
|
23
32
|
}
|