@mallardbay/cursor-rules 1.0.14 → 1.0.16
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/.cursor/rules/code-quality.mdc +53 -0
- package/.cursor/rules/code-review.mdc +46 -0
- package/.cursor/rules/error-handling.mdc +48 -0
- package/.cursor/rules/general-best-practices.mdc +163 -0
- package/.cursor/rules/mallardbay.mdc +23 -0
- package/.cursor/rules/performance.mdc +45 -0
- package/.cursor/rules/testing.mdc +71 -0
- package/.cursor/rules/typescript.mdc +27 -0
- package/.cursor/rules/ui.mdc +91 -0
- package/.cursor/shared/rules/code-quality.mdc +0 -2
- package/.cursor/shared/rules/general-best-practices.mdc +163 -0
- package/.cursor/shared/skills/address-pr-feedback/SKILL.md +156 -0
- package/.cursor/shared/skills/prep-for-pr/SKILL.md +160 -0
- package/.cursor/shared/skills/review-pr/SKILL.md +267 -0
- package/.cursor/skills/address-pr-feedback/SKILL.md +156 -0
- package/.cursor/skills/prep-for-pr/SKILL.md +160 -0
- package/.cursor/skills/review-pr/SKILL.md +267 -0
- package/README.md +60 -9
- package/bin/setup-cursor.sh +79 -16
- package/package.json +1 -5
- package/bin/test-setup.sh +0 -108
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Core development principles and best practices that always apply—optimized for AI agents to produce clean, maintainable, reviewable code with low cognitive complexity, clear semantics, and incremental changes.
|
|
3
|
+
alwaysApply: true
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# General Best Practices
|
|
7
|
+
|
|
8
|
+
These principles apply to all code changes and should guide every implementation decision.
|
|
9
|
+
|
|
10
|
+
## Core Principles
|
|
11
|
+
|
|
12
|
+
### DRY (Don't Repeat Yourself)
|
|
13
|
+
- Extract common logic into reusable functions, utilities, or shared modules
|
|
14
|
+
- Leverage existing patterns and utilities before creating new ones
|
|
15
|
+
- When duplicating code, ask: "Can this be abstracted?"
|
|
16
|
+
- Prefer composition and shared utilities over copy-paste solutions
|
|
17
|
+
|
|
18
|
+
### Leverage Existing Patterns
|
|
19
|
+
- **Always** search the codebase for similar implementations before creating new code
|
|
20
|
+
- Follow established patterns, conventions, and architectural decisions
|
|
21
|
+
- Use existing utilities, helpers, and shared libraries
|
|
22
|
+
- Match the style and structure of related files
|
|
23
|
+
- When patterns exist, use them consistently—don't invent new approaches without justification
|
|
24
|
+
|
|
25
|
+
### Incremental Changes
|
|
26
|
+
- **Minimize large changes in a single PR or commit**
|
|
27
|
+
- Break large features into smaller, testable increments
|
|
28
|
+
- Make changes that are easy to review and understand
|
|
29
|
+
- Prefer multiple small PRs over one massive change
|
|
30
|
+
- Each change should be independently testable and reviewable
|
|
31
|
+
- If a change touches many files, consider splitting it into logical phases
|
|
32
|
+
|
|
33
|
+
### Semantic Clarity
|
|
34
|
+
- Use **semantic, self-documenting names** for functions, variables, and types
|
|
35
|
+
- Function names should clearly describe what they do (e.g., `calculateTotalPrice` not `calc`)
|
|
36
|
+
- Variable names should express intent (e.g., `userAccountBalance` not `bal`)
|
|
37
|
+
- Terminology should be consistent across the codebase
|
|
38
|
+
- Avoid abbreviations unless they're widely understood in the domain
|
|
39
|
+
- Names should make code readable without comments
|
|
40
|
+
|
|
41
|
+
### Cognitive Complexity
|
|
42
|
+
- **Keep cognitive complexity low**—code should be easy to understand at a glance
|
|
43
|
+
- Prefer early returns and guard clauses over deep nesting
|
|
44
|
+
- Break complex logic into smaller, well-named functions
|
|
45
|
+
- Maximum nesting depth: 3 levels
|
|
46
|
+
- Use intermediate variables to clarify intent
|
|
47
|
+
- Extract complex conditionals into named boolean functions
|
|
48
|
+
- Avoid deeply nested ternaries—use if/else or extract to function
|
|
49
|
+
|
|
50
|
+
### Separation of Concerns
|
|
51
|
+
- **Files**: Each file should have a single, clear responsibility
|
|
52
|
+
- **Functions**: Each function should do one thing well
|
|
53
|
+
- Separate business logic from presentation, data access, and side effects
|
|
54
|
+
- Keep UI components focused on rendering and user interaction
|
|
55
|
+
- Extract business logic into pure functions or services
|
|
56
|
+
- Avoid god objects or functions that do too much
|
|
57
|
+
|
|
58
|
+
## Code Quality Standards
|
|
59
|
+
|
|
60
|
+
### Avoid "AI Slop"
|
|
61
|
+
- **Write code that's easy for humans to review**
|
|
62
|
+
- Avoid generating large amounts of code without understanding context
|
|
63
|
+
- Don't create unnecessary abstractions or over-engineered solutions
|
|
64
|
+
- Remove unused code, imports, and dead branches
|
|
65
|
+
- Clean up commented-out code and debugging statements
|
|
66
|
+
- If an approach doesn't work, **clean up failed attempts** before trying another
|
|
67
|
+
- Keep only relevant, working code—remove experimental code that didn't pan out
|
|
68
|
+
|
|
69
|
+
### Testing and Linting
|
|
70
|
+
- **Lint and test files related to your changes** before completing work
|
|
71
|
+
- Run linters on modified files and fix issues
|
|
72
|
+
- Run tests for affected modules, not the entire test suite unnecessarily
|
|
73
|
+
- For large changes: **use test sharding**—split tests across multiple runs
|
|
74
|
+
- **Do not run all tests in parallel** when dealing with many changes
|
|
75
|
+
- Tests should be **clear, fast, and minimize setup duplication**
|
|
76
|
+
- Use shared test utilities and fixtures to reduce boilerplate
|
|
77
|
+
- Each test should be independent and runnable in isolation
|
|
78
|
+
|
|
79
|
+
### Code Organization
|
|
80
|
+
- Group related functionality together
|
|
81
|
+
- Keep related code close (cohesion)
|
|
82
|
+
- Minimize dependencies between modules (loose coupling)
|
|
83
|
+
- Use appropriate data structures for the problem
|
|
84
|
+
- Prefer composition over inheritance
|
|
85
|
+
- Make functions pure when possible (no side effects)
|
|
86
|
+
- Handle edge cases explicitly—don't rely on implicit behavior
|
|
87
|
+
|
|
88
|
+
### Type Safety and Clarity
|
|
89
|
+
- Use TypeScript types effectively—avoid `any` unless necessary
|
|
90
|
+
- Make types explicit and meaningful
|
|
91
|
+
- Use const assertions and readonly where appropriate
|
|
92
|
+
- Prefer `const` over `let`, avoid `var`
|
|
93
|
+
- Use type guards and discriminated unions for type narrowing
|
|
94
|
+
|
|
95
|
+
### Performance Considerations
|
|
96
|
+
- Consider performance implications, but **avoid premature optimization**
|
|
97
|
+
- Profile before optimizing—optimize bottlenecks, not everything
|
|
98
|
+
- Use appropriate algorithms and data structures
|
|
99
|
+
- Avoid unnecessary re-renders, re-computations, or API calls
|
|
100
|
+
- Cache expensive computations when appropriate
|
|
101
|
+
|
|
102
|
+
## AI Agent Workflow
|
|
103
|
+
|
|
104
|
+
### Before Making Changes
|
|
105
|
+
1. **Create a plan** before making changes directly—outline the approach, identify affected files, and break down the work into steps
|
|
106
|
+
2. **Read existing code** to understand patterns and context
|
|
107
|
+
3. **Search the codebase** for similar implementations
|
|
108
|
+
4. **Check git history** to understand why code exists as it does
|
|
109
|
+
5. **Identify related files** that might be affected
|
|
110
|
+
6. **Ask clarifying questions** if requirements are unclear
|
|
111
|
+
|
|
112
|
+
### During Implementation
|
|
113
|
+
1. Make **small, incremental changes**
|
|
114
|
+
2. **Test as you go**—verify each change works before moving on
|
|
115
|
+
3. **Lint frequently**—don't accumulate lint errors
|
|
116
|
+
4. **Follow existing patterns**—don't reinvent the wheel
|
|
117
|
+
5. **Use semantic names**—code should be self-documenting
|
|
118
|
+
6. **Keep functions focused**—one responsibility per function
|
|
119
|
+
7. **Extract common logic**—don't duplicate code
|
|
120
|
+
|
|
121
|
+
### After Making Changes
|
|
122
|
+
1. **Clean up failed attempts**—remove experimental code
|
|
123
|
+
2. **Remove unused code**—imports, variables, functions
|
|
124
|
+
3. **Run linters** on modified files
|
|
125
|
+
4. **Run relevant tests**—not the entire suite unless necessary
|
|
126
|
+
5. **Verify the change works** end-to-end
|
|
127
|
+
6. **Check for side effects**—ensure changes don't break unrelated code
|
|
128
|
+
|
|
129
|
+
### When Changes Are Large
|
|
130
|
+
1. **Consider splitting** into multiple smaller PRs
|
|
131
|
+
2. **Use test sharding**—run tests in batches, not all at once
|
|
132
|
+
3. **Review incrementally**—make sure each part works before moving on
|
|
133
|
+
4. **Document the approach**—explain why changes are structured this way
|
|
134
|
+
5. **Check impact** on related systems and files
|
|
135
|
+
|
|
136
|
+
## Anti-Patterns to Avoid
|
|
137
|
+
|
|
138
|
+
- ❌ Copy-pasting code instead of extracting to a function
|
|
139
|
+
- ❌ Creating new patterns when existing ones work
|
|
140
|
+
- ❌ Making massive changes in one go
|
|
141
|
+
- ❌ Using vague names like `data`, `temp`, `value`, `thing`
|
|
142
|
+
- ❌ Deeply nested conditionals and loops
|
|
143
|
+
- ❌ Functions that do multiple unrelated things
|
|
144
|
+
- ❌ Leaving commented-out code or debugging statements
|
|
145
|
+
- ❌ Skipping tests or linting "to save time"
|
|
146
|
+
- ❌ Running entire test suite for small changes
|
|
147
|
+
- ❌ Leaving experimental code after failed attempts
|
|
148
|
+
- ❌ Premature optimization without profiling
|
|
149
|
+
- ❌ Using `any` types to avoid type errors
|
|
150
|
+
- ❌ Magic numbers or strings without constants
|
|
151
|
+
|
|
152
|
+
## Remember
|
|
153
|
+
|
|
154
|
+
**Code is read far more often than it's written.** Write code that:
|
|
155
|
+
- Is easy to understand
|
|
156
|
+
- Is easy to review
|
|
157
|
+
- Is easy to test
|
|
158
|
+
- Is easy to modify
|
|
159
|
+
- Follows established patterns
|
|
160
|
+
- Has clear semantics
|
|
161
|
+
- Minimizes cognitive load
|
|
162
|
+
|
|
163
|
+
When in doubt, prefer clarity and simplicity over cleverness.
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: address-pr-feedback
|
|
3
|
+
description: Address pull request feedback by finding the PR, reviewing comments, creating an implementation plan, and resolving GitHub conversations after fixes are applied. Use when responding to PR reviews, addressing feedback, or resolving review comments.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
tags:
|
|
6
|
+
- pr
|
|
7
|
+
- review
|
|
8
|
+
- github
|
|
9
|
+
- workflow
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Address PR Feedback
|
|
13
|
+
|
|
14
|
+
Find a pull request by branch name, review all feedback, create a plan to address it, assess validity and priority, implement fixes, and resolve GitHub conversations.
|
|
15
|
+
|
|
16
|
+
## When to Use
|
|
17
|
+
|
|
18
|
+
- User wants to address PR feedback or review comments
|
|
19
|
+
- User mentions responding to PR reviews
|
|
20
|
+
- User wants to resolve GitHub conversations
|
|
21
|
+
- After receiving feedback on a pull request
|
|
22
|
+
- When preparing to address reviewer comments
|
|
23
|
+
|
|
24
|
+
## Instructions
|
|
25
|
+
|
|
26
|
+
### Step 1: Find the Pull Request
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Get branch name
|
|
30
|
+
BRANCH=$(git branch --show-current)
|
|
31
|
+
|
|
32
|
+
# Find PR (prefer GitHub CLI)
|
|
33
|
+
gh pr list --head $BRANCH --json number,title,url
|
|
34
|
+
|
|
35
|
+
# Or use API: GET /repos/{owner}/{repo}/pulls?head={owner}:{branch-name}&state=open
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Step 2: Check Merge Conflicts & CI Status
|
|
39
|
+
|
|
40
|
+
**Check conflicts:**
|
|
41
|
+
```bash
|
|
42
|
+
gh pr view <pr-number> --json mergeable,mergeableState
|
|
43
|
+
# mergeable_state: clean = no conflicts, dirty = conflicts exist, behind = needs update
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**If conflicts exist:** Resolve before addressing feedback
|
|
47
|
+
```bash
|
|
48
|
+
git fetch origin <base-branch>
|
|
49
|
+
git rebase origin/<base-branch> # or merge
|
|
50
|
+
# Resolve conflicts, test, then push
|
|
51
|
+
git push origin <branch-name> # or --force-with-lease if rebased
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Check CI/CD status:**
|
|
55
|
+
```bash
|
|
56
|
+
gh pr checks <pr-number>
|
|
57
|
+
# Or: gh pr view <pr-number> --json statusCheckRollup
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**API endpoints:**
|
|
61
|
+
- Conflicts: `GET /repos/{owner}/{repo}/pulls/{pull_number}` → check `mergeable_state`
|
|
62
|
+
- Checks: `GET /repos/{owner}/{repo}/commits/{sha}/check-runs` or `/status`
|
|
63
|
+
|
|
64
|
+
**If checks failing:** Fix issues, push, wait for re-run. Only resolve conversations when checks pass.
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Get all review comments (includes threads)
|
|
68
|
+
gh pr view <pr-number> --json comments,reviews
|
|
69
|
+
|
|
70
|
+
# API endpoints:
|
|
71
|
+
# GET /repos/{owner}/{repo}/pulls/{pull_number}/comments - Review comments
|
|
72
|
+
# GET /repos/{owner}/{repo}/issues/{pr_number}/comments - General PR comments
|
|
73
|
+
# GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews - Review summaries (APPROVED, CHANGES_REQUESTED, etc.)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Step 4: Analyze Feedback
|
|
77
|
+
|
|
78
|
+
Categorize by:
|
|
79
|
+
- **Type**: Blocking (must fix), Suggestions, Questions, Praise (no action)
|
|
80
|
+
- **Priority**: High (bugs/security), Medium (quality), Low (style)
|
|
81
|
+
- **Category**: Bugs, Code Quality, Tests, Documentation, Performance, Style
|
|
82
|
+
|
|
83
|
+
Assess validity against [general-best-practices.mdc](mdc:.cursor/rules/general-best-practices.mdc). Group related feedback and identify contradictions.
|
|
84
|
+
|
|
85
|
+
### Step 5: Create Implementation Plan
|
|
86
|
+
|
|
87
|
+
List all feedback with: comment ID, thread ID, file:line, reviewer, priority, and proposed solution. Organize by file, order by priority, note dependencies.
|
|
88
|
+
|
|
89
|
+
**Format:**
|
|
90
|
+
```markdown
|
|
91
|
+
### High Priority
|
|
92
|
+
- [ ] Comment #123 (thread:456) - `src/utils.ts:45` - @reviewer
|
|
93
|
+
Issue: Missing null check → Solution: Add guard clause
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Step 6: Implement Fixes
|
|
97
|
+
|
|
98
|
+
Work through plan systematically. Reference feedback in commits:
|
|
99
|
+
```bash
|
|
100
|
+
git commit -m "fix: add null check
|
|
101
|
+
|
|
102
|
+
Addresses review comment #123"
|
|
103
|
+
git push origin <branch-name>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Step 7: Resolve GitHub Conversations
|
|
107
|
+
|
|
108
|
+
Reply to comments acknowledging fixes:
|
|
109
|
+
```bash
|
|
110
|
+
gh pr comment <pr-number> --body "Fixed in commit abc123. Thanks!"
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**API endpoints:**
|
|
114
|
+
- Reply: `POST /repos/{owner}/{repo}/pulls/{pull_number}/comments` with `{"body":"...", "in_reply_to": <comment_id>}`
|
|
115
|
+
- Resolve thread: `PUT /repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/resolved`
|
|
116
|
+
|
|
117
|
+
Reference commit hash and thank reviewers.
|
|
118
|
+
|
|
119
|
+
### Authentication
|
|
120
|
+
|
|
121
|
+
**Preferred: GitHub CLI**
|
|
122
|
+
```bash
|
|
123
|
+
gh auth login # Handles auth automatically
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**Alternative: Personal Access Token**
|
|
127
|
+
- Create PAT with scopes: `repo`, `pull_requests:write`, `issues:write`
|
|
128
|
+
- Set: `export GITHUB_TOKEN=your_token_here`
|
|
129
|
+
- Never commit tokens. Use GitHub Secrets in CI/CD.
|
|
130
|
+
|
|
131
|
+
### Step 8: Verify and Follow Up
|
|
132
|
+
|
|
133
|
+
Re-check conflicts and CI status. Verify conversations resolved. Request re-review if needed:
|
|
134
|
+
```bash
|
|
135
|
+
gh pr comment <number> --body "@reviewer Ready for another look! ✅"
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**Final checklist:** No conflicts ✅ | Checks passing ✅ | Feedback addressed ✅ | Conversations resolved ✅
|
|
139
|
+
|
|
140
|
+
## Output Format
|
|
141
|
+
|
|
142
|
+
Provide: PR status (conflicts & checks), summary of feedback addressed, changes made, conversations resolved, remaining items, next steps.
|
|
143
|
+
|
|
144
|
+
## Notes
|
|
145
|
+
|
|
146
|
+
- Be respectful in responses. Reference commits. Explain if not implementing a suggestion.
|
|
147
|
+
- Group related fixes. Test before resolving conversations. Ask questions if feedback is unclear.
|
|
148
|
+
|
|
149
|
+
## References
|
|
150
|
+
|
|
151
|
+
- [GitHub REST API - Pull Requests](https://docs.github.com/en/rest/pulls)
|
|
152
|
+
- [GitHub REST API - Pull Request Comments](https://docs.github.com/en/rest/pulls/comments)
|
|
153
|
+
- [GitHub REST API - Checks](https://docs.github.com/en/rest/checks)
|
|
154
|
+
- [GitHub REST API - Statuses](https://docs.github.com/en/rest/commits/statuses)
|
|
155
|
+
- [GitHub CLI Documentation](https://cli.github.com/manual/)
|
|
156
|
+
- [code-review.mdc](mdc:.cursor/rules/code-review.mdc) - PR review standards
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: prep-for-pr
|
|
3
|
+
description: Prepare the current branch for a pull request by checking code quality, completeness, and adherence to best practices. Use when preparing to create a PR, tidying up a branch, or ensuring code is ready for review.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
tags:
|
|
6
|
+
- pr
|
|
7
|
+
- preparation
|
|
8
|
+
- code-quality
|
|
9
|
+
- workflow
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Prep for PR
|
|
13
|
+
|
|
14
|
+
Prepare the current branch for a pull request by systematically checking code quality, completeness, and adherence to best practices. This skill helps ensure your branch is ready before creating a PR.
|
|
15
|
+
|
|
16
|
+
## When to Use
|
|
17
|
+
|
|
18
|
+
- Preparing to create a pull request
|
|
19
|
+
- Tidying up a branch before submitting
|
|
20
|
+
- User mentions preparing for PR, getting ready for review, or checking branch quality
|
|
21
|
+
- Before pushing changes for review
|
|
22
|
+
- When you want to ensure code meets quality standards
|
|
23
|
+
|
|
24
|
+
## Instructions
|
|
25
|
+
|
|
26
|
+
Systematically check the new work on this branch and fix issues as you find them. Work through the following checklist:
|
|
27
|
+
|
|
28
|
+
**Important:** This skill references project rules for detailed guidance. Review the relevant rules files for complete standards:
|
|
29
|
+
- [general-best-practices.mdc](mdc:.cursor/rules/general-best-practices.mdc) - Core principles, DRY, patterns, semantic clarity, cognitive complexity, anti-patterns
|
|
30
|
+
- [testing.mdc](mdc:.cursor/rules/testing.mdc) - Test coverage, organization, and quality standards
|
|
31
|
+
- [code-quality.mdc](mdc:.cursor/rules/code-quality.mdc) - Code structure, naming conventions, reuse guidelines
|
|
32
|
+
- [code-review.mdc](mdc:.cursor/rules/code-review.mdc) - PR size and review requirements
|
|
33
|
+
|
|
34
|
+
### Code Quality Checks
|
|
35
|
+
|
|
36
|
+
**Feature Gaps**
|
|
37
|
+
- [ ] Are all requirements from the ticket/issue addressed?
|
|
38
|
+
- [ ] Are edge cases handled appropriately?
|
|
39
|
+
- [ ] Is error handling comprehensive?
|
|
40
|
+
- [ ] Are user-facing features complete (no TODOs or placeholders)?
|
|
41
|
+
|
|
42
|
+
**Potential New Bugs**
|
|
43
|
+
- [ ] Review logic for potential race conditions
|
|
44
|
+
- [ ] Check for null/undefined handling
|
|
45
|
+
- [ ] Verify error paths are tested
|
|
46
|
+
- [ ] Look for off-by-one errors or boundary issues
|
|
47
|
+
- [ ] Check for memory leaks or resource cleanup issues
|
|
48
|
+
- [ ] Verify async/await patterns are correct
|
|
49
|
+
- [ ] Check for potential infinite loops or performance issues
|
|
50
|
+
|
|
51
|
+
**Missing Tests**
|
|
52
|
+
- [ ] Are all new functions/components tested? (See [testing.mdc](mdc:.cursor/rules/testing.mdc))
|
|
53
|
+
- [ ] Are edge cases covered in tests?
|
|
54
|
+
- [ ] Are error cases tested?
|
|
55
|
+
- [ ] Is integration testing appropriate and present?
|
|
56
|
+
- [ ] Do tests follow existing test patterns?
|
|
57
|
+
|
|
58
|
+
**Duplicated Tests**
|
|
59
|
+
- [ ] Are there redundant test cases?
|
|
60
|
+
- [ ] Can tests be consolidated without losing coverage?
|
|
61
|
+
- [ ] Are test utilities being reused appropriately?
|
|
62
|
+
|
|
63
|
+
**Anti-Patterns**
|
|
64
|
+
- [ ] Check against project anti-patterns in [general-best-practices.mdc](mdc:.cursor/rules/general-best-practices.mdc)
|
|
65
|
+
- [ ] Verify no copy-paste code that should be extracted (DRY principle)
|
|
66
|
+
- [ ] Ensure no commented-out code or debugging statements
|
|
67
|
+
- [ ] Check for code smells (god objects, deep nesting, magic numbers)
|
|
68
|
+
|
|
69
|
+
**Files Only Imported by Tests**
|
|
70
|
+
- [ ] Identify any files/functions only used in test files
|
|
71
|
+
- [ ] Determine if these should be removed or if they're intentionally test-only utilities
|
|
72
|
+
- [ ] Flag dead code that can be safely removed
|
|
73
|
+
|
|
74
|
+
**AI Slop That Needs to Be Flagged**
|
|
75
|
+
- [ ] Check against "Avoid AI Slop" section in [general-best-practices.mdc](mdc:.cursor/rules/general-best-practices.mdc)
|
|
76
|
+
- [ ] Look for code that doesn't follow project patterns
|
|
77
|
+
- [ ] Identify code that seems generated without understanding context
|
|
78
|
+
- [ ] Check for unused imports or variables
|
|
79
|
+
|
|
80
|
+
### Best Practices Verification
|
|
81
|
+
|
|
82
|
+
**All New Code Uses Pre-Existing Patterns**
|
|
83
|
+
- [ ] Code follows established architectural patterns (see [general-best-practices.mdc](mdc:.cursor/rules/general-best-practices.mdc) - "Leverage Existing Patterns")
|
|
84
|
+
- [ ] File structure matches existing conventions (see [code-quality.mdc](mdc:.cursor/rules/code-quality.mdc))
|
|
85
|
+
- [ ] Naming conventions are consistent (see [code-quality.mdc](mdc:.cursor/rules/code-quality.mdc) and [general-best-practices.mdc](mdc:.cursor/rules/general-best-practices.mdc) - "Semantic Clarity")
|
|
86
|
+
- [ ] Code organization follows project standards
|
|
87
|
+
|
|
88
|
+
**Whenever Possible We Reused Existing Logic**
|
|
89
|
+
- [ ] No duplicate code that could use shared utilities (see [general-best-practices.mdc](mdc:.cursor/rules/general-best-practices.mdc) - "DRY Principle")
|
|
90
|
+
- [ ] Existing functions/components are leveraged
|
|
91
|
+
- [ ] Shared libraries are used appropriately (see [code-quality.mdc](mdc:.cursor/rules/code-quality.mdc) - "Code Reuse")
|
|
92
|
+
|
|
93
|
+
**New Code is Setup in Way We Can Share/Reuse Later**
|
|
94
|
+
- [ ] Functions are properly abstracted
|
|
95
|
+
- [ ] Code is modular and composable (see [general-best-practices.mdc](mdc:.cursor/rules/general-best-practices.mdc) - "Separation of Concerns")
|
|
96
|
+
- [ ] Utilities are placed in appropriate shared locations
|
|
97
|
+
- [ ] Components are reusable, not overly specific
|
|
98
|
+
|
|
99
|
+
**Make Sure Function Names Make Sense Based on Context**
|
|
100
|
+
- [ ] Function names clearly describe what they do (see [general-best-practices.mdc](mdc:.cursor/rules/general-best-practices.mdc) - "Semantic Clarity")
|
|
101
|
+
- [ ] Names are semantic and self-documenting
|
|
102
|
+
- [ ] Terminology is consistent with codebase
|
|
103
|
+
- [ ] Names match their actual behavior
|
|
104
|
+
|
|
105
|
+
**New Code is Simple to Understand for Humans**
|
|
106
|
+
- [ ] Code is readable without excessive comments
|
|
107
|
+
- [ ] Complex logic is broken down into smaller functions (see [general-best-practices.mdc](mdc:.cursor/rules/general-best-practices.mdc) - "Cognitive Complexity")
|
|
108
|
+
- [ ] Cognitive complexity is low (maximum nesting depth: 3 levels)
|
|
109
|
+
- [ ] Code flow is easy to follow
|
|
110
|
+
- [ ] Proper description/documentation where needed
|
|
111
|
+
|
|
112
|
+
### Preparation Process
|
|
113
|
+
|
|
114
|
+
1. **Analyze the current branch**
|
|
115
|
+
- Read through all changed files
|
|
116
|
+
- Understand the overall change and scope
|
|
117
|
+
- Identify what was added, modified, or removed
|
|
118
|
+
|
|
119
|
+
2. **Work through the checklist systematically**
|
|
120
|
+
- Check each category thoroughly
|
|
121
|
+
- Fix issues as you find them
|
|
122
|
+
- Don't just flag—actually improve the code
|
|
123
|
+
|
|
124
|
+
3. **Make improvements**
|
|
125
|
+
- Refactor code that doesn't follow patterns
|
|
126
|
+
- Add missing tests
|
|
127
|
+
- Remove duplicated code
|
|
128
|
+
- Fix bugs and edge cases
|
|
129
|
+
- Clean up AI-generated code that doesn't fit
|
|
130
|
+
- Improve naming and structure
|
|
131
|
+
|
|
132
|
+
4. **Verify completeness**
|
|
133
|
+
- Ensure all requirements are met
|
|
134
|
+
- Confirm tests are comprehensive
|
|
135
|
+
- Verify code follows project standards
|
|
136
|
+
- Check that everything is ready for review
|
|
137
|
+
|
|
138
|
+
5. **Use the ask questions tool** if you need clarification on:
|
|
139
|
+
- Requirements or acceptance criteria
|
|
140
|
+
- Project-specific patterns or conventions
|
|
141
|
+
- Expected behavior or edge cases
|
|
142
|
+
- Where to place new code or utilities
|
|
143
|
+
|
|
144
|
+
## Output Format
|
|
145
|
+
|
|
146
|
+
After preparing the branch, provide:
|
|
147
|
+
|
|
148
|
+
1. **Summary**: Overview of what was checked and improved
|
|
149
|
+
2. **Issues Fixed**: List of specific issues that were addressed
|
|
150
|
+
3. **Remaining Items**: Any items that need attention but couldn't be fixed automatically
|
|
151
|
+
4. **Readiness Status**: Whether the branch is ready for PR creation
|
|
152
|
+
|
|
153
|
+
## Notes
|
|
154
|
+
|
|
155
|
+
- Actively fix issues, don't just identify them
|
|
156
|
+
- Focus on important issues first (bugs, missing tests, anti-patterns)
|
|
157
|
+
- Reference existing code patterns when making changes
|
|
158
|
+
- Make code improvements that will make the PR easier to review
|
|
159
|
+
- Ensure the branch is in a good state before creating the PR
|
|
160
|
+
- Balance thoroughness with pragmatism—fix what matters most
|