@avisek_yorkie/cursor-rules 1.0.0
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/.cursorrules +153 -0
- package/README.md +291 -0
- package/SETUP.md +122 -0
- package/package.json +28 -0
- package/rules/code-quality.mdc +417 -0
- package/rules/documentation.mdc +411 -0
- package/rules/naming-conventions.mdc +291 -0
package/.cursorrules
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# Cursor Rules - Generic Tech Stack
|
|
2
|
+
|
|
3
|
+
This file contains comprehensive coding rules that apply to any technology stack. These rules are designed to ensure code quality, maintainability, and consistency across all projects.
|
|
4
|
+
|
|
5
|
+
## How to Use These Rules
|
|
6
|
+
|
|
7
|
+
1. Copy this `.cursorrules` file to your project root
|
|
8
|
+
2. Copy the rule files from the `rules/` folder (code-quality.mdc, documentation.mdc, naming-conventions.mdc) to your project root
|
|
9
|
+
3. Cursor will automatically apply these rules when assisting with code
|
|
10
|
+
|
|
11
|
+
## Rule Categories
|
|
12
|
+
|
|
13
|
+
### 1. Code Quality (rules/code-quality.mdc)
|
|
14
|
+
- Clean code standards
|
|
15
|
+
- Error handling
|
|
16
|
+
- Security best practices
|
|
17
|
+
- Performance considerations
|
|
18
|
+
- Code complexity management
|
|
19
|
+
- Testing requirements
|
|
20
|
+
|
|
21
|
+
### 2. Documentation (rules/documentation.mdc)
|
|
22
|
+
- Code documentation standards
|
|
23
|
+
- README requirements
|
|
24
|
+
- API documentation
|
|
25
|
+
- Architecture documentation
|
|
26
|
+
- Inline comments guidelines
|
|
27
|
+
|
|
28
|
+
### 3. Naming Conventions (rules/naming-conventions.mdc)
|
|
29
|
+
- Variable and function naming
|
|
30
|
+
- Class and type naming
|
|
31
|
+
- File and directory naming
|
|
32
|
+
- Language-specific conventions
|
|
33
|
+
- Database and API naming
|
|
34
|
+
|
|
35
|
+
## Core Principles
|
|
36
|
+
|
|
37
|
+
### Code Quality
|
|
38
|
+
- Write self-documenting code
|
|
39
|
+
- Keep functions small and focused (20-30 lines ideal)
|
|
40
|
+
- Handle errors explicitly
|
|
41
|
+
- Validate all inputs
|
|
42
|
+
- Follow security best practices
|
|
43
|
+
- Maintain low complexity
|
|
44
|
+
- Write comprehensive tests
|
|
45
|
+
|
|
46
|
+
### Documentation
|
|
47
|
+
- Document all public APIs
|
|
48
|
+
- Keep README files comprehensive and up-to-date
|
|
49
|
+
- Use appropriate documentation tools
|
|
50
|
+
- Include code examples
|
|
51
|
+
- Maintain changelogs
|
|
52
|
+
|
|
53
|
+
### Naming
|
|
54
|
+
- Use descriptive names that reveal intent
|
|
55
|
+
- Follow language-specific conventions
|
|
56
|
+
- Be consistent throughout the codebase
|
|
57
|
+
- Avoid abbreviations and generic names
|
|
58
|
+
- Use appropriate prefixes for booleans
|
|
59
|
+
|
|
60
|
+
## Language-Specific Guidelines
|
|
61
|
+
|
|
62
|
+
### JavaScript/TypeScript
|
|
63
|
+
- Use `const` over `let`, avoid `var`
|
|
64
|
+
- Use `===` instead of `==`
|
|
65
|
+
- Prefer async/await over promise chains
|
|
66
|
+
- Use arrow functions for callbacks
|
|
67
|
+
- Follow camelCase for variables/functions
|
|
68
|
+
- Use PascalCase for classes/interfaces
|
|
69
|
+
|
|
70
|
+
### Python
|
|
71
|
+
- Follow PEP 8 style guide
|
|
72
|
+
- Use snake_case for variables/functions
|
|
73
|
+
- Use PascalCase for classes
|
|
74
|
+
- Use type hints where applicable
|
|
75
|
+
- Follow the Zen of Python
|
|
76
|
+
|
|
77
|
+
### Java
|
|
78
|
+
- Follow Java naming conventions
|
|
79
|
+
- Use camelCase for variables/methods
|
|
80
|
+
- Use PascalCase for classes
|
|
81
|
+
- Handle checked exceptions appropriately
|
|
82
|
+
- Prefer composition over inheritance
|
|
83
|
+
|
|
84
|
+
### Go
|
|
85
|
+
- Follow Go naming conventions
|
|
86
|
+
- Handle all errors explicitly
|
|
87
|
+
- Use interfaces for abstraction
|
|
88
|
+
- Keep functions small and focused
|
|
89
|
+
- Export only what's necessary
|
|
90
|
+
|
|
91
|
+
## Code Review Checklist
|
|
92
|
+
|
|
93
|
+
Before submitting code, ensure:
|
|
94
|
+
- [ ] Code follows all naming conventions
|
|
95
|
+
- [ ] All public APIs are documented
|
|
96
|
+
- [ ] Error handling is appropriate
|
|
97
|
+
- [ ] Input validation is present
|
|
98
|
+
- [ ] No security vulnerabilities
|
|
99
|
+
- [ ] No hardcoded values
|
|
100
|
+
- [ ] Functions are small and focused
|
|
101
|
+
- [ ] Tests are included and passing
|
|
102
|
+
- [ ] No unused imports or dead code
|
|
103
|
+
- [ ] README is updated if needed
|
|
104
|
+
|
|
105
|
+
## Quick Reference
|
|
106
|
+
|
|
107
|
+
### Function/Method Guidelines
|
|
108
|
+
- Maximum length: 50 lines (ideally 20-30)
|
|
109
|
+
- Single responsibility
|
|
110
|
+
- Clear, descriptive names
|
|
111
|
+
- Proper error handling
|
|
112
|
+
- Input validation
|
|
113
|
+
|
|
114
|
+
### Variable Naming
|
|
115
|
+
- Descriptive nouns or noun phrases
|
|
116
|
+
- Avoid abbreviations
|
|
117
|
+
- Use appropriate prefixes for booleans (`is`, `has`, `can`)
|
|
118
|
+
- Be specific, not generic
|
|
119
|
+
|
|
120
|
+
### Documentation
|
|
121
|
+
- Document all public APIs
|
|
122
|
+
- Include parameter and return types
|
|
123
|
+
- Provide usage examples
|
|
124
|
+
- Keep documentation up-to-date
|
|
125
|
+
|
|
126
|
+
### Security
|
|
127
|
+
- Never hardcode secrets
|
|
128
|
+
- Validate and sanitize inputs
|
|
129
|
+
- Use parameterized queries
|
|
130
|
+
- Keep dependencies updated
|
|
131
|
+
|
|
132
|
+
## Integration with Projects
|
|
133
|
+
|
|
134
|
+
To use these rules in a specific project:
|
|
135
|
+
|
|
136
|
+
1. **Copy the rules**: Copy `.cursorrules` and the `.mdc` files from `rules/` to your project root
|
|
137
|
+
2. **Customize if needed**: Add project-specific rules while maintaining these core principles
|
|
138
|
+
3. **Team alignment**: Ensure your team is aware of and follows these rules
|
|
139
|
+
4. **Code reviews**: Use the checklists during code reviews
|
|
140
|
+
5. **CI/CD**: Consider adding linting rules that enforce these standards
|
|
141
|
+
|
|
142
|
+
## Maintenance
|
|
143
|
+
|
|
144
|
+
- Review and update rules periodically
|
|
145
|
+
- Add language-specific rules as needed
|
|
146
|
+
- Keep rules generic and applicable across projects
|
|
147
|
+
- Remove outdated or conflicting rules
|
|
148
|
+
- Document any project-specific exceptions
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
**Note**: These rules are designed to be generic and applicable to any technology stack. Customize them for your specific project needs while maintaining the core principles.
|
|
153
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
# Cursor Rules - Generic Tech Stack
|
|
2
|
+
|
|
3
|
+
This directory contains comprehensive cursor rules designed to work with any technology stack. These rules help maintain code quality, consistency, and best practices across all your projects.
|
|
4
|
+
|
|
5
|
+
## 📁 Directory Structure
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
cursor-rules/
|
|
9
|
+
├── rules/
|
|
10
|
+
│ ├── code-quality.mdc # Code quality standards and best practices
|
|
11
|
+
│ ├── documentation.mdc # Documentation standards and guidelines
|
|
12
|
+
│ ├── naming-conventions.mdc # Naming conventions (JS/TS)
|
|
13
|
+
├── .cursorrules # Main cursor rules file (copy to project root)
|
|
14
|
+
├── README.md
|
|
15
|
+
└── SETUP.md
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## 🚀 Quick Start
|
|
19
|
+
|
|
20
|
+
### Step 1: Install (optional)
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install @avisek_yorkie/cursor-rules
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Step 2: Copy Rules to Your Project
|
|
27
|
+
|
|
28
|
+
Copy the `.cursorrules` file and all rule files from `rules/` to your project root:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# From your project root (after npm install @avisek_yorkie/cursor-rules)
|
|
32
|
+
cp node_modules/@avisek_yorkie/cursor-rules/.cursorrules .
|
|
33
|
+
cp node_modules/@avisek_yorkie/cursor-rules/rules/*.mdc .
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Or from a local clone:
|
|
37
|
+
```bash
|
|
38
|
+
cp /path/to/cursor-rules/.cursorrules .
|
|
39
|
+
cp /path/to/cursor-rules/rules/*.mdc .
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Manual copy:
|
|
43
|
+
- `.cursorrules` → Your project root
|
|
44
|
+
- `rules/code-quality.mdc` → Your project root (as `code-quality.mdc`)
|
|
45
|
+
- `rules/documentation.mdc` → Your project root (as `documentation.mdc`)
|
|
46
|
+
- `rules/naming-conventions.mdc` → Your project root (as `naming-conventions.mdc`)
|
|
47
|
+
|
|
48
|
+
### Step 3: Verify Integration
|
|
49
|
+
|
|
50
|
+
Cursor will automatically detect and use the `.cursorrules` file in your project root. The rules will be applied when:
|
|
51
|
+
- Writing new code
|
|
52
|
+
- Refactoring existing code
|
|
53
|
+
- Code completion suggestions
|
|
54
|
+
- Code review assistance
|
|
55
|
+
|
|
56
|
+
### Step 4: Customize (Optional)
|
|
57
|
+
|
|
58
|
+
You can customize these rules for your specific project by:
|
|
59
|
+
- Adding project-specific rules to `.cursorrules`
|
|
60
|
+
- Modifying the `.mdc` files to include team-specific conventions
|
|
61
|
+
- Adding language-specific rules for your tech stack
|
|
62
|
+
|
|
63
|
+
## 📚 Rule Files Overview
|
|
64
|
+
|
|
65
|
+
### 1. Code Quality (`rules/code-quality.mdc`)
|
|
66
|
+
|
|
67
|
+
Covers:
|
|
68
|
+
- ✅ Clean code standards
|
|
69
|
+
- ✅ Error handling best practices
|
|
70
|
+
- ✅ Security guidelines
|
|
71
|
+
- ✅ Performance considerations
|
|
72
|
+
- ✅ Code complexity management
|
|
73
|
+
- ✅ Testing requirements
|
|
74
|
+
- ✅ Language-specific guidelines
|
|
75
|
+
|
|
76
|
+
**Key Principles:**
|
|
77
|
+
- Functions should be 20-30 lines (max 50)
|
|
78
|
+
- Always handle errors explicitly
|
|
79
|
+
- Validate all inputs
|
|
80
|
+
- Never hardcode secrets
|
|
81
|
+
- Keep cyclomatic complexity low
|
|
82
|
+
|
|
83
|
+
### 2. Documentation (`rules/documentation.mdc`)
|
|
84
|
+
|
|
85
|
+
Covers:
|
|
86
|
+
- ✅ Function/method documentation standards
|
|
87
|
+
- ✅ README file requirements
|
|
88
|
+
- ✅ API documentation guidelines
|
|
89
|
+
- ✅ Architecture documentation
|
|
90
|
+
- ✅ Inline comments best practices
|
|
91
|
+
- ✅ Documentation tools and generators
|
|
92
|
+
|
|
93
|
+
**Key Principles:**
|
|
94
|
+
- Document all public APIs
|
|
95
|
+
- Write self-documenting code
|
|
96
|
+
- Include code examples
|
|
97
|
+
- Keep documentation up-to-date
|
|
98
|
+
- Use appropriate documentation tools
|
|
99
|
+
|
|
100
|
+
### 3. Naming Conventions (`rules/naming-conventions.mdc`)
|
|
101
|
+
|
|
102
|
+
Covers:
|
|
103
|
+
- ✅ Variable and function naming
|
|
104
|
+
- ✅ Class and type naming
|
|
105
|
+
- ✅ File and directory naming
|
|
106
|
+
- ✅ TypeScript/JavaScript conventions
|
|
107
|
+
- ✅ Database naming
|
|
108
|
+
- ✅ API endpoint naming
|
|
109
|
+
- ✅ Configuration naming
|
|
110
|
+
|
|
111
|
+
**Key Principles:**
|
|
112
|
+
- Use descriptive names that reveal intent
|
|
113
|
+
- Follow language-specific conventions
|
|
114
|
+
- Be consistent throughout codebase
|
|
115
|
+
- Avoid abbreviations and generic names
|
|
116
|
+
- Use appropriate prefixes for booleans
|
|
117
|
+
|
|
118
|
+
## 🎯 Usage Examples
|
|
119
|
+
|
|
120
|
+
### Example 1: Starting a New Project
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# Create new project
|
|
124
|
+
mkdir my-new-project
|
|
125
|
+
cd my-new-project
|
|
126
|
+
|
|
127
|
+
# Copy cursor rules
|
|
128
|
+
cp node_modules/@avisek_yorkie/cursor-rules/.cursorrules .
|
|
129
|
+
cp node_modules/@avisek_yorkie/cursor-rules/rules/*.mdc .
|
|
130
|
+
|
|
131
|
+
# Initialize your project (npm, pip, etc.)
|
|
132
|
+
npm init -y # or your package manager
|
|
133
|
+
|
|
134
|
+
# Start coding - Cursor will apply the rules automatically!
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Example 2: Adding Rules to Existing Project
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
# Navigate to your project
|
|
141
|
+
cd /path/to/your/project
|
|
142
|
+
|
|
143
|
+
# Copy rules (backup existing .cursorrules if present)
|
|
144
|
+
cp node_modules/@avisek_yorkie/cursor-rules/.cursorrules .
|
|
145
|
+
cp node_modules/@avisek_yorkie/cursor-rules/rules/*.mdc .
|
|
146
|
+
|
|
147
|
+
# Review and merge with existing rules if needed
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Example 3: Publishing NPM Package
|
|
151
|
+
|
|
152
|
+
When publishing an npm package, these rules ensure:
|
|
153
|
+
- ✅ Proper documentation in README
|
|
154
|
+
- ✅ Consistent naming conventions
|
|
155
|
+
- ✅ High code quality
|
|
156
|
+
- ✅ Proper error handling
|
|
157
|
+
- ✅ Security best practices
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
# Your package will follow all rules automatically
|
|
161
|
+
npm publish
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## 🔧 Customization Guide
|
|
165
|
+
|
|
166
|
+
### Adding Project-Specific Rules
|
|
167
|
+
|
|
168
|
+
Edit `.cursorrules` to add project-specific rules:
|
|
169
|
+
|
|
170
|
+
```markdown
|
|
171
|
+
# Project-Specific Rules
|
|
172
|
+
|
|
173
|
+
## React/React Native Specific
|
|
174
|
+
- Always use functional components
|
|
175
|
+
- Add testID to interactive components
|
|
176
|
+
- Use hooks for state management
|
|
177
|
+
|
|
178
|
+
## Your Custom Rules
|
|
179
|
+
- Follow our internal API conventions
|
|
180
|
+
- Use our design system components
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Language-Specific Customization
|
|
184
|
+
|
|
185
|
+
Edit the appropriate `.mdc` file to add language-specific rules:
|
|
186
|
+
|
|
187
|
+
```markdown
|
|
188
|
+
# In rules/code-quality.mdc
|
|
189
|
+
|
|
190
|
+
### Your Language
|
|
191
|
+
- Follow your language style guide
|
|
192
|
+
- Use your preferred linter configuration
|
|
193
|
+
- Follow your team's conventions
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## 📋 Code Review Checklist
|
|
197
|
+
|
|
198
|
+
Use this checklist during code reviews:
|
|
199
|
+
|
|
200
|
+
### Code Quality
|
|
201
|
+
- [ ] Functions are small and focused (20-30 lines)
|
|
202
|
+
- [ ] All errors are handled appropriately
|
|
203
|
+
- [ ] Input validation is present
|
|
204
|
+
- [ ] No security vulnerabilities
|
|
205
|
+
- [ ] No hardcoded secrets or values
|
|
206
|
+
- [ ] Code complexity is manageable
|
|
207
|
+
|
|
208
|
+
### Documentation
|
|
209
|
+
- [ ] All public APIs are documented
|
|
210
|
+
- [ ] README is complete and up-to-date
|
|
211
|
+
- [ ] Code examples are included where needed
|
|
212
|
+
- [ ] Comments explain "why" not "what"
|
|
213
|
+
|
|
214
|
+
### Naming
|
|
215
|
+
- [ ] Names are descriptive and reveal intent
|
|
216
|
+
- [ ] Follows language-specific conventions
|
|
217
|
+
- [ ] Consistent throughout codebase
|
|
218
|
+
- [ ] Boolean names use appropriate prefixes
|
|
219
|
+
- [ ] No abbreviations or generic names
|
|
220
|
+
|
|
221
|
+
## 🌐 Supported Stack
|
|
222
|
+
|
|
223
|
+
These rules target **JavaScript/TypeScript** (Node.js, React, React Native, Vue, Angular, etc.). Core principles are universal; conventions are JS/TS-specific.
|
|
224
|
+
|
|
225
|
+
## 🔄 Maintenance
|
|
226
|
+
|
|
227
|
+
### Updating Rules
|
|
228
|
+
|
|
229
|
+
1. Edit the `.mdc` files as needed
|
|
230
|
+
2. Update `.cursorrules` if structure changes
|
|
231
|
+
3. Test rules in a sample project
|
|
232
|
+
4. Document any breaking changes
|
|
233
|
+
|
|
234
|
+
### Version Control
|
|
235
|
+
|
|
236
|
+
Consider versioning your rules:
|
|
237
|
+
- Tag releases: `v1.0.0`, `v1.1.0`, etc.
|
|
238
|
+
- Document changes in CHANGELOG
|
|
239
|
+
- Keep rules in sync across projects
|
|
240
|
+
|
|
241
|
+
## 📖 Best Practices
|
|
242
|
+
|
|
243
|
+
1. **Start Early**: Add rules at project inception
|
|
244
|
+
2. **Team Alignment**: Ensure all team members use the same rules
|
|
245
|
+
3. **Regular Review**: Review and update rules quarterly
|
|
246
|
+
4. **Consistency**: Use the same rules across all projects
|
|
247
|
+
5. **Documentation**: Document any project-specific exceptions
|
|
248
|
+
|
|
249
|
+
## 🐛 Troubleshooting
|
|
250
|
+
|
|
251
|
+
### Rules Not Being Applied
|
|
252
|
+
|
|
253
|
+
1. Check that `.cursorrules` is in project root
|
|
254
|
+
2. Verify `.mdc` files are in project root (copied from `rules/`)
|
|
255
|
+
3. Restart Cursor if needed
|
|
256
|
+
4. Check for syntax errors in rule files
|
|
257
|
+
|
|
258
|
+
### Conflicts with Existing Rules
|
|
259
|
+
|
|
260
|
+
1. Review existing `.cursorrules` in your project
|
|
261
|
+
2. Merge rules carefully
|
|
262
|
+
3. Test in a sample file
|
|
263
|
+
4. Document any conflicts resolved
|
|
264
|
+
|
|
265
|
+
## 📝 License
|
|
266
|
+
|
|
267
|
+
These rules are provided as-is for use in your projects. Customize as needed for your team and organization.
|
|
268
|
+
|
|
269
|
+
## 🤝 Contributing
|
|
270
|
+
|
|
271
|
+
To improve these generic rules:
|
|
272
|
+
|
|
273
|
+
1. Test changes in multiple projects
|
|
274
|
+
2. Ensure rules remain generic (not project-specific)
|
|
275
|
+
3. Document language-specific additions
|
|
276
|
+
4. Keep examples clear and practical
|
|
277
|
+
|
|
278
|
+
## 📞 Support
|
|
279
|
+
|
|
280
|
+
For questions or issues:
|
|
281
|
+
- Review the rule files for detailed guidelines
|
|
282
|
+
- Check language-specific sections
|
|
283
|
+
- Customize rules for your needs
|
|
284
|
+
- Consult your team's coding standards
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
**Happy Coding! 🚀**
|
|
289
|
+
|
|
290
|
+
These rules will help you maintain high-quality, consistent code across all your projects, regardless of the technology stack.
|
|
291
|
+
|
package/SETUP.md
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# Quick Setup Guide
|
|
2
|
+
|
|
3
|
+
## 🎯 Step-by-Step Setup for Your NPM Package (or Any Project)
|
|
4
|
+
|
|
5
|
+
### Step 0: Get the Rules (choose one)
|
|
6
|
+
|
|
7
|
+
**From npm:**
|
|
8
|
+
```bash
|
|
9
|
+
npm install @avisek_yorkie/cursor-rules
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
**Or clone the repo** and use the path to your local `cursor-rules` folder in the steps below.
|
|
13
|
+
|
|
14
|
+
### Step 1: Navigate to Your Project
|
|
15
|
+
```bash
|
|
16
|
+
cd /path/to/your/project
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Step 2: Copy Cursor Rules
|
|
20
|
+
|
|
21
|
+
**From the package (after `npm install @avisek_yorkie/cursor-rules`):**
|
|
22
|
+
```bash
|
|
23
|
+
cp node_modules/@avisek_yorkie/cursor-rules/.cursorrules .
|
|
24
|
+
cp node_modules/@avisek_yorkie/cursor-rules/rules/*.mdc .
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**From a local clone:**
|
|
28
|
+
```bash
|
|
29
|
+
# Copy main file and all rule files to your project root
|
|
30
|
+
cp /path/to/cursor-rules/.cursorrules .
|
|
31
|
+
cp /path/to/cursor-rules/rules/*.mdc .
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Step 3: Verify Files Are in Place
|
|
35
|
+
```bash
|
|
36
|
+
ls -la .cursorrules *.mdc
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
You should see:
|
|
40
|
+
- `.cursorrules`
|
|
41
|
+
- `code-quality.mdc`
|
|
42
|
+
- `documentation.mdc`
|
|
43
|
+
- `naming-conventions.mdc`
|
|
44
|
+
|
|
45
|
+
### Step 4: Restart Cursor (Optional)
|
|
46
|
+
Close and reopen Cursor to ensure rules are loaded.
|
|
47
|
+
|
|
48
|
+
### Step 5: Test the Rules
|
|
49
|
+
Create a test file and ask Cursor to help you write code. The rules will be automatically applied!
|
|
50
|
+
|
|
51
|
+
## 📦 For NPM Package Publishing
|
|
52
|
+
|
|
53
|
+
### Before Publishing Checklist
|
|
54
|
+
|
|
55
|
+
1. **Code Quality**
|
|
56
|
+
- [ ] All functions are under 50 lines
|
|
57
|
+
- [ ] Error handling is implemented
|
|
58
|
+
- [ ] Input validation is present
|
|
59
|
+
- [ ] No hardcoded secrets
|
|
60
|
+
|
|
61
|
+
2. **Documentation**
|
|
62
|
+
- [ ] README.md is complete
|
|
63
|
+
- [ ] All public APIs are documented
|
|
64
|
+
- [ ] Code examples are included
|
|
65
|
+
- [ ] Installation instructions are clear
|
|
66
|
+
|
|
67
|
+
3. **Naming**
|
|
68
|
+
- [ ] All names follow conventions
|
|
69
|
+
- [ ] Consistent naming throughout
|
|
70
|
+
- [ ] No abbreviations or generic names
|
|
71
|
+
|
|
72
|
+
### Publishing Command
|
|
73
|
+
```bash
|
|
74
|
+
npm publish
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## 📤 Publishing This Package to npm
|
|
78
|
+
|
|
79
|
+
To publish **this** cursor-rules package to npm:
|
|
80
|
+
|
|
81
|
+
1. **Create an npm account** (if you don’t have one): [https://www.npmjs.com/signup](https://www.npmjs.com/signup)
|
|
82
|
+
|
|
83
|
+
2. **Log in from the terminal:**
|
|
84
|
+
```bash
|
|
85
|
+
npm login
|
|
86
|
+
```
|
|
87
|
+
npm will print a **login URL**. Open it in your browser, sign in (or create an account), then return to the terminal—you’ll be logged in. Use a one-time password in the browser if you have 2FA enabled.
|
|
88
|
+
|
|
89
|
+
4. **From this project root, publish:**
|
|
90
|
+
```bash
|
|
91
|
+
cd /path/to/cursor-rules
|
|
92
|
+
npm publish
|
|
93
|
+
```
|
|
94
|
+
The package is scoped as `@avisek_yorkie/cursor-rules` and `publishConfig.access` is set to `"public"`, so it will be published as a public package.
|
|
95
|
+
|
|
96
|
+
5. **After publish**, anyone can install with:
|
|
97
|
+
```bash
|
|
98
|
+
npm install @avisek_yorkie/cursor-rules
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## 🔄 Updating Rules
|
|
102
|
+
|
|
103
|
+
If you update the rules (or upgrade the package), sync them to your project:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
# From your project root (when using npm package)
|
|
107
|
+
cp node_modules/@avisek_yorkie/cursor-rules/.cursorrules .
|
|
108
|
+
cp node_modules/@avisek_yorkie/cursor-rules/rules/*.mdc .
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## ✅ Verification
|
|
112
|
+
|
|
113
|
+
To verify rules are working:
|
|
114
|
+
1. Ask Cursor to write a function
|
|
115
|
+
2. Check that it follows naming conventions
|
|
116
|
+
3. Verify error handling is included
|
|
117
|
+
4. Confirm documentation is added
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
**That's it!** Your project now has comprehensive cursor rules that will help maintain code quality across any tech stack.
|
|
122
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@avisek_yorkie/cursor-rules",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Cursor AI rules for code quality, documentation, and naming conventions (JS/TS)",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"cursor",
|
|
7
|
+
"cursor-rules",
|
|
8
|
+
"code-quality",
|
|
9
|
+
"documentation",
|
|
10
|
+
"naming-conventions",
|
|
11
|
+
"javascript",
|
|
12
|
+
"typescript"
|
|
13
|
+
],
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/avisek41/cursor-rules-js-ts.git"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"rules",
|
|
21
|
+
"README.md",
|
|
22
|
+
"SETUP.md",
|
|
23
|
+
".cursorrules"
|
|
24
|
+
],
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
}
|
|
28
|
+
}
|