Skip to content

Instantly share code, notes, and snippets.

@notquitethereyet
Last active August 8, 2025 00:25
Show Gist options
  • Select an option

  • Save notquitethereyet/081ef3d5117a98b9db7813f285b3ffb6 to your computer and use it in GitHub Desktop.

Select an option

Save notquitethereyet/081ef3d5117a98b9db7813f285b3ffb6 to your computer and use it in GitHub Desktop.
ai-editor-rules
---
description: How to add or edit Cursor rules in our project
globs:
alwaysApply: false
---
# Cursor Rules Location
How to add new cursor rules to the project
1. Always place rule files in PROJECT_ROOT/.cursor/rules/:
```
.cursor/rules/
├── your-rule-name.mdc
├── another-rule.mdc
└── ...
```
2. Follow the naming convention:
- Use kebab-case for filenames
- Always use .mdc extension
- Make names descriptive of the rule's purpose
3. Directory structure:
```
PROJECT_ROOT/
├── .cursor/
│ └── rules/
│ ├── your-rule-name.mdc
│ └── ...
└── ...
```
4. Never place rule files:
- In the project root
- In subdirectories outside .cursor/rules
- In any other location
5. Cursor rules have the following structure:
```
---
description: Short description of the rule's purpose
globs: optional/path/pattern/**/*
alwaysApply: false
---
# Rule Title
Main content explaining the rule with markdown formatting.
1. Step-by-step instructions
2. Code examples
3. Guidelines
Example:
```typescript
// Good example
function goodExample() {
// Implementation following guidelines
}
// Bad example
function badExample() {
// Implementation not following guidelines
}
```

generate repo structure

@cursor-rules.mdc List all source files and folders in the project,
and create a new cursor rule outlining the directory structure and important files and folders.

generate tech stack and project overview

@cursor-rules.mdc @package.json Analyze all major dependencies
and create a cursor rule outlining the stack of the application
and the versions I'm using, and any remarks on best practices on those versions.

general cursor / windsurf rules

- Keep answers concise and direct
- Suggest better alternatives if any 
- Avoid unnecessary explanations
- Prioritize technical details over generic advice
- Make sure to create a work plan in .cursor/rules/plan.md. Keep it updated.
- make sure to document any features/updates in readme.md

Make use of Cursor's workflows

  • Use /Generate Cursor Rules for any file type
---
description: Guidelines for continuously improving Cursor rules based on emerging code patterns and best practices.
globs: **/*
alwaysApply: true
---
## Rule Improvement Triggers
- New code patterns not covered by existing rules
- Repeated similar implementations across files
- Common error patterns that could be prevented
- New libraries or tools being used consistently
- Emerging best practices in the codebase
# Analysis Process:
- Compare new code with existing rules
- Identify patterns that should be standardized
- Look for references to external documentation
- Check for consistent error handling patterns
- Monitor test patterns and coverage
# Rule Updates:
- **Add New Rules When:**
- A new technology/pattern is used in 3+ files
- Common bugs could be prevented by a rule
- Code reviews repeatedly mention the same feedback
- New security or performance patterns emerge
- **Modify Existing Rules When:**
- Better examples exist in the codebase
- Additional edge cases are discovered
- Related rules have been updated
- Implementation details have changed
- **Example Pattern Recognition:**
```typescript
// If you see repeated patterns like:
const data = await prisma.user.findMany({
select: { id: true, email: true },
where: { status: 'ACTIVE' }
});
// Consider adding to [prisma.mdc](mdc:shipixen/.cursor/rules/prisma.mdc):
// - Standard select fields
// - Common where conditions
// - Performance optimization patterns
```
- **Rule Quality Checks:**
- Rules should be actionable and specific
- Examples should come from actual code
- References should be up to date
- Patterns should be consistently enforced
## Continuous Improvement:
- Monitor code review comments
- Track common development questions
- Update rules after major refactors
- Add links to relevant documentation
- Cross-reference related rules
## Rule Deprecation
- Mark outdated patterns as deprecated
- Remove rules that no longer apply
- Update references to deprecated rules
- Document migration paths for old patterns
## Documentation Updates:
- Keep examples synchronized with code
- Update references to external docs
- Maintain links between related rules
- Document breaking changes
Follow [cursor-rules.mdc](mdc:.cursor/rules/curs or-rules.mdc) for proper rule formatting and structure.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment