GitHub Pull Request Template for CLI and Agent PRs
Set up a GitHub pull request template, fill it with tests and review evidence, and pass the finished Markdown to GitHub CLI when an agent opens a PR.

A GitHub pull request template gives every reviewer the same place to look for the change, the work item, and the tests that actually ran. Put it in .github/pull_request_template.md and merge it to the default branch. When a coding agent opens the PR with GitHub CLI, give it a filled Markdown file and pass that file with gh pr create --body-file.
The repository template helps an author start. When automation supplies the body text, the text needs to contain the evidence you want to see. A two-line summary can describe the diff accurately while leaving the reviewer with no way to tell what was tested or what still needs an answer.
Start with a template reviewers can use
Use the same headings for people and agents. Keep each prompt narrow enough that the author can tell whether they have answered it. This example asks for five things. Two of them, risk and the reviewer’s decision, are especially easy to lose when a tool rewrites the body from the diff.
## Change
<!-- Describe the observable change. -->
## Work item
<!-- Link the work item. -->
## Test evidence
<!-- List the commands actually run and the results. -->
## Risk
<!-- Describe the remaining uncertainty. -->
## Reviewer decision
<!-- Name the decision the reviewer owns. -->
Commit this as .github/pull_request_template.md. GitHub’s template guide also supports the repository root and docs/. Use one default location so a teammate knows which file to change. Put the file on the default branch before relying on automatic prefilling.
Use the work item for the durable context. If the issue describes what should happen, the PR should say what changed and show evidence the reviewer can examine. For acceptance criteria with multiple owners or several links between specifications and checks, keep the full requirements traceability matrix in the work record and link it from the PR.
Write the evidence at the point of work
A useful test entry includes a command, the relevant result, and the boundary of the check. For instance, “four invitation status tests passed” tells the reviewer what was observed. “Mobile screenshot not run” tells them where the evidence ends. Keep both. A reviewer can decide whether the missing check should block merging.
If CI will run the test later, say so. A planned workflow run is a future observation. If the author has an existing result, link the relevant job or paste a short excerpt that excludes credentials and private data. For changes touching several jobs, attach the single most useful result next to the line it supports. Reviewers can open the full logs if they need them.
The last section should name a decision in concrete terms. “Approve the wording for expired invitations and confirm it fits on mobile” gives a person something to check. “Please review” just restates the notification. For ownership of the review request, use your CODEOWNERS setup. The body carries evidence and questions to the person who receives it.
Choose the right GitHub CLI input
The GitHub CLI manual describes three distinct inputs. A template is starting text. A body or body file is the supplied description. The CLI implementation rejects combining --template with either --body or --body-file. Use the template to prepare the body before invoking the command.
| How the PR starts | What the reviewer gets | When it fits |
|---|---|---|
| Web form with the default template | The template starts in the body editor, then the author fills it | A person writes the PR interactively |
gh pr create --template path |
Starting text that the author fills in the interactive flow | A person opens the PR from the terminal |
gh pr create --body "Short summary" |
The explicitly supplied summary | An intentionally simple description |
gh pr create --body-file path |
The text of the prepared Markdown file | A person or agent has already collected evidence |
Explicitly supplying a title and Markdown file makes the handoff inspectable before opening the PR. There is no need to put generated content inside shell quotes. A file lets the author inspect headings, fenced code and multiline notes in the same form they will send. If the body contains a literal command with quotes or substitutions, it remains text in the Markdown.
Fill and review the body first
From the repository root, copy the template to a temporary file and open it in your editor. This example uses a POSIX-compatible shell. A person can use an editor of their choice. A coding agent can fill the file from its actual work record.
body_file="$(mktemp)"
cp .github/pull_request_template.md "$body_file"
vi "$body_file"
Open the completed file before sending it. Check each answer against the change. In particular, make sure the test output comes from the current revision and the risk section describes what the tests did not exercise. For a chain of stacked pull requests, name the parent or set the base deliberately so reviewers can tell which change they are being asked to review.
When the body is ready and you want to open the actual PR, supply its path and a title. This example opens a draft PR. It assumes an authenticated CLI and the intended branch and base.
gh pr create --draft --title "Show expired invitation status" --body-file "$body_file"
A draft PR is still a GitHub write. For an offline check, inspect the file or run a local evidence checker. The CLI manual warns that its --dry-run can still push Git changes, so use the local file check when you need a preview without a remote operation.
A filled example with an explicit review question
Here is what the same template looks like after filling it. The ticket, command result and review decision below are synthetic examples. Replace them with actual evidence from the work you are submitting.
## Change
Expired invitations display a readable status.
## Work item
#42
## Test evidence
npm test -- invite-status.test.js: 4 passed in this example.
## Risk
Not run: mobile screenshot. The copy can still wrap on narrow screens.
## Reviewer decision
Approve the wording and confirm the mobile layout.
Compare this to “Updated invitation status. All good.” Both describe a change. Only the filled version tells the reviewer that desktop assertions and a mobile visual check are different pieces of evidence. The distinction helps when several coding agents work on the same flow. One can confirm the behavior and leave the visual decision open for the person reviewing the UI.
For a real report, record a failure with the same precision. A single failing assertion with its command and target is useful. The reviewer can decide whether the failure belongs to the change or an unrelated issue. If a coding-agent review raised a concern, summarize the concern and point to the test or line that resolved it. Leave an open concern visible when the evidence stops short.
What a local body check catches
We tested eight synthetic Markdown bodies locally. A small checker looked for the five headings and required each to have text after removing prompt comments. It flagged a missing heading, an empty answer, a repeated section, and the template copied without filling it. It also showed where a shape check stops being useful.
| Example body | Result |
|---|---|
| One-line summary | Flagged all five missing sections |
| Template copied without filling it | Flagged five unanswered sections |
| The filled invitation example | Accepted all five sections |
| Missing risk heading | Flagged one missing section |
| Empty reviewer decision | Flagged the blank decision |
| Repeated test evidence heading | Flagged the duplicate section |
| Test marked “Not run” with a reason | Accepted the text and left the decision to the reviewer |
| Only “Looks good” under test evidence | Accepted the shape |
The checker accepted “Looks good” because the section contained words. Its result covers Markdown structure. We did not connect to GitHub or run the sample application tests. The fixture checked the prepared Markdown. GitHub’s default-branch behavior and CLI arguments above come from the official documentation and source.
If you add a check to your own workflow, start with the cases that caused review delays. An empty body is easy to flag. A team might also require a short reason when a check did not run. Use CI for the actual test execution and independent review for the judgment. Let a deliberately incomplete draft remain a draft while the author gathers the evidence.
Keep the local check small
Treat heading names as part of the template. Give the checker one accepted answer format per section, and have it print the heading that needs attention. When a team changes a heading, update the template and checker together. Start with a warning during rollout if several existing authors or tools still produce a different format.
Watch for a separate issue when the template appears in the web form but disappears for agents. First, confirm both authors use the same repository. Then inspect the agent’s creation command for a supplied body or generated summary. If the author passes their own text, fix how it is prepared. If the template is missing for people in the web form too, verify the filename and default branch before changing the agent workflow.
Put the handoff in the authoring instructions
Add a short rule to the repository’s authoring instructions. Ask authors to read the template, copy it into a draft file, fill it from evidence, and pass that file with --body-file. State what to do if a command was skipped or the reviewer still has a decision. The same instructions help a teammate using the terminal. Use Antislop when editing agent-written PR prose. Keep the test command, observed result, and any open reviewer decision intact.
Keep a shared record of the work item, outcomes and unresolved decisions when several agents contribute. SyncStaff can record the work and its decisions. The repository template and GitHub CLI carry the parts the reviewer needs into the PR itself. Choose one agent-authored change this week and check whether its body gives a reviewer enough evidence to make the next decision without going back to the author.
Frequently asked questions
Where do I put a GitHub pull request template?
Place a Markdown file named pull_request_template.md in the repository root, the .github directory, or the docs directory. Merge it to the repository’s default branch before expecting GitHub to prefill the body. Pick a single location for your default template so maintainers know which file to update.
Why did my GitHub CLI pull request skip the template?
Check whether the command supplied a body with --body or --body-file. Those options provide the description explicitly. If you want the template sections in an automated submission, copy the stored Markdown into a working file, fill it with the PR’s evidence, and pass the completed file with --body-file.
Can I combine gh pr create --template and --body-file?
No. GitHub CLI rejects --template when you also supply --body or --body-file. Use --template as starting text in an interactive workflow. For automation, prepare a copy of the Markdown first and pass that finished file with --body-file. This keeps the submitted evidence visible before creating the pull request.
Does GitHub enforce every section in a pull request template?
The template gives contributors a consistent starting body. A separate check can detect missing sections or empty placeholders, and reviewers can check what the answers mean. Use the actual test jobs for execution evidence and the repository’s review rules for required approval when those steps should block a merge.
What should a coding agent put under test evidence?
Ask for the precise command, the result observed, and any important check that did not run. Link a relevant CI job when one exists. If there is no run to report, state what was skipped and why, then leave the remaining decision with the reviewer.