|
| 1 | +# Cursor AI Rules for OmniScript |
| 2 | + |
| 3 | +## Pull Request Review Process (MANDATORY) |
| 4 | + |
| 5 | +**Before every commit**, perform a comprehensive PR review as a staff engineer: |
| 6 | + |
| 7 | +### Severity Levels |
| 8 | + |
| 9 | +- **P0**: Blocker - Must fix before commit |
| 10 | +- **P1**: High - Critical issues that should block |
| 11 | +- **P2**: Medium - Important but not blocking |
| 12 | +- **P3**: Low - Nice to have improvements |
| 13 | + |
| 14 | +### Review Checklist |
| 15 | + |
| 16 | +#### Correctness & Testing |
| 17 | + |
| 18 | +- [ ] Logic is correct and handles all cases |
| 19 | +- [ ] Test coverage for new features (aim for 90%+) |
| 20 | +- [ ] Edge cases identified and tested |
| 21 | +- [ ] Error paths tested |
| 22 | + |
| 23 | +#### Security |
| 24 | + |
| 25 | +- [ ] No hardcoded secrets or credentials |
| 26 | +- [ ] Input validation on all user data |
| 27 | +- [ ] Output sanitization (XSS prevention) |
| 28 | +- [ ] Authentication/authorization checked |
| 29 | +- [ ] OWASP Top 10 risks addressed |
| 30 | +- [ ] Dependencies scanned for vulnerabilities |
| 31 | + |
| 32 | +#### Performance & Scalability |
| 33 | + |
| 34 | +- [ ] No obvious performance bottlenecks |
| 35 | +- [ ] Memory usage reasonable |
| 36 | +- [ ] No N+1 queries or loops |
| 37 | +- [ ] Complexity is O(n) or better where possible |
| 38 | + |
| 39 | +#### API & Compatibility |
| 40 | + |
| 41 | +- [ ] No breaking changes without major version bump |
| 42 | +- [ ] Backward compatibility maintained |
| 43 | +- [ ] Public API contracts documented |
| 44 | +- [ ] Types are correct and complete |
| 45 | + |
| 46 | +#### Database & Data |
| 47 | + |
| 48 | +- [ ] Migrations are reversible |
| 49 | +- [ ] No data loss risk |
| 50 | +- [ ] Indexes added where needed |
| 51 | +- [ ] Query performance acceptable |
| 52 | + |
| 53 | +#### Dependencies & CI |
| 54 | + |
| 55 | +- [ ] New dependencies justified and licensed (MIT/Apache/BSD) |
| 56 | +- [ ] Lock files updated |
| 57 | +- [ ] CI configuration correct |
| 58 | +- [ ] Build and tests pass |
| 59 | + |
| 60 | +#### Observability |
| 61 | + |
| 62 | +- [ ] Errors logged with context |
| 63 | +- [ ] Important operations logged |
| 64 | +- [ ] No sensitive data in logs |
| 65 | +- [ ] Metrics added for key operations |
| 66 | + |
| 67 | +#### Code Quality |
| 68 | + |
| 69 | +- [ ] Code is readable and maintainable |
| 70 | +- [ ] Functions are small and focused |
| 71 | +- [ ] Names are clear and descriptive |
| 72 | +- [ ] Documentation exists for complex logic |
| 73 | +- [ ] Comments explain "why" not "what" |
| 74 | +- [ ] No commented-out code |
| 75 | + |
| 76 | +#### Accessibility & i18n |
| 77 | + |
| 78 | +- [ ] UI is keyboard accessible (if applicable) |
| 79 | +- [ ] Screen reader compatible (if applicable) |
| 80 | +- [ ] Text is externalized for i18n (if applicable) |
| 81 | + |
| 82 | +### Output Format |
| 83 | + |
| 84 | +``` |
| 85 | +Summary: [One sentence describing risk level and change scope] |
| 86 | +
|
| 87 | +Verdict: [Approve | Request changes] |
| 88 | +Rationale: [Why this verdict] |
| 89 | +
|
| 90 | +Findings: |
| 91 | +1. [P0] file.ts:123 - [Clear description] - [Why it matters] - [Minimal fix] |
| 92 | +2. [P1] file.ts:456 - [Description] - [Impact] - [Solution] |
| 93 | +
|
| 94 | +Tests: |
| 95 | +- Missing: [Test description with example case] |
| 96 | +- Flaky: [Test that needs fixing] |
| 97 | +
|
| 98 | +Follow-ups: |
| 99 | +- [P3] [Optional improvement for future PR] |
| 100 | +``` |
| 101 | + |
| 102 | +### Commit Policy |
| 103 | + |
| 104 | +**ONLY COMMIT IF**: No P0, P1, P2, or P3 issues are found in the review. |
| 105 | + |
| 106 | +If issues exist: |
| 107 | + |
| 108 | +1. Fix all P0-P2 issues immediately |
| 109 | +2. Consider fixing P3 issues or document as tech debt |
| 110 | +3. Re-run review after fixes |
| 111 | +4. Commit only when clean |
| 112 | + |
| 113 | +--- |
| 114 | + |
| 115 | +## Additional Rules |
| 116 | + |
| 117 | +See AGENTS.md and CLAUDE.md for full coding standards and workflows. |
| 118 | + |
| 119 | +### Quick Reference |
| 120 | + |
| 121 | +- **Header comments**: 4 lines (File, What, Why, Related) |
| 122 | +- **TypeScript**: Strict mode, no `any` |
| 123 | +- **Tests**: Vitest, 90%+ coverage |
| 124 | +- **Commits**: Conventional commits (feat:, fix:, docs:, etc.) |
| 125 | +- **Files**: Keep under 300 lines |
| 126 | +- **Security**: No secrets in code, validate inputs |
0 commit comments