This document explains how lazypr templates work, how to create custom templates, and how to use the official template collection to customize Pull Request summaries generated by the lazypr AI-powered GitHub Action.
Overview
lazypr generates intelligent Pull Request summaries using predefined or custom templates. Templates act as AI instructions, defining what context is provided and how the summary should be structured.
lazypr supports:
- Built-in templates (presets)
- Repository-level custom templates
Template Types
1. Built-in Presets
lazypr ships with built-in template presets located at:
packages/config-presets/src/index.ts
These presets are useful for quick setup or standardized workflows.
2. Custom Templates
Custom templates allow full control over:
- Output structure
- Reviewer focus
- Tone (formal, concise, instructional, etc.)
- Audience (clients, OSS contributors, internal teams)
Custom templates live inside your repository and are automatically detected by lazypr.
Template Variables (Placeholders)
Templates may include the following dynamic placeholders. These are replaced automatically at runtime.
PR Metadata
| Variable | Description |
|---|---|
{{prTitle}} | Title of the Pull Request |
{{prAuthor}} | GitHub username of the PR author |
{{prBody}} | Existing PR description |
Diff Context
| Variable | Description |
|---|---|
{{filesChanged}} | List of files modified in the PR |
{{diff}} | Sanitized git diff of the Pull Request |
Risk Context (Precomputed)
| Variable | Description |
|---|---|
{{riskLevel}} | Risk classification (Low, Medium, High, Critical) |
{{riskScore}} | Numerical risk score (0–100) |
{{highRiskFiles}} | Files flagged as high-risk |
{{fileBreakdown}} | File-level change analysis |
Custom Template Requirements
Every custom template must include the following placeholders:
{{diff}}{{filesChanged}}
Templates that omit these required fields will not be processed correctly.
Custom Template Resolution Order
When custom_template is enabled, lazypr searches for templates in the following order
(first match wins):
custom_template_path(if explicitly provided).github/lazypr-template.md.lazypr/template.mdlazypr-template.md
Recommended Starter Template
This template is suitable for most projects and balances clarity, brevity, and reviewer context.
You are an expert reviewer. Produce a concise Markdown summary.
PR:
- Title: {{prTitle}}
- Author: {{prAuthor}}
Risk:
- {{riskLevel}} ({{riskScore}}/100)
- High-risk files: {{highRiskFiles}}
Files:
{{filesChanged}}
Diff:
{{diff}}
Output format:
### TL;DR
<1-2 sentences>
### Key Changes
- <bullets>
### Notes for Reviewers
- <bullets>
lazypr Summary Templates
This directory contains a curated collection of specialized and generic summary templates for the lazypr GitHub Action.
Each template is designed for a specific workflow, audience, or review style.
GitHub Repository
All templates are publicly available at:
👉 https://github.com/elvis-ndubuisi/lazypr/tree/main/templates
How to Use These Templates
Option 1: Default Template (Recommended)
- Copy any template file.
- Place it at:
.github/lazypr-template.md
lazypr will automatically detect and use it with no additional configuration.
Option 2: Specify Template in Workflow
To select a template per repository or workflow, configure the GitHub Action input:
- uses: elvis-ndubuisi/lazypr@v1
with:
api_key: ${{ secrets.GEMINI_API_KEY }}
provider: gemini
custom_template: true
custom_template_path: templates/freelancer.md
Available Templates
Scenario-Specific Templates
| Template | Purpose |
|---|---|
Freelancer (freelancer.md) | Emphasizes value delivered and requirements completed |
Open Source (open-source.md) | Highlights community standards, issues, and quality checks |
Organization (organization.md) | Staff-engineer level review: architecture, security, ops |
Personal (personal.md) | Reflective summaries with lessons learned and TODOs |
Generic Use-Case Templates
| Template | Purpose |
|---|---|
Bug Fix (bug-fix.md) | Explains root cause and before/after behavior |
New Feature (new-feature.md) | Focuses on user experience and usage examples |
Refactor (refactor.md) | Explains motivation and confirms no regressions |
Security (security.md) | High-urgency vulnerability and risk analysis |
Documentation (documentation.md) | Tracks clarity, audience, and link correctness |
Minimalist (minimalist.md) | Ultra-short, 3-bullet summary |
Template Placeholders Reference
Required Placeholders
| Placeholder | Description |
|---|---|
{{diff}} | Required. Sanitized git diff |
{{filesChanged}} | Required. Modified files |
PR Metadata
| Placeholder | Description |
|---|---|
{{prTitle}} | Pull Request title |
{{prAuthor}} | PR author |
{{prBody}} | Existing PR description |
Risk Assessment
| Placeholder | Description |
|---|---|
{{riskLevel}} | Risk classification (Low, Medium, High) |
{{riskScore}} | Numerical risk score (0–100) |
{{highRiskFiles}} | Files flagged as high-risk |
{{fileBreakdown}} | File-level change analysis |
Ticket Detection (v1.2.0+)
| Placeholder | Description |
|---|---|
{{relatedTickets}} | Markdown list of detected tickets |
PR Size Metrics (v1.2.0+)
| Placeholder | Description |
|---|---|
{{prSizeLines}} | Total lines changed |
{{prSizeFiles}} | Number of files changed |
{{prSizeAdditions}} | Lines added |
{{prSizeDeletions}} | Lines deleted |
{{prSizeMetrics}} | Full metrics as formatted text |
Custom Placeholders (v1.2.0+)
Any placeholders defined in custom_placeholders input are also available. See custom placeholders guide.
Template Design Rules
To ensure consistent and reliable output:
- Templates must be written as AI instructions
- Use Markdown formatting
- Avoid triple backticks inside instruction blocks unless intentionally required in output
- Clearly define the expected response in the Output Format section
- Optimize for clarity, not verbosity
Recommended Best Practices (Author Opinion)
- Use scenario-specific templates for teams and clients
- Keep templates opinionated but structured
- Treat templates as review standards, not just formatting tools
- Prefer multiple templates over one overly complex template
- Version templates alongside architectural changes