The Hook (The "Byte-Sized" Intro)
"What does this PR do?" "How do I test it?" "Does it have breaking changes?" Without a template, reviewers ask the same questions on every PR. With a template, every PR arrives pre-organized: description, testing steps, screenshots, and a checklist. Reviewers review faster. Authors think more clearly. Quality goes up.
📖 What are Pull Request Templates?
Markdown templates that pre-fill the PR description with a consistent structure, guiding authors to provide the information reviewers need.
Conceptual Clarity
Template locations (GitHub):
| Location | Scope |
|---|---|
.github/pull_request_template.md | Default template |
.github/PULL_REQUEST_TEMPLATE/bug.md | Multiple templates |
docs/pull_request_template.md | Alternative location |
Essential sections:
| Section | Purpose |
|---|---|
| What | What does this PR do? |
| Why | Why is this change needed? |
| How | How was it implemented? |
| Testing | How to test it |
| Screenshots | Visual changes |
| Checklist | Pre-merge checks |
Real-Life Analogy
A PR template is like a standardized form at the doctor's office. Instead of describing symptoms in a blank page, you fill in structured fields: what hurts, when it started, what you've tried. The doctor (reviewer) gets the right information faster.
Visual Architecture
Why It Matters
- Consistency: Every PR has the same structure — nothing is missed.
- Speed: Reviewers find information faster.
- Quality: Authors think through their changes more carefully.
- Onboarding: New team members know exactly what's expected.
Code
<!-- .github/pull_request_template.md -->
## What does this PR do?
<!-- Describe the change and link the ticket -->
Closes #
## Why?
<!-- Why is this change needed? -->
## How was it implemented?
<!-- Key technical decisions and approach -->
## How to test
<!-- Steps to verify the change -->
1.
2.
3.
## Screenshots (if UI change)
<!-- Before/after screenshots -->
## Checklist
- [ ] Tests pass locally
- [ ] No console.log or debug statements
- [ ] Documentation updated (if needed)
- [ ] No breaking changes (or documented below)
- [ ] Self-reviewed the diff
## Breaking changes
<!-- List any breaking changes, or "None" -->
NoneKey Takeaways
- Place templates in
.github/pull_request_template.mdfor automatic use. - Include What, Why, How, Testing, and Checklist sections.
- Templates guide authors and speed up reviewers.
- Multiple templates can be offered for different PR types.
Interview Prep
-
Q: What are PR templates and why use them? A: Markdown files that pre-fill the PR description with a consistent structure. They ensure every PR includes necessary information (description, testing steps, checklist), speeding up reviews and improving quality.
-
Q: Where do you put a PR template in a GitHub repo? A:
.github/pull_request_template.mdfor a single default template. For multiple templates, use.github/PULL_REQUEST_TEMPLATE/directory with separate files (e.g.,bug.md,feature.md). -
Q: What should a PR template include? A: At minimum: What (description of change), Why (motivation), How to test, and a Checklist (tests pass, no debug code, self-reviewed). Screenshots for UI changes and a breaking changes section are also valuable.