Issue and PR Templates
Earn 25 points (50 with Pro) in two steps
- ① Read through the lesson — each section gets a ✓ as you scroll through it.
- ② When every section has a ✓, tap Complete lesson.
0 of 11 read · keep scrolling
✦ See fewer ads and earn double points — 50 a lesson instead of 25 — with Pro
Lesson: Mastering Issue and Pull Request Templates in GitHub
Introduction: Why Standardized Communication Matters
In the world of software development, communication is often the greatest bottleneck. When working on a team, you have likely encountered situations where a developer opens a bug report that says nothing more than "It’s broken," or submits a pull request with a description that reads simply as "Fixed things." These scenarios force maintainers to waste precious time hunting for context, reproducing errors without enough data, or playing a guessing game about the intent of a code change. This lack of structure leads to frustration, slower development cycles, and an increase in technical debt.
GitHub Issue and Pull Request (PR) templates are the primary solution to this problem. By implementing templates, you create a structured environment where contributors are prompted to provide the exact information needed to resolve issues or review code effectively. Templates turn an unstructured, chaotic stream of requests into a predictable, manageable workflow. They act as a "contract" between the contributor and the maintainer, ensuring that both parties understand what is expected before a conversation even begins.
In this lesson, we will explore how to design, implement, and maintain these templates. We will move beyond the basics, looking at how to customize templates for different project needs, how to enforce quality through automation, and how to foster a culture of helpful documentation within your team. Whether you are managing a small open-source project or a large enterprise repository, mastering these tools will significantly improve your team's velocity and happiness.
Not read yet
Understanding the Anatomy of a Template
At its core, a GitHub template is simply a Markdown file stored in a specific location within your repository. When a user clicks "New Issue" or "New Pull Request," GitHub scans your repository for these files and presents the user with a pre-filled text area. This text area can contain headings, checkboxes, code blocks, and instructions that guide the contributor through the submission process.
The Directory Structure
GitHub looks for templates in specific directories within your repository. For issue templates, the standard location is the .github/ISSUE_TEMPLATE/ folder. For pull request templates, the file is typically located at the root of the .github/ folder, or inside the .github/PULL_REQUEST_TEMPLATE/ directory.
Why Markdown is the Perfect Choice
Using Markdown for templates is a deliberate design choice that allows you to format your requests without requiring the contributor to learn a complex interface. You can use bold text to emphasize requirements, lists to break down steps, and code blocks to provide examples of how to format logs or configuration snippets. Because it is plain text, it is version-controlled alongside your source code, meaning your templates evolve as your project evolves.
Callout: The Difference Between Issue and PR Templates While both serve to standardize communication, their goals differ. Issue templates are designed for discovery and diagnosis; they help you gather evidence about a bug or a requirement for a feature. Pull Request templates are designed for verification and context; they help the reviewer understand the "why" and the "how" of a change, ensuring that the code meets the project's standards before it is merged into the main branch.
Not read yet
Designing Effective Issue Templates
An effective issue template should be a filter that removes noise and retains signal. If your template is too long, users will ignore it; if it is too short, users will omit critical details. The key is to find the "Goldilocks zone"—providing enough prompts to be useful without being burdensome.
Essential Elements of a Bug Report Template
When someone reports a bug, you need to know what they were doing, what happened, and what they expected to happen. A robust bug report template should include:
- A Clear Problem Statement: A brief summary of the issue.
- Steps to Reproduce: A numbered list of actions a maintainer can take to see the bug themselves.
- Expected vs. Actual Behavior: A clear comparison to differentiate the bug from a feature request.
- Environment Details: Information about the OS, browser, or library version being used.
- Logs or Screenshots: A place to paste terminal output or attach visual evidence.
Example: A Standard Bug Report Template
Create a file named .github/ISSUE_TEMPLATE/bug_report.md:
---
name: Bug Report
about: Create a report to help us improve
title: '[BUG]: '
labels: bug
---
## Description
A clear and concise description of what the bug is.
## Steps to Reproduce
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
## Expected Behavior
A clear and concise description of what you expected to happen.
## Screenshots/Logs
If applicable, add screenshots or console output here.
## Environment
- OS: [e.g. macOS 14]
- Version: [e.g. v1.2.0]
Tip: Use YAML Frontmatter Notice the block at the top of the file enclosed in
---. This is called YAML frontmatter. It allows you to automatically assign labels, set the default issue title, and provide a description that appears in the GitHub UI when a user selects this template.
Not read yet
Designing Effective Pull Request Templates
Pull Request templates are your final line of defense against poor code quality. While automated tests catch syntax errors and logical failures, the PR template catches context gaps. It ensures that the developer has considered the impact of their changes, updated the documentation, and tested their code.
The "Must-Have" Checklist
A great PR template often acts as a checklist. By requiring the contributor to check off boxes, you force them to perform a final self-review. Your checklist should include:
- Self-Review: Did I read my own code?
- Tests: Did I add unit tests for my changes?
- Documentation: Did I update the README or API docs if necessary?
- Breaking Changes: Did I verify that this won't break existing functionality?
Example: A Robust PR Template
Create a file named .github/pull_request_template.md:
## Summary
Explain the purpose of this PR and what problem it solves.
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Documentation update
- [ ] Performance improvement
## Testing Instructions
Please describe the tests you ran to verify your changes. Provide instructions so the reviewer can reproduce the verification.
## Checklist
- [ ] My code follows the project's style guide.
- [ ] I have performed a self-review of my own code.
- [ ] I have added tests that prove my fix is effective.
- [ ] New and existing unit tests pass locally.
Not read yet
Advanced Configuration: Issue Forms
While Markdown files are great, they have a limitation: users can easily delete the text you provide. If you want to enforce specific fields (like forcing a user to select an OS from a dropdown), you should use Issue Forms. Issue Forms use a YAML-based syntax that creates a structured form in the GitHub UI, preventing users from simply deleting the template text.
Anatomy of an Issue Form
An issue form is defined in a YAML file in the .github/ISSUE_TEMPLATE/ directory. Instead of Markdown, you define inputs, dropdowns, and checkboxes.
name: Feature Request
description: Suggest an idea for this project
title: "[FEATURE]: "
labels: ["enhancement"]
body:
- type: textarea
id: description
attributes:
label: Description
description: Describe your feature idea.
placeholder: I would like to see a feature that...
validations:
required: true
- type: dropdown
id: priority
attributes:
label: Priority
options:
- Low
- Medium
- High
Using Issue Forms is a massive upgrade for larger projects. It ensures that data is consistently formatted, which makes it easier for maintainers to filter and search issues based on metadata.
Note: When to use Forms vs. Markdown Use standard Markdown templates when you want to keep the barrier to entry low and encourage free-form discussion. Use Issue Forms when you have high-volume repositories where data consistency is critical for triage and project management.
Not read yet
Best Practices for Implementation
Implementing templates is not a "set it and forget it" task. To get the most out of them, you must treat them as living documentation.
1. Keep Templates Concise
If a template is too long, contributors will start skipping sections. Only ask for the information that is absolutely necessary for you to take action. If you find yourself asking the same follow-up question on every issue, update the template to include that question.
2. Provide Examples within the Template
Don't just ask for "Logs"; show the user what a log looks like. Use code blocks inside your template to provide a "good" example. For instance, in your bug report template, you could say: "Please include logs in the following format: [ERROR] Connection failed at 12:00 UTC."
3. Use Labels and Projects
Templates are most powerful when they integrate with your workflow. Use the YAML frontmatter to auto-assign labels like bug, question, or help wanted. If you use GitHub Projects, you can even set up automation to move new issues into a specific column based on the template used.
4. Iterate Based on Feedback
Periodically review your templates. If you notice that contributors are consistently filling out a section incorrectly, the language in your prompt is likely confusing. Ask your team members what information they find most useful and prune the parts that don't help the review process.
Not read yet
Common Pitfalls and How to Avoid Them
Even with the best intentions, it is easy to fall into traps that frustrate contributors. Here are the most common mistakes and how to navigate them.
Over-Engineering the Process
The most common mistake is creating a bureaucratic nightmare. If your PR template has 30 checkboxes and requires a 500-word essay, people will stop contributing. Always prioritize the contributor experience. If the process is too hard, you are effectively telling potential contributors to go elsewhere.
Ignoring the "Why"
Templates should explain why information is needed. Instead of just saying "Environment," explain that "Knowing your environment helps us reproduce platform-specific bugs." People are much more likely to provide high-quality data if they understand how it helps the project.
Failing to Update Templates
Projects change. A template that worked when your project was a small script might be insufficient when it becomes a complex library. Review your templates every few months during a team sync or a milestone planning meeting.
Callout: The "Human" Aspect of Templates Templates can feel cold and robotic. To counteract this, add a friendly introduction to your templates. A simple "We appreciate you taking the time to report this!" or "Thanks for contributing!" goes a long way in making the project feel welcoming and community-driven.
Not read yet
Comparison: Markdown Templates vs. Issue Forms
| Feature | Markdown Templates | Issue Forms (YAML) |
|---|---|---|
| Ease of Creation | Very easy (just write text) | Moderate (requires YAML knowledge) |
| Enforcement | Low (user can delete text) | High (enforced via validation) |
| Input Types | Text only | Dropdowns, checkboxes, text, dates |
| Data Structure | Unstructured | Structured (machine readable) |
| Best For | Small projects, quick feedback | Large projects, high-volume triage |
Step-by-Step Implementation Guide
If you are ready to set up templates for your repository, follow these steps:
- Create the Directory: Run
mkdir -p .github/ISSUE_TEMPLATEin your repository root. - Draft Your Content: Open your text editor and create a new file named
bug_report.md. Write your template using the standard headings we discussed. - Add Frontmatter: Include the
name,about,title, andlabelsfields at the top of the file. - Commit and Push: Add the file to your repository and push it to the main branch.
- Test: Navigate to your repository on GitHub, click the "New Issue" button, and verify that your template appears in the selection list.
- Create a PR Template: Create a file named
pull_request_template.mdin the.github/folder and include your checklist. - Gather Feedback: Ask a teammate to open a test issue or PR using the new templates and provide feedback on whether the process felt intuitive.
Not read yet
Integrating Templates with GitHub Actions
One of the most powerful ways to use templates is to combine them with GitHub Actions. For example, you can use an Action to automatically close any issue that does not follow the template structure, or use an Action to add a comment to a new PR reminding the user to check their boxes.
Example: Auto-Commenting on PRs
You can create a workflow in .github/workflows/pr-reminder.yml that detects when a PR is opened and posts a friendly reminder:
name: PR Reminder
on:
pull_request:
types: [opened]
jobs:
remind:
runs-on: ubuntu-latest
steps:
- name: Comment on PR
uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Thanks for the PR! Please ensure you have completed the checklist in the PR template before requesting a review.'
})
This ensures that even if a user ignores the template, they receive a gentle nudge to follow the project standards.
Not read yet
Frequently Asked Questions (FAQ)
Q: Can I have multiple issue templates?
A: Yes! You can create as many files as you need in the .github/ISSUE_TEMPLATE/ directory. GitHub will show a menu to the user, allowing them to choose the one that best fits their needs (e.g., "Bug Report," "Feature Request," "Security Vulnerability").
Q: Can I change the default issue template?
A: By default, GitHub shows the "Open a blank issue" option. You can create a file named config.yml in the .github/ISSUE_TEMPLATE/ directory to hide the blank issue option and force users to pick a template.
Q: Are templates visible to the public? A: Yes, anyone who can view your repository can see the templates. This is a benefit, as it helps external contributors understand your project's standards before they even start working.
Q: Should I use templates for private repositories? A: Absolutely. Templates are just as useful for internal teams as they are for open-source projects. They reduce the amount of time spent in "back-and-forth" emails or chat messages trying to clarify what a task involves.
Not read yet
Key Takeaways
- Standardization is Efficiency: Templates remove ambiguity, reduce back-and-forth communication, and ensure all necessary information is captured the first time.
- Choose the Right Tool: Use Markdown templates for flexibility and ease of use; use YAML Issue Forms for data-heavy projects that require strict input validation.
- The "Goldilocks" Principle: Keep your templates concise. Ask for enough information to be useful, but not so much that you discourage contributors from engaging.
- Templates are Living Documents: Treat your templates as part of your codebase. Update them regularly based on the feedback you receive from your team and your contributors.
- Automation is Your Friend: Use GitHub Actions to enforce template usage and provide helpful feedback to contributors, ensuring that your standards are consistently applied.
- Culture Matters: Use the tone of your templates to set the culture of your project. Be professional, clear, and welcoming to ensure that everyone feels empowered to contribute effectively.
- Always Provide Context: Whether in an issue or a PR, the template exists to guide the contributor toward providing context. Never assume the reviewer knows what the reporter is thinking.
By implementing these strategies, you are not just setting up a few text files; you are building a professional, scalable, and welcoming environment for development. Start small, iterate often, and watch how your team's communication improves as a result.
Not read yet
Each section gets a ✓ as you scroll through it. Tap the button to jump to the next one.
- What is Version Control
- What is Version Control Quiz5q
- Benefits of Version Control
- Benefits of Version Control Quiz5q
- Introduction to Git
- Introduction to Git Quiz5q
- Git vs GitHub Differences
- Git vs GitHub Differences Quiz5q
- Understanding Repositories
- Understanding Repositories Quiz5q
- Commits and Commit History
- Commits and Commit History Quiz5q
- Branches and Branching Strategies
- Branches and Branching Strategies Quiz5q
- GitHub Accounts and Profiles
- GitHub Accounts and Profiles Quiz5q
- GitHub Organizations
- GitHub Organizations Quiz5q
- GitHub Enterprise Options
- GitHub Enterprise Options Quiz5q
- GitHub Flow for Collaboration
- GitHub Flow for Collaboration Quiz5q
- Markdown Basics
- Markdown Basics Quiz5q
- GitHub Desktop Application
- GitHub Desktop Application Quiz5q
- GitHub Mobile
- GitHub Mobile Quiz5q
- Repository Structure Overview
- Repository Structure Overview Quiz5q
- README Files Best Practices
- README Files Best Practices Quiz5q
- LICENSE Files and Open Source
- LICENSE Files and Open Source Quiz5q
- CONTRIBUTING Guidelines
- CONTRIBUTING Guidelines Quiz5q
- CODEOWNERS File
- CODEOWNERS File Quiz5q
- SECURITY Policy Files
- SECURITY Policy Files Quiz5q
- Creating Repositories
- Creating Repositories Quiz5q
- Repository Templates
- Repository Templates Quiz5q
- Managing Files in Repositories
- Managing Files in Repositories Quiz5q
- Repository Insights and Metrics
- Repository Insights and Metrics Quiz5q
- Stars and Feature Previews
- Stars and Feature Previews Quiz5q
- Dependency Insights
- Dependency Insights Quiz5q
- Introduction to Issues
- Introduction to Issues Quiz5q
- Pull Requests Fundamentals
- Pull Requests Fundamentals Quiz5q
- GitHub Discussions
- GitHub Discussions Quiz5q
- Linking PRs to Issues
- Linking PRs to Issues Quiz5q
- Issue and PR Templates
- Issue and PR Templates Quiz5q
- Filters and Assignments
- Filters and Assignments Quiz5q
- Introduction to GitHub Actions
- Introduction to GitHub Actions Quiz5q
- GitHub Actions Components
- GitHub Actions Components Quiz5q
- Introduction to GitHub Copilot
- Introduction to GitHub Copilot Quiz5q
- Copilot Agents and Agent Mode
- Copilot Agents and Agent Mode Quiz5q
- Multi-Model Support in Copilot
- Multi-Model Support in Copilot Quiz5q
- Copilot Plans Comparison
- Copilot Plans Comparison Quiz5q
- Introduction to GitHub Projects
- Introduction to GitHub Projects Quiz5q
- Project Layout Options
- Project Layout Options Quiz5q
- Configuring Projects
- Configuring Projects Quiz5q
- Labels and Milestones
- Labels and Milestones Quiz5q
- Project Workflows
- Project Workflows Quiz5q
- Saved Replies and Assignees
- Saved Replies and Assignees Quiz5q
- Project Insights and Analytics
- Project Insights and Analytics Quiz5q
- Two-Factor Authentication
- Two-Factor Authentication Quiz5q
- Passkeys for Authentication
- Passkeys for Authentication Quiz5q
- Repository Access Permissions
- Repository Access Permissions Quiz5q
- Organization Roles
- Organization Roles Quiz5q
- Enterprise Managed Users
- Enterprise Managed Users Quiz5q
- Copilot Policy Management
- Copilot Policy Management Quiz5q
- Benefits of Open Source
- Benefits of Open Source Quiz5q
- GitHub Sponsors
- GitHub Sponsors Quiz5q
- Supporting Open Source Projects
- Supporting Open Source Projects Quiz5q
- Following Users and Organizations
- Following Users and Organizations Quiz5q
- GitHub Marketplace
- GitHub Marketplace Quiz5q
- InnerSource Principles
- InnerSource Principles Quiz5q
Spend your points to unlock exam-style practice questions
Spend points to unlock GH-900 exam-style practice questions.
Practice for GH-900