@mallardbay/cursor-rules 1.0.10 → 1.0.12
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/frontend/rules/ui.mdc +8 -2
- package/.cursor/frontend-lib/rules/storybook.mdc +147 -0
- package/.cursor/shared/rules/code-quality.mdc +38 -33
- package/.cursor/shared/rules/code-review.mdc +26 -20
- package/.cursor/shared/rules/error-handling.mdc +29 -22
- package/.cursor/shared/rules/general-best-practices.mdc +163 -0
- package/.cursor/shared/rules/performance.mdc +25 -18
- package/.cursor/shared/rules/testing.mdc +2 -1
- package/.cursor/shared/rules/typescript.mdc +14 -11
- 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/README.md +72 -4
- package/bin/setup-cursor.sh +78 -3
- package/package.json +1 -1
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
globs:
|
|
4
|
-
alwaysApply: false
|
|
2
|
+
alwaysApply: true
|
|
5
3
|
---
|
|
4
|
+
|
|
6
5
|
# TypeScript Development Standards
|
|
7
6
|
|
|
8
7
|
## Type Safety
|
|
8
|
+
|
|
9
9
|
Enforce comprehensive type safety across the codebase:
|
|
10
10
|
|
|
11
11
|
### Strict Type Checking
|
|
12
|
+
|
|
12
13
|
Be as strictly as possible where it delivers clear value—specifically in preventing bugs and improving the developer experience. The goal is to enforce strong types and catch issues early, without introducing excessive friction or overhead. If a strict setting improves safety, maintainability, or clarity, we’ll use it. If it creates noise or slows down iteration without real benefit, we’ll dial it back. This is about pragmatic strictness, not dogmatism.
|
|
13
14
|
|
|
14
15
|
### File Organization
|
|
15
|
-
|
|
16
|
-
-
|
|
16
|
+
|
|
17
|
+
- Place types at the bottom of files
|
|
18
|
+
- Define PropTypes before component definitions
|
|
17
19
|
|
|
18
20
|
## Best Practices
|
|
19
|
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
21
|
+
|
|
22
|
+
- Use TypeScript for all new code
|
|
23
|
+
- Leverage TypeScript's type system for better code quality
|
|
24
|
+
- Follow React best practices with TypeScript
|
|
25
|
+
- Use proper type definitions for props and state
|
|
26
|
+
- Utilize TypeScript's utility types when appropriate
|
|
27
|
+
- Suggest existing libaries as needed
|
|
@@ -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
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: review-pr
|
|
3
|
+
description: Review a pull request systematically, checking code quality, functionality, security, and adherence to project standards. Use when reviewing PRs, providing code review feedback, or checking someone else's changes.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
tags:
|
|
6
|
+
- pr
|
|
7
|
+
- review
|
|
8
|
+
- code-quality
|
|
9
|
+
- workflow
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Review PR
|
|
13
|
+
|
|
14
|
+
Systematically review a pull request, checking code quality, functionality, security, tests, and adherence to project standards. Provide constructive feedback and approve or request changes.
|
|
15
|
+
|
|
16
|
+
## When to Use
|
|
17
|
+
|
|
18
|
+
- User wants to review a pull request
|
|
19
|
+
- User mentions code review, PR review, or checking someone else's changes
|
|
20
|
+
- User provides a PR URL, number, or branch name
|
|
21
|
+
- When asked to review code before merge
|
|
22
|
+
|
|
23
|
+
## Instructions
|
|
24
|
+
|
|
25
|
+
### Step 1: Get PR Information
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# If PR number provided
|
|
29
|
+
gh pr view <pr-number> --json number,title,body,author,headRefName,baseRefName,files,commits
|
|
30
|
+
|
|
31
|
+
# If PR URL provided, extract number from URL
|
|
32
|
+
# Format: github.com/{owner}/{repo}/pull/{number}
|
|
33
|
+
|
|
34
|
+
# If branch name provided
|
|
35
|
+
gh pr list --head <branch-name> --json number,title,url
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Key information to extract:**
|
|
39
|
+
- PR number, title, description
|
|
40
|
+
- Author and branch names
|
|
41
|
+
- Changed files and commit history
|
|
42
|
+
- Current review status
|
|
43
|
+
|
|
44
|
+
### Step 2: Review PR Scope
|
|
45
|
+
|
|
46
|
+
- [ ] PR size is reasonable (see [code-review.mdc](mdc:.cursor/rules/code-review.mdc) - max 400 lines)
|
|
47
|
+
- [ ] PR description is clear and explains purpose
|
|
48
|
+
- [ ] Related issues/tickets are referenced
|
|
49
|
+
- [ ] Changes align with PR description
|
|
50
|
+
- [ ] No unrelated changes included
|
|
51
|
+
|
|
52
|
+
### Step 3: Code Quality Review
|
|
53
|
+
|
|
54
|
+
Reference project standards:
|
|
55
|
+
- [general-best-practices.mdc](mdc:.cursor/rules/general-best-practices.mdc) - DRY, patterns, semantic clarity, cognitive complexity
|
|
56
|
+
- [code-quality.mdc](mdc:.cursor/rules/code-quality.mdc) - Structure, naming, reuse
|
|
57
|
+
- [testing.mdc](mdc:.cursor/rules/testing.mdc) - Test requirements
|
|
58
|
+
|
|
59
|
+
**Check for:**
|
|
60
|
+
|
|
61
|
+
**Functionality & Logic**
|
|
62
|
+
- [ ] Code does what it's supposed to do
|
|
63
|
+
- [ ] Edge cases are handled
|
|
64
|
+
- [ ] Error handling is comprehensive
|
|
65
|
+
- [ ] Integration with existing code is smooth
|
|
66
|
+
- [ ] No obvious bugs or logic errors
|
|
67
|
+
|
|
68
|
+
**Code Quality**
|
|
69
|
+
- [ ] Follows existing patterns (see [general-best-practices.mdc](mdc:.cursor/rules/general-best-practices.mdc))
|
|
70
|
+
- [ ] Reuses existing logic where possible
|
|
71
|
+
- [ ] Function names are semantic and clear
|
|
72
|
+
- [ ] Cognitive complexity is low
|
|
73
|
+
- [ ] Separation of concerns is maintained
|
|
74
|
+
- [ ] No code duplication (DRY principle)
|
|
75
|
+
|
|
76
|
+
**Security**
|
|
77
|
+
- [ ] No obvious security vulnerabilities
|
|
78
|
+
- [ ] Input validation and sanitization
|
|
79
|
+
- [ ] Authentication/authorization checks
|
|
80
|
+
- [ ] No sensitive data exposed
|
|
81
|
+
- [ ] Dependencies are up-to-date and secure
|
|
82
|
+
|
|
83
|
+
**Performance**
|
|
84
|
+
- [ ] No obvious performance bottlenecks
|
|
85
|
+
- [ ] Efficient algorithms and data structures
|
|
86
|
+
- [ ] No unnecessary re-renders/re-computations
|
|
87
|
+
- [ ] Resource cleanup (memory, connections)
|
|
88
|
+
|
|
89
|
+
**Style & Consistency**
|
|
90
|
+
- [ ] Follows project naming conventions
|
|
91
|
+
- [ ] Consistent with codebase style
|
|
92
|
+
- [ ] No commented-out code or debug statements
|
|
93
|
+
- [ ] Proper formatting
|
|
94
|
+
|
|
95
|
+
### Step 4: Test Coverage Review
|
|
96
|
+
|
|
97
|
+
- [ ] New code has tests (see [testing.mdc](mdc:.cursor/rules/testing.mdc))
|
|
98
|
+
- [ ] Tests cover happy path, error cases, edge cases
|
|
99
|
+
- [ ] Test quality is good (clear, focused, maintainable)
|
|
100
|
+
- [ ] No duplicate or redundant tests
|
|
101
|
+
- [ ] Tests follow project patterns
|
|
102
|
+
|
|
103
|
+
### Step 5: Breaking Changes Analysis
|
|
104
|
+
|
|
105
|
+
Check for breaking changes that could affect clients:
|
|
106
|
+
|
|
107
|
+
- [ ] API endpoints, request/response formats, or signatures changed?
|
|
108
|
+
- [ ] Public functions/interfaces modified or removed?
|
|
109
|
+
- [ ] Database schema changes that aren't backward compatible?
|
|
110
|
+
- [ ] Behavioral changes that alter existing functionality?
|
|
111
|
+
- [ ] Configuration options changed or removed?
|
|
112
|
+
|
|
113
|
+
**If breaking changes found:** Flag as **Blocking** unless properly handled with version bump, deprecation notices, migration guides, and CHANGELOG entries.
|
|
114
|
+
|
|
115
|
+
### Step 6: Documentation Review
|
|
116
|
+
|
|
117
|
+
- [ ] Complex logic is documented
|
|
118
|
+
- [ ] Function/class documentation where needed
|
|
119
|
+
- [ ] README updated if needed
|
|
120
|
+
- [ ] Code comments explain "why" not "what"
|
|
121
|
+
|
|
122
|
+
### Step 7: Architecture & Design
|
|
123
|
+
|
|
124
|
+
- [ ] Aligns with system architecture
|
|
125
|
+
- [ ] Follows established design patterns
|
|
126
|
+
- [ ] No unnecessary abstractions
|
|
127
|
+
- [ ] Proper separation of concerns
|
|
128
|
+
- [ ] Changes are maintainable
|
|
129
|
+
|
|
130
|
+
### Step 8: Provide Feedback
|
|
131
|
+
|
|
132
|
+
**For each issue found:**
|
|
133
|
+
|
|
134
|
+
1. **Categorize feedback:**
|
|
135
|
+
- **Blocking** - Must fix before merge (bugs, security, breaking changes)
|
|
136
|
+
- **Important** - Should fix (code quality, maintainability)
|
|
137
|
+
- **Suggestion** - Nice to have (style, minor improvements)
|
|
138
|
+
- **Question** - Need clarification
|
|
139
|
+
|
|
140
|
+
2. **Write constructive comments:**
|
|
141
|
+
- Be specific about the issue
|
|
142
|
+
- Explain why it matters
|
|
143
|
+
- Suggest solutions when possible
|
|
144
|
+
- Reference project standards
|
|
145
|
+
- Use positive, respectful language
|
|
146
|
+
|
|
147
|
+
3. **Post comments on GitHub:**
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
# Post review comment on specific line
|
|
151
|
+
gh pr comment <pr-number> --body "Comment text" --file <file-path> --line <line-number>
|
|
152
|
+
|
|
153
|
+
# Or use API: POST /repos/{owner}/{repo}/pulls/{pull_number}/comments
|
|
154
|
+
# Body: {"body": "...", "path": "file.ts", "line": 42}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**Comment format:**
|
|
158
|
+
```markdown
|
|
159
|
+
**Issue:** [Brief description]
|
|
160
|
+
|
|
161
|
+
**Why:** [Why this matters - reference to standards if applicable]
|
|
162
|
+
|
|
163
|
+
**Suggestion:** [How to fix or improve]
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Step 9: Submit Review
|
|
167
|
+
|
|
168
|
+
**After reviewing:**
|
|
169
|
+
|
|
170
|
+
1. **Summarize findings:**
|
|
171
|
+
- List blocking issues
|
|
172
|
+
- List important issues
|
|
173
|
+
- Note positive aspects
|
|
174
|
+
|
|
175
|
+
2. **Submit review:**
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
# Request changes (blocking issues)
|
|
179
|
+
gh pr review <pr-number> --request-changes --body "Review summary"
|
|
180
|
+
|
|
181
|
+
# Approve (no blocking issues)
|
|
182
|
+
gh pr review <pr-number> --approve --body "LGTM! Minor suggestions in comments."
|
|
183
|
+
|
|
184
|
+
# Comment only (suggestions but not blocking)
|
|
185
|
+
gh pr review <pr-number> --comment --body "Review summary"
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**API endpoint:** `POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews`
|
|
189
|
+
```json
|
|
190
|
+
{
|
|
191
|
+
"body": "Review summary",
|
|
192
|
+
"event": "APPROVE" | "REQUEST_CHANGES" | "COMMENT",
|
|
193
|
+
"comments": [
|
|
194
|
+
{
|
|
195
|
+
"path": "file.ts",
|
|
196
|
+
"line": 42,
|
|
197
|
+
"body": "Comment text"
|
|
198
|
+
}
|
|
199
|
+
]
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Step 10: Follow Up
|
|
204
|
+
|
|
205
|
+
- [ ] Respond to author's questions
|
|
206
|
+
- [ ] Re-review after changes are made
|
|
207
|
+
- [ ] Update review status if issues are resolved
|
|
208
|
+
|
|
209
|
+
## Review Checklist Summary
|
|
210
|
+
|
|
211
|
+
**Must Check:**
|
|
212
|
+
- ✅ Functionality works correctly
|
|
213
|
+
- ✅ Security vulnerabilities
|
|
214
|
+
- ✅ Test coverage adequate
|
|
215
|
+
- ✅ Follows project patterns
|
|
216
|
+
- ✅ PR size reasonable
|
|
217
|
+
- ✅ Breaking changes identified and properly handled
|
|
218
|
+
|
|
219
|
+
**Should Check:**
|
|
220
|
+
- Code quality and maintainability
|
|
221
|
+
- Performance considerations
|
|
222
|
+
- Documentation completeness
|
|
223
|
+
- Error handling
|
|
224
|
+
|
|
225
|
+
**Nice to Check:**
|
|
226
|
+
- Code style consistency
|
|
227
|
+
- Minor optimizations
|
|
228
|
+
- Documentation improvements
|
|
229
|
+
|
|
230
|
+
## Output Format
|
|
231
|
+
|
|
232
|
+
Provide:
|
|
233
|
+
|
|
234
|
+
1. **Review Summary:**
|
|
235
|
+
- Overall assessment
|
|
236
|
+
- Number of blocking/important/suggestion comments
|
|
237
|
+
- Key findings
|
|
238
|
+
|
|
239
|
+
2. **Comments Posted:**
|
|
240
|
+
- List of comments with file:line references
|
|
241
|
+
- Categorization (blocking/important/suggestion)
|
|
242
|
+
|
|
243
|
+
3. **Review Decision:**
|
|
244
|
+
- Approve / Request Changes / Comment
|
|
245
|
+
- Rationale
|
|
246
|
+
|
|
247
|
+
4. **Positive Feedback:**
|
|
248
|
+
- What was done well
|
|
249
|
+
- Appreciate good patterns or solutions
|
|
250
|
+
|
|
251
|
+
## Notes
|
|
252
|
+
|
|
253
|
+
- **Read every line** of changed code
|
|
254
|
+
- **Understand context** before commenting
|
|
255
|
+
- **Be constructive** - focus on code, not person
|
|
256
|
+
- **Ask questions** rather than making demands
|
|
257
|
+
- **Reference standards** from project rules
|
|
258
|
+
- **Test locally** if possible for complex changes
|
|
259
|
+
- **Focus on scope** - don't request out-of-scope changes
|
|
260
|
+
- Use the ask questions tool if PR context is unclear
|
|
261
|
+
|
|
262
|
+
## References
|
|
263
|
+
|
|
264
|
+
- [code-review.mdc](mdc:.cursor/rules/code-review.mdc) - PR review standards
|
|
265
|
+
- [general-best-practices.mdc](mdc:.cursor/rules/general-best-practices.mdc) - Code quality standards
|
|
266
|
+
- [testing.mdc](mdc:.cursor/rules/testing.mdc) - Test requirements
|
|
267
|
+
- [code-quality.mdc](mdc:.cursor/rules/code-quality.mdc) - Code structure standards
|