legion-pr-write

Compose and validate PR bodies mapping issue acceptance criteria to code changes.

3|Updated Mar 5, 2026
One-click install
npx skills add https://github.com/runlegion/legion --skill legion-pr-write-runlegion
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: legion-pr-write
Source: https://github.com/runlegion/legion/tree/main/plugin/skills/legion-pr-write
Command: npx skills add https://github.com/runlegion/legion --skill legion-pr-write-runlegion

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? PR descriptions often fail to demonstrate that every acceptance criterion in the linked issue is actually satisfied, leaving reviewers to guess. This Skill forces you to write a criterion-by-criterion mapping with evidence before opening a PR, then validates the body with a gate that legion pr create requires. ## Core Features & Use Cases - Acceptance criteria mapping: Load criteria from the issue with legion issue view, re-read your diff, and write one ### entry per criterion with explanatory prose and evidence. - Gate validation: Run legion pr write-check to refuse empty or boilerplate mappings and record the gate that legion pr create checks on HEAD. - Auto-closing issues: Pass --closes to legion pr create so the merge appends the correct Closes #<issue> keyword, including cross-repo references. - Use Case: After finishing a feature branch, you write the PR body mapping each of the issue's five acceptance criteria to specific hunks and tests, validate it, and open the PR knowing the gate is clean. ## Quick Start Ask the agent to write the PR body for the current branch by mapping the issue's acceptance criteria to the diff, validate it with legion pr write-check, and open the PR with legion pr create.

Frequently Asked Questions about legion-pr-write

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a PR body that maps acceptance criteria to changes?

Load the criteria with legion issue view, re-read your diff with git diff main..HEAD, then write one ### subheading entry per criterion containing explanatory prose and a line of evidence such as a test name or file:line. Validate the result with legion pr write-check before opening the PR.

Why does legion pr write-check report fewer mapping entries than I wrote?

The parser splits mapping entries on ### subheadings only; bullets, numbered lists, and bold headings are invisible to it, and everything before the first ### is discarded. A body with five bullets and three ### headings counts as three entries.

Why is my acceptance criteria section not found by the validator?

The mapping section heading must contain both the words acceptance and mapping, and issue criteria are read only from ## headings exactly matching Acceptance criteria, Acceptance, Done when, or Done with no trailing punctuation. Fix the heading rather than rewriting the body.

Does legion pr create auto-close the linked issue on merge?

Yes, passing --closes <issue> appends a Closes #<issue> line idempotently, and it is repeatable for multiple issues including cross-repo owner/repo#N references. GitHub requires the keyword before each reference, so repeatable --closes emits one line per issue.

What happens if I commit again after the write-check gate passes?

The recorded gate no longer matches HEAD, so you must re-run legion pr write-check on the updated body. Re-running overwrites the previous gate row for HEAD, and the most recent result wins.