Build step D: commit a code repo''s PR/MR template, with the Impact & Risk block that sets the approval count. Use when the user says "add the PR template" or "set up the MR template" for a repo.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Yad Pr Template?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/abdelrahmannasr-yad-pr-template)
---
name: yad-pr-template
description: 'Build step D: commit a code repo''s PR/MR template, with the Impact & Risk block that sets the approval count. Use when the user says "add the PR template" or "set up the MR template" for a repo.'
---
# SDLC — PR/MR Template (Build Step D)
**Goal:** Commit the platform-correct PR/MR template into a code repo so every PR/MR carries an
**Impact & Risk** block and a checklist tied to the check gates. A **high** risk level (or a touched
contract surface) **raises the approver count** — the same count `yad-review-gate` prints on
the Shape gates: base 1 (someone other than the author, enforced) plus a risk step (`high` +1, contract
+2, advisory — branch protection holds the merge; `yad open-pr` shows the count capped by the active
people). This step **never auto-advances**; it sets up the template and the
routing helper.
## Conventions
- `{project-root}` resolves from the project working directory — the **product** repo (holds the
canonical templates under this skill).
- Code repos are separate git repos under `{project-root}/demo-repos/<repo>/`.
- Canonical sources live in this skill's `templates/`:
- `templates/github/pull_request_template.md` → installs to `<repo>/.github/pull_request_template.md`
- `templates/gitlab/merge_request_templates/Default.md` → installs to
`<repo>/.gitlab/merge_request_templates/Default.md`
- `templates/checks/risk-route.sh` → installs to `<repo>/checks/risk-route.sh` (advisory routing helper)
- **Product variants** (`repo: product`) — Shape artifact-review PR/MR bodies:
`templates/product/github/pull_request_template.md` → `{project-root}/.github/pull_request_template.md`;
`templates/product/gitlab/merge_request_templates/Default.md` →
`{project-root}/.gitlab/merge_request_templates/Default.md`. The Product body carries no `Task:` trailer
(Product PRs change artifacts, not code); its routing helper is `yad-product-bridge`'s
`templates/checks/product-route.sh`, run from the skill (nothing installs it into the Product's `checks/`).
- **GitLab reads a truncated description.** The `pr-template` gate is fed
`$CI_MERGE_REQUEST_DESCRIPTION`, which GitLab cuts at **2700 characters** — a required section below
that cutoff is invisible to the gate even though the MR shows it, and the failure reads "does not use
the template" (#164). Both GitLab templates say so in a comment and keep `## Summary` /
`## Impact & Risk` / `## Checklist` (Product: `## Artifact under review` / `## Impact & Risk (front-half)`
/ `## Checklist`) early, so a truncated body still passes. Long narrative goes **after** them.
Sections may be reordered freely; deleting one fails the gate. GitHub is unaffected. Since #343 the gate
reads a cut description again in full from the merge request API, with the `GITLAB_TOKEN` CI/CD
variable (`read_api`) or the job's own token where GitLab allows it — so order matters only when
neither can read it, as in a fork's pipeline (see `yad-checks` `references/check-gates.md`).
- **Installed code-repo templates are yad-managed.** `yad update` rewrites them on upgrade (the Product
variants under `templates/product/` are copied by hand in Step 2 and are not managed). An edit yad can
prove — the file's sha differs from the one it recorded when it wrote the template — is reported as
`modified` and left alone; a copy it has no record of is replaced after a `.yad-orig` backup (see
`docs/CLI.md` → *Managed files*). Either way, put knowledge that must survive an upgrade in an ADR
under `docs/`, not in the template.
- The Impact & Risk block reuses the conventions of earlier steps: the `Task: <story>-<task>` trailer
(`yad-implement`), the contract surface (`yad-architecture` / contract-check), and the
approver count (`yad-review-gate`).
- **PR/MR title.** One atomic task = one branch = one PR/MR (or a group of small tasks of one story, #350,
whose body lists every task), so the title **defaults to that task's
commit subject** and follows the same Conventional Commits style — `<type>: <lowercase imperative
description, no trailing period>`, proper nouns/acronyms keep their case (`config.yaml`
`build.pr_title_style`; see `CONTRIBUTING.md`). Because PRs are squash-merged, the title becomes the
merge commit subject — so it must be the clean, lowercase-after-the-type form, not `Fix: ...` or a
trailing period. On GitLab, a draft MR's `Draft:` / `[Draft]` / `(Draft)` prefix is ignored by the
gate (GitLab removes it when the MR is marked ready, #451).
## Inputs
- `repo` — the code repo to add the template to (one of an epic's repos), or `product` for the Product (`hub`, the old name, still works). A code repo that is itself named
`product`: give its registered path instead (for example `repos/product`), so it is not taken for the Product.
- `action` — `wire` (commit the matching template + helper) | `route` (print the approver count from a
PR body). Default `wire`.
- `body` — for `route`: a file holding the PR/MR description to evaluate.
## On Activation
### Step 1 — Resolve the repo and detect the platform
Map `repo` → `{project-root}/demo-repos/<repo>/` (or the registry `path`). A `repo` value with a `/` in it is a registry `path`, not a name: match it against each entry's `path`
(so a code repo named `product` is reached as, for example, `repos/product`). Detect the platform: a GitHub
remote or `.github/` → GitHub; a GitLab remote or `.gitlab/` → GitLab. If ambiguous, ask. For
`repo: product`, the target is `{project-root}` itself and the platform comes from `.sdlc/product.json` (`.sdlc/hub.json` on an older Product that has only that name).
### Step 2 — `wire` (drop only the matching template)
Copy from this skill's `templates/`:
- GitHub → `templates/github/pull_request_template.md` to `<repo>/.github/pull_request_template.md`.
- GitLab → `templates/gitlab/merge_request_templates/Default.md` to
`<repo>/.gitlab/merge_request_templates/Default.md`.
- **`repo: product`** → use the `templates/product/<platform>/…` variants, installed into `{project-root}`'s own
`.github/`/`.gitlab/`. The Product's routing helper (`product-route.sh`) stays in `yad-product-bridge`'s
`templates/checks/`; neither this skill nor `yad setup` / `yad check --fix` installs it.
Drop **only the matching** template (drop both only if the repo genuinely uses both). For code repos also
install `templates/checks/risk-route.sh` to `<repo>/checks/` (`chmod +x`), beside
`../yad-checks/templates/checks/risk-map-check.sh` — risk-route reads the risk map through it, and
without it every count says "not counted". `yad update` installs both. If the target already has a
non-SDLC PR/MR template, do not clobber it — back it up / ask. Commit the template on the repo's default
branch (shared infrastructure, not a task diff).
### Step 3 — `route` (show how many approvers)
Run `bash checks/risk-route.sh <body> [<base>]` **inside the code repo, on the PR's branch** to parse the
PR description's Impact & Risk block, read the base branch's risk map, and print the approver count:
- **low | medium** risk → `ROUTE: 1 approver = base 1 (no risk step).`
- **high** risk → `ROUTE: 2 approvers = base 1 + high risk 1 (risk: high)`.
- a **contract surface** touched → `ROUTE: 3 approvers = base 1 + contract risk 2 (contract surface
touched)`. With `high` too, the larger step (contract) wins, never the sum.
- a change touching a directory the **base branch's** `.sdlc/risk-map` marks `high` → +1 as well (E66),
even when the body says `low`: the larger step wins, and the script says the two disagree. A `guessed`
level counts. When the map cannot be read, it says so and counts the body alone.
- that same `high` directory asks for an approval from someone who **committed there in the last 30
days** (E67). The script names them from the base branch's history, without this change's own authors,
as one list across every `high` directory touched; "nobody" and "not read" are said apart.
When the count is raised, the script adds that branch protection holds the merge, not this count (at
least 1 approval from someone other than the author), that the risk step is advisory and not capped
there (`yad open-pr` shows the count capped by the active people), and lists the touched
domains as a hint for whom to ask. The actual approvals are recorded by the engineer review (Step E),
via `yad-review-gate`.
When the PR/MR is actually opened with `yad open-pr`, **no reviewers are requested** — it prints `no
reviewers were requested — ask them on the PR itself`. The **assignee** is the person opening it: `@me`
on GitHub (resolved by `gh`), and on GitLab the login `glab` reports (no assignee is passed when that
lookup fails). yadflow keeps no list of people. After opening, it prints a reviewer suggestion (E68):
who has committed in the touched folders in the last 30 days, and what CODEOWNERS lists — a hint only,
never a request.
### Step 4 — Stop (no auto-advance)
Report what was committed (or the routing result). The template and routing are advisory inputs to the
human review (Step E); they do not approve or merge. Do not touch the epic's `.sdlc/` state.
## Hard rules (build plan §D, Cross-cutting)
- **Drop only the matching template** for the detected platform.
- **High risk raises the approver count** — the same count as the gate; never a separate rule.
- **Nothing auto-advances.** The template sets up review; the human owns the merge.
## Reference
- The Impact & Risk block, the risk levels, and the routing rule: `references/risk-routing.md`.
- The approver count this reuses: `../yad-review-gate/SKILL.md` and its `references/gating.md`.
- The check gates the checklist references: `../yad-checks/references/check-gates.md`.