Skip to content

Commit 3a183eb

Browse files
authored
chore: Add PR guidelines to cursor rules (#194)
## Summary Adds cursor rules for PR best practices and guidelines for updating PR titles/descriptions. Also enables Gemini reviews on draft PRs. ## Changes - Added `.cursor/rules/pull-requests-best-practices.mdc` with guidelines for: - PR title requirements (conventional commit format) - PR description requirements (must include summary, issue references, changes, impact) - Background agent PR requirements - PR template structure - Added `.cursor/rules/updating-pr-descriptions.mdc` with instructions for: - Using GitHub API to update PR titles/descriptions reliably - Workflow examples for updating PRs - Updated `.gemini/config.yaml` to set `include_drafts: true` so Gemini reviews draft PRs ## Impact / Benefits - Ensures all PRs (including those from background agents) have proper titles and descriptions - Provides clear guidelines for referencing issues in PRs - Enables code reviews on draft PRs via Gemini - Documents the reliable method for updating PR titles/descriptions using GitHub API ## Files Modified - `.cursor/rules/pull-requests-best-practices.mdc` (new) - `.cursor/rules/updating-pr-descriptions.mdc` (new) - `.gemini/config.yaml` (modified)
2 parents b894d2e + 850d1aa commit 3a183eb

File tree

3 files changed

+108
-1
lines changed

3 files changed

+108
-1
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
alwaysApply: false
3+
---
4+
5+
# Pull Request Best Practices
6+
7+
## PR Titles and Descriptions
8+
9+
### Title Requirements
10+
- All PR titles MUST follow conventional commit format with prefixes:
11+
- `fix:` for bug fixes
12+
- `feat:` for new features
13+
- `refactor:` for code refactoring
14+
- `chore:` for maintenance tasks
15+
- `docs:` for documentation changes
16+
- `test:` for test-related changes
17+
- `style:` for formatting changes
18+
- Titles should be descriptive and clearly indicate what the PR does
19+
- NEVER use generic titles like "Solve issue X and create PR" or "Fix issue Y"
20+
- Include the key change in the title (e.g., "fix: ColorModifier bugs - swapped min/max calculation")
21+
22+
### Description Requirements
23+
- All PR descriptions MUST include:
24+
1. A clear summary section explaining what the PR does
25+
2. Reference to related GitHub issues using "Fixes #XXX" or "Closes #XXX" format
26+
3. A "Changes" section listing what was modified
27+
4. An "Impact" or "Benefits" section explaining why this change matters
28+
5. Reference to any prerequisites or related PRs if applicable
29+
30+
### Background Agent PRs
31+
- When creating PRs via background agents or automated tools:
32+
- Always reference the related GitHub issue number in the title or description
33+
- Use descriptive titles that explain the actual change, not just "Solve issue X"
34+
- Include proper description sections as outlined above
35+
- Ensure the PR title matches the issue's title or key change
36+
37+
### PR Template Structure
38+
39+
All PRs should follow this structure:
40+
```
41+
## Summary
42+
[Clear one-paragraph explanation of what this PR does]
43+
44+
Fixes #XXX (or Closes #XXX)
45+
46+
## Changes
47+
- [List of specific changes made]
48+
49+
## Impact / Benefits
50+
[Explain why this change matters]
51+
52+
## Files Modified
53+
- [List of files changed, if not obvious from changes]
54+
55+
[Any additional context, testing notes, etc.]
56+
```
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
alwaysApply: false
3+
---
4+
5+
# Updating PR Descriptions and Titles
6+
7+
## When Updating Existing PRs
8+
9+
When updating PR titles or descriptions:
10+
1. Use GitHub API directly via `gh api` command for reliable updates
11+
2. The `gh pr edit` command may fail silently, so prefer the API approach
12+
3. For large bodies, use a temporary markdown file and read with `$(cat file.md)`
13+
14+
## Method
15+
16+
Use this format for reliable PR updates:
17+
18+
```bash
19+
REPO=$(gh repo view --json owner,name -q '.owner.login + "/" + .name')
20+
gh api repos/$REPO/pulls/XXX -X PATCH \
21+
-f title="fix: Descriptive title" \
22+
-f body="$(cat pr_body.md)"
23+
```
24+
25+
### Example Workflow
26+
27+
1. Create a temporary markdown file with the PR body:
28+
```bash
29+
cat > pr_body.md << 'EOF'
30+
## Summary
31+
[Description here]
32+
Fixes #XXX
33+
EOF
34+
```
35+
36+
2. Update the PR using GitHub API:
37+
```bash
38+
REPO=$(gh repo view --json owner,name -q '.owner.login + "/" + .name')
39+
gh api repos/$REPO/pulls/XXX -X PATCH \
40+
-f title="fix: Descriptive title" \
41+
-f body="$(cat pr_body.md)"
42+
```
43+
44+
3. Clean up the temporary file:
45+
```bash
46+
rm pr_body.md
47+
```
48+
49+
## Notes
50+
- Always verify the update worked by checking the PR with `gh pr view XXX`
51+
- The GitHub API method is more reliable than `gh pr edit` which can fail silently

.gemini/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ code_review:
88
help: false
99
summary: true
1010
code_review: true
11-
include_drafts: false
11+
include_drafts: true
1212

1313
ignore_patterns: []

0 commit comments

Comments
 (0)