|
| 1 | +--- |
| 2 | +description: Guidelines for continuously improving Cursor rules based on emerging code patterns and best practices. |
| 3 | +globs: **/* |
| 4 | +alwaysApply: true |
| 5 | +--- |
| 6 | + |
| 7 | +- **Rule Improvement Triggers:** |
| 8 | + - New code patterns not covered by existing rules |
| 9 | + - Repeated similar implementations across files |
| 10 | + - Common error patterns that could be prevented |
| 11 | + - New libraries or tools being used consistently |
| 12 | + - Emerging best practices in the codebase |
| 13 | + |
| 14 | +- **Analysis Process:** |
| 15 | + - Compare new code with existing rules |
| 16 | + - Identify patterns that should be standardized |
| 17 | + - Look for references to external documentation |
| 18 | + - Check for consistent error handling patterns |
| 19 | + - Monitor test patterns and coverage |
| 20 | + |
| 21 | +- **Rule Updates:** |
| 22 | + - **Add New Rules When:** |
| 23 | + - A new technology/pattern is used in 3+ files |
| 24 | + - Common bugs could be prevented by a rule |
| 25 | + - Code reviews repeatedly mention the same feedback |
| 26 | + - New security or performance patterns emerge |
| 27 | + |
| 28 | + - **Modify Existing Rules When:** |
| 29 | + - Better examples exist in the codebase |
| 30 | + - Additional edge cases are discovered |
| 31 | + - Related rules have been updated |
| 32 | + - Implementation details have changed |
| 33 | + |
| 34 | +- **Example Pattern Recognition:** |
| 35 | + ```typescript |
| 36 | + // If you see repeated patterns like: |
| 37 | + const data = await prisma.user.findMany({ |
| 38 | + select: { id: true, email: true }, |
| 39 | + where: { status: 'ACTIVE' } |
| 40 | + }); |
| 41 | + |
| 42 | + // Consider adding to [prisma.mdc](mdc:.cursor/rules/prisma.mdc): |
| 43 | + // - Standard select fields |
| 44 | + // - Common where conditions |
| 45 | + // - Performance optimization patterns |
| 46 | + ``` |
| 47 | + |
| 48 | +- **Rule Quality Checks:** |
| 49 | + - Rules should be actionable and specific |
| 50 | + - Examples should come from actual code |
| 51 | + - References should be up to date |
| 52 | + - Patterns should be consistently enforced |
| 53 | + |
| 54 | +- **Continuous Improvement:** |
| 55 | + - Monitor code review comments |
| 56 | + - Track common development questions |
| 57 | + - Update rules after major refactors |
| 58 | + - Add links to relevant documentation |
| 59 | + - Cross-reference related rules |
| 60 | + |
| 61 | +- **Rule Deprecation:** |
| 62 | + - Mark outdated patterns as deprecated |
| 63 | + - Remove rules that no longer apply |
| 64 | + - Update references to deprecated rules |
| 65 | + - Document migration paths for old patterns |
| 66 | + |
| 67 | +- **Documentation Updates:** |
| 68 | + - Keep examples synchronized with code |
| 69 | + - Update references to external docs |
| 70 | + - Maintain links between related rules |
| 71 | + - Document breaking changes |
| 72 | +Follow [cursor_rules.mdc](mdc:.cursor/rules/cursor_rules.mdc) for proper rule formatting and structure. |
0 commit comments