Skip to content

Commit 1c09413

Browse files
docs: add guidance for creating smaller, self-contained PRs (calcom#27155)
* docs: add guidance for creating smaller, self-contained PRs Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: remove PR size check from cubic-devin-review.yml per review feedback Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * docs: clarify PR size limits apply to code files only Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent a0ff6b1 commit 1c09413

3 files changed

Lines changed: 60 additions & 0 deletions

File tree

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,4 @@ A visual demonstration is strongly recommended, for both the original and new ch
4242
- My code doesn't follow the style guidelines of this project
4343
- I haven't commented my code, particularly in hard-to-understand areas
4444
- I haven't checked if my changes generate no new warnings
45+
- My PR is too large (>500 lines or >10 files) and should be split into smaller PRs

AGENTS.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,49 @@ You are a senior Cal.com engineer working in a Yarn/Turbo monorepo. You prioriti
3030
- Never skip running type checks before pushing
3131
- Never create large PRs (>500 lines or >10 files) - split them instead
3232

33+
## PR Size Guidelines
34+
35+
Large PRs are difficult to review, prone to errors, and slow down the development process. Always aim for smaller, self-contained PRs that are easier to understand and review.
36+
37+
### Size Limits
38+
39+
- **Lines changed**: Keep PRs under 500 lines of code (additions + deletions)
40+
- **Files changed**: Keep PRs under 10 code files
41+
- **Single responsibility**: Each PR should do one thing well
42+
43+
**Note**: These limits apply to code files only. Non-code files like documentation (README.md, CHANGELOG.md), lock files (yarn.lock, package-lock.json), and auto-generated files are excluded from the count.
44+
45+
### How to Split Large Changes
46+
47+
When a task requires extensive changes, break it into multiple PRs:
48+
49+
1. **By layer**: Separate database/schema changes, backend logic, and frontend UI into different PRs
50+
2. **By feature component**: Split a feature into its constituent parts (e.g., API endpoint PR, then UI PR, then integration PR)
51+
3. **By refactor vs feature**: Do preparatory refactoring in a separate PR before adding new functionality
52+
4. **By dependency order**: Create PRs in the order they can be merged (base infrastructure first, then features that depend on it)
53+
54+
### Examples of Good PR Splits
55+
56+
**Instead of one large "Add booking notifications" PR:**
57+
- PR 1: Add notification preferences schema and migration
58+
- PR 2: Add notification service and API endpoints
59+
- PR 3: Add notification UI components
60+
- PR 4: Integrate notifications into booking flow
61+
62+
**Instead of one large "Refactor calendar sync" PR:**
63+
- PR 1: Extract calendar sync logic into dedicated service
64+
- PR 2: Add new calendar provider abstraction
65+
- PR 3: Migrate existing providers to new abstraction
66+
- PR 4: Add new calendar provider support
67+
68+
### Benefits of Smaller PRs
69+
70+
- Faster review cycles and quicker feedback
71+
- Easier to identify and fix issues
72+
- Lower risk of merge conflicts
73+
- Simpler to revert if problems arise
74+
- Better git history and easier debugging
75+
3376
## Commands
3477

3578
### File-scoped (preferred for speed)

CONTRIBUTING.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,22 @@ If you get errors, be sure to fix them before committing.
190190

191191
## Making a Pull Request
192192

193+
### Keep PRs Small and Focused
194+
195+
Large PRs are difficult to review and more prone to errors. We strongly encourage smaller, self-contained PRs:
196+
197+
- **Size limits**: Keep PRs under 500 lines of code changed and under 10 code files modified (excludes documentation, lock files, and auto-generated files)
198+
- **Single responsibility**: Each PR should address one concern (one feature, one bug fix, or one refactor)
199+
- **Split large changes**: If your task requires extensive changes, break it into multiple PRs that can be reviewed and merged independently
200+
201+
**How to split large changes:**
202+
- Separate database/schema changes from application logic
203+
- Split frontend and backend changes when possible
204+
- Do preparatory refactoring in a separate PR before adding new features
205+
- Create PRs in dependency order (infrastructure first, then features)
206+
207+
### PR Checklist
208+
193209
- Be sure to [check the "Allow edits from maintainers" option](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork) when creating your PR. (This option isn't available if you're [contributing from a fork belonging to an organization](https://github.com/orgs/community/discussions/5634))
194210
- If your PR refers to or fixes an issue, add `refs #XXX` or `fixes #XXX` to the PR description. Replace `XXX` with the respective issue number. See more about [linking a pull request to an issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue).
195211
- Fill out the PR template accordingly.

0 commit comments

Comments
 (0)