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 Pr Check?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/liferay-pr-check)
---
allowed-tools: [Agent, Bash, Edit, Glob, Grep, Read, Skill, Write]
argument-hint: "[--skip-pr-reviewer <reason>]"
description: Check that a PR is ready to be sent for review.
name: pr-check
---
# PR Check
Run premerge checks against the current branch. The skill iterates through the validations listed below, runs each one whose scope covers a changed path, and reports PASS or FAIL. Integration tests, Playwright tests, and Poshi tests are out of scope. Use the `test-plan` skill when their coverage is needed.
## Steps
1. [set_up_branch.sh](set_up_branch.sh) checks and rebases the branch and prints its commit messages for the wording check. See **Preconditions**.
1. [set_up_validations.sh](set_up_validations.sh) selects the validations the diff needs, writes the sections each one runs, and runs the shared builds they need. See **Pass 1: Estimate** and **Shared Preconditions**.
1. Each selected validation runs in a `pr-check-validation` subagent, apart from what [run_static_validations.sh](run_static_validations.sh) and [run_validation_scripts.sh](run_validation_scripts.sh) decide alone. See **Pass 2: Execute**.
1. The Results Summary records what was tested, and [record_run.sh](record_run.sh) records what the run cost. See **Results Summary**.
The subagent's rules, such as what each result means and when to commit, live in its definition, [pr-check-validation.md](../../agents/pr-check-validation.md). [testing.md](references/testing.md) describes how selection works and how to test a change to this skill.
Every script but `record_run.sh` exits 0 to continue and 1 to stop. When one exits 1, stop the run, dispatch no validation, publish no Results Summary, and give the developer the message it printed, which says what to do next.
## Repository Settings
Use the column for the repository that a remote of this checkout points at (check `git remote --verbose`). A branch that shares no history with a local `master-private`, including in a checkout that has none, uses the `liferay/liferay-portal` column, even when a remote points at `liferay/liferay-portal-ee`.
| Setting | `liferay/liferay-portal` | `liferay/liferay-portal-ee` |
| --- | --- | --- |
| **Base Branch** | `master` | `master-private` |
| **Forward Target** | `brianchandotcom/liferay-portal` | |
| **Scopes** | branch, portal, workspaces | branch, workspaces |
| **Skipped Validations** | Workspace Source Format | Source Format |
| **Rules Commit** | `HEAD` | `master` |
`liferay-portal` skips Workspace Source Format because Source Format already formats every changed file, workspace files included. `liferay-portal-ee` skips Source Format because the repository has no `portal-impl` to run the formatter from, and Workspace Source Format formats each workspace instead.
In `liferay-portal-ee`, this skill and its validations are copied from local `master`, so local `master` is the rules commit there.
`${BASE_BRANCH}` below stands for the **Base Branch** setting, and `${SOURCE_SHA}` stands for the **Rules Commit** setting, which is the commit this document and its validations were read from.
The **Forward Target** is the repository `ci:forward` merges a pull request into. When it is empty, skip every step below that uses it.
## Arguments
`--skip-pr-reviewer` skips the [PR Reviewer](validations/branch/pr-reviewer.md) validation for this run. A skip requires a reason: take it from the text following the flag when present, otherwise prompt the developer for one. Do not dispatch the validation, and leave it out of the Pass 1 estimate. List it in the Results Summary as `NOT VERIFIED` with the note `**PR Reviewer was skipped with --skip-pr-reviewer.** <reason>`, so that the skip and its reason travel into the PR description. Without the flag, run PR Reviewer whenever it is selected.
## Preconditions
Run [set_up_branch.sh](set_up_branch.sh) beside this document once, from anywhere in the checkout. It takes the column of the settings from the remotes and the history of the branch, and checks, in order, that `HEAD` is a feature branch with a clean working tree, that the branch started from `${BASE_BRANCH}` and adds no more than 500 commits over it, that the branch is rebased on the latest `${BASE_BRANCH}`, that `ci:forward` can merge it into the forward target, that `liferay-portal-ee` copied its skills from the latest `master`, that the diff is nonempty, and that no changed module holds a source file a personal ignore rule hides from Git, which passes every validation here and fails CI's clean checkout. To rebase, it fast forwards local `${BASE_BRANCH}` from `upstream`, or from the remote that points at the repository, and rebases onto it, or onto the forward target for a branch that already holds commits of the target that `${BASE_BRANCH}` lacks. It also links the checkout's Gradle build cache to the one every checkout on the machine shares, so a new worktree does not compile every module from scratch. In the same response that runs it, read [commit-message-wording.md](commit-message-wording.md) as a parallel call, so the check below costs no request of its own.
When it exits 0, the branch is ready. The last lines set `${BASE_BRANCH}`, `${BASE_REF}`, `${FORWARD_TIP}`, `${MERGE_BASE}`, and `${REPO_ROOT}`. `${BASE_REF}` is the diff baseline, which is `${FORWARD_TIP}` for a branch that sits on the forward target and local `${BASE_BRANCH}` otherwise. Above them, it prints the message of every commit the branch adds. Read them as [commit-message-wording.md](commit-message-wording.md) describes. When it flags or notes any text, show its block and ask the developer whether to stop and reword or to continue, before running `set_up_validations.sh`, so a reword costs no build. Never hold the block for the Results Summary. Relay each other line it prints above the settings to the developer in one line.
## Pass 1: Estimate
Run [set_up_validations.sh](set_up_validations.sh) beside this document once, as one foreground Bash call with a timeout of 600000 milliseconds:
```bash
bash <skill directory>/set_up_validations.sh "${MERGE_BASE}" "${BASE_BRANCH}"
```
It keeps a line for every validation in `${REPO_ROOT}/build/pr-check/selection.txt`: `== <file> (<count> paths)` for one that is selected, followed by its `## Preconditions` and `## Time Estimate` sections, and `-- <file> (not selected)` for one that is not. It prints only the lines of the selected validations, with each file relative to `validations`, then how many were not selected. A workspace validation names its workspace after the file. A validation is selected when `select_paths.sh` prints a path, and a workspace validation is tried once for each workspace the branch changed, as [testing.md](references/testing.md) describes.
The selected validations are the **selection**, the record of what this run owes. Pass 2 builds the table from it, so a selected validation is accounted for whether or not it ever ran.
Sum the time estimates of the selection for the cumulative total, counting a workspace validation once for each workspace it was selected for. Estimate from the path counts the script prints rather than resolving modules, since the total only decides whether to ask the developer. When the total exceeds 20 minutes, surface the breakdown and ask the developer whether to trim a validation or proceed, before Pass 2 dispatches anything.
## Shared Preconditions
A validation names the setup it needs under `## Preconditions`, and its **Command** never performs that setup itself. After the selection, `set_up_validations.sh` writes every validation's `## Command` and `## Autocommit` sections whole to `${REPO_ROOT}/build/pr-check/sections/<folder>/<validation file name>`, adding an **Autocommit** section that says no commit is made when the validation has none. It then takes the union of the names under `## Preconditions` across the selection, so a diff of Markdown alone installs no snapshot, stops when a name matches none of the builds below, and runs each once in the order below, with one log per build under `${REPO_ROOT}/build/pr-check/shared-preconditions`:
- **Portal Snapshots** builds the top level Ant projects and installs each as a snapshot under `${REPO_ROOT}/.m2`, so that a module compiles against the branch's own kernel. A build that exits zero can still leave an older snapshot that fails the first compile, so it then confirms that each project **Baseline** compares installed its snapshot at the version its `bnd.bnd` declares.
- **Portal Classpath** deploys the jars a module's test classpath reads from the app server. It leaves out CI's `unzip-tomcat` step, which deletes the bundle every checkout shares.
- **SDK** sets up the SDK the source formatter runs from.
After each build it restores any tracked file the build rewrote as a side effect, such as a `bnd.bnd` or `packageinfo` version bump, and prints a line naming them. Relay each one in one line.
When it exits 0, every build it ran succeeded and every section file is written, so start Pass 2 without checking either. The builds take about 6 minutes in a new worktree and about 1 minute in a built one. When the call times out, it keeps running in the background. Never start it again, and wait for its completion notice without reading its output.
## Pass 2: Execute
Run the validations in the order below. The order is dependency-driven: drift first (later validations see the regenerated tree), then formatting, then build, then tests.
1. [Instance Wrapper Build](validations/portal/instance-wrapper-build.md)
1. [REST Builder](validations/portal/rest-builder.md)
1. [Service Builder](validations/portal/service-builder.md)
1. [Go Generate](validations/portal/go-generate.md)
1. [Generated Workspace File](validations/workspaces/generated-file.md)
1. [PR Reviewer](validations/branch/pr-reviewer.md)
1. [Source Format](validations/branch/source-format.md)
1. [Redundant Assert Message](validations/branch/redundant-assert-message.md) (static)
1. [Redundant Contains on Race Receivers](validations/branch/redundant-contains-race-receivers.md) (static)
1. [Useless Volatile](validations/branch/useless-volatile.md) (static)
1. [Workspace Source Format](validations/workspaces/source-format.md)
1. [Go Source Format](validations/portal/go-source-format.md)
1. [Unused Project Dependencies](validations/branch/unused-project-dependencies.md) (static)
1. [Module Registration](validations/portal/module-registration.md)
1. [BND Content](validations/branch/bnd-content.md) (static)
1. [Portlet Title](validations/portal/portlet-title.md) (static)
1. [Index Action Label](validations/portal/index-action-label.md) (static)
1. [BND DS Annotations Options](validations/branch/bnd-dsannotations-options.md) (static)
1. [Service Registration](validations/branch/service-registration.md) (static)
1. [Transaction Usage](validations/branch/transaction-usage.md) (static)
1. [Persistence Session Usage](validations/branch/persistence-session-usage.md) (static)
1. [ConcurrentMapperHashMap Usage](validations/branch/concurrent-mapper-hash-map-usage.md) (static)
1. [CacheField Usage](validations/branch/cache-field-usage.md) (static)
1. [Startup Sync Usage](validations/branch/startup-sync-usage.md) (static)
1. [Feature Flag Removal](validations/branch/feature-flag-removal.md) (static)
1. [Core Infrastructure Revert Resend](validations/branch/core-infra-revert-resend.md) (static)
1. [Service Holder Usage](validations/branch/service-holder-usage.md) (static)
1. [BeanParamUtil Getter](validations/branch/bean-param-util-getter.md) (static)
1. [HTML Escaping](validations/branch/html-escaping.md) (static)
1. [Required Configuration Policy](validations/branch/required-configuration-policy.md) (static)
1. [TransactionTestUtil Usage](validations/branch/transaction-test-util-usage.md) (static)
1. [XML Element Text](validations/branch/xml-element-text.md) (static)
1. [Panel App Portlet ID](validations/branch/panel-app-portlet-id.md) (static)
1. [Reference Collection](validations/branch/reference-collection.md) (static)
1. [Tracker Factory Raw Class](validations/branch/tracker-factory-raw-class.md) (static)
1. [Activation Scope](validations/branch/activation-scope.md) (static)
1. [Full Portal Build](validations/portal/full-portal-build.md)
1. [Per-Module Compile](validations/portal/per-module-compile.md)
1. [Cross-Module Compile](validations/portal/cross-module-compile.md)
1. [Baseline](validations/portal/baseline.md)
1. [Theme Build](validations/portal/theme-build.md)
1. [Workspace Compile](validations/workspaces/workspace-compile.md)
1. [Poshi Syntax](validations/portal/poshi-syntax.md)
1. [Structural Smoke](validations/portal/structural-smoke.md)
1. [Java Unit Tests](validations/portal/java-unit-test.md)
1. [PQL Validation](validations/portal/pql-validation.md)
1. [JavaScript Unit Tests](validations/portal/javascript-unit-test.md)
1. [Workspace Java Unit Tests](validations/workspaces/workspace-java-unit-test.md)
1. [Workspace JavaScript Unit Tests](validations/workspaces/workspace-javascript-unit-test.md)
1. [Helm Unit Test Order](validations/portal/helm-unit-test-order.md)
The rules below divide in two. Dispatch, ordering, handoffs, the selection, and the overall state belong to this runner. Reading a log, judging a result, and reporting a note belong to the subagent, which never sees this document and takes those rules from its definition.
Start every selected validation at `NOT RUN`, then run them in the shared subagents below, each of type `pr-check-validation`, defined in [pr-check-validation.md](../../agents/pr-check-validation.md), which runs on Sonnet. A subagent spawned without that type inherits your model instead. **Give it only the path of its section file**, `${REPO_ROOT}/build/pr-check/sections/<folder>/<validation file name>`, and tell it to read the file before anything else. The path follows from the selection, so never list the directory. Never paste the sections into the prompt, and never read the file yourself, since every line in this conversation is sent again with each later request. A validation with no **Autocommit** section makes no commit, which says nothing about the working tree, since such a validation can still build and leave output behind. Record its result, and capture any note the command directs it to return. Tell the subagent to run every command in the foreground and to return only once it has a verdict. A subagent that starts a build in the background and returns while it runs hands back no verdict, and nothing reports the build's result afterward. Do not halt on a failure, so the developer sees the full picture. Wait for subagents through their completion notifications only. Never schedule a wakeup, a timer, or a cron job as a fallback, since a pending one keeps a headless run alive until it fires, and in an interactive session it fires after the run has ended.
The validations marked static in the list above need no build, no shared precondition, and no commit. Once the first batch below has returned, run [run_static_validations.sh](run_static_validations.sh) and [run_validation_scripts.sh](run_validation_scripts.sh) beside this document, each with `${MERGE_BASE}` as one foreground Bash call, as parallel calls in one response, giving the second a timeout of 600000 milliseconds. The first reads the static markers in the list above and prints one line for every selected static validation. For one whose **Command** is a single block that sets `${FINDINGS}`, it runs the block and prints `<name> PASS` when `${FINDINGS}` came back empty and the block printed no error, which is that validation's `PASS`, and `<name> needs a subagent` otherwise. For any other, it prints `<name> needs a subagent`. The second runs the script beside each selected validation that has one, such as `per_module_compile.sh` beside `per-module-compile.md`, in the order of the list above. Each script follows the steps of its **Command** and **Autocommit** that need no judgment. For a script that decided its validation, it prints the name and the result, such as `Per-Module Compile PASS`, with any note. For one that stopped, such as on a failed build, a **Baseline** finding, or a case its **Command** leaves to judgment, it prints `<name> needs a subagent`. Record each decided result in its row as printed, keeping a qualifier such as Baseline's `(baseline-all + ...)` in the same cell, and record the violations or note it printed. Dispatch every validation the first script says needs a subagent to a single `pr-check-validation` subagent, rather than one subagent each. Give the subagent each validation's name, `${VALIDATION_FILE}`, and section file. Tell it to read every section file in its first response as parallel Read calls, to start every command in its next response as parallel Bash calls, and to return one verdict block per validation, headed by its name. Record each block in that validation's row. A subagent of its own costs each validation the whole starting context of a subagent, and wakes this runner once more for its result. Add every validation the second script says needs a subagent to the second batch below in its place in the list, where the validation runs as one with no script.
Every validation that is not static can write to the working tree, so none of them runs alongside another. They run in two batches, each in a single subagent rather than one subagent each. The first batch holds those before the static ones in the list above, from **Instance Wrapper Build** through **PR Reviewer**, apart from those with a script, and runs first. **Service Builder** and **Source Format** have scripts, so they run in `run_validation_scripts.sh` after it, and a regeneration also covers any fix PR Reviewer made. The second holds the rest, from **Workspace Source Format** on, apart from those the scripts decided, and starts once both scripts above have returned. Dispatch no subagent for a batch that has nothing left in it. Give each batch's subagent the name and section file of every selected validation in it, in list order, with the values each one needs, such as `${VALIDATION_FILE}` or `${BUILD_ROOT}`. Tell it to run them one at a time in that order, each to its verdict and any commit before the next starts, and to return one verdict block per validation, headed by its name. A subagent of its own costs each validation a request of this runner to dispatch it and another to read its result, and each request sends this whole conversation again. When a validation in a batch hands off to one that is not in it, as **Per-Module Compile** can to **Full Portal Build**, tell the subagent to say so in that validation's block, and run the named validation once the batch returns. After a batch returns, recompute the selection when a validation in it made a commit that may add a path, and run whatever is newly selected and has not already run, with the second batch when it has not yet started and after it otherwise.
A validation returns `FAIL`, `NO COVERAGE`, `NOT APPLICABLE`, `NOT VERIFIED`, or `PASS`, as its definition describes. `FAIL` blocks the branch, and the others do not. A validation that returns `NOT APPLICABLE` leaves the table, and the Results Summary names it on one line instead.
Run workspace validations one workspace at a time. Each workspace build has its own Gradle daemon and heap and shares the Gradle cache with the others. Never pass `--offline` to a workspace build, since a cache miss under it prints as a dependency error that reads exactly like a compile failure.
Run a validation that autocommits with **nothing else that writes to the working tree** in flight, since `git add --all` cannot tell its own repair from one another validation made seconds earlier and commits the wrong work under its title. A validation that only reads is safe alongside anything, provided it reads a commit it pinned at the start rather than the working tree or the index. A concurrent validation moves the tree when it writes and the index when it stages, so only a pinned commit holds still for the whole run. Whether a validation reads or writes can depend on the diff, since **Module Registration** only reports when its markers are all removals and builds when one is added, so treat it as a writer unless its own text rules the writing branch out for the diff at hand. Keep tree writers off each other too, since several share build output such as `modules/build/node`.
A validation may hand off to another, as **Per-Module Compile** does when its deploy set grows past the point where one full build is cheaper. Run the validation it names, give the table that validation's row and result, and mark the one that handed off `NOT VERIFIED`. Pass 1 selects on the changed paths alone and cannot see a set Pass 2 derives, so a handoff is the only way those branches run.
An autocommit can change the diff, so recompute the selection after a validation whose commit may add a path Pass 1 never saw, as Baseline's `packageinfo` and `bnd.bnd` repairs do, by running `set_up_validations.sh` again, and dispatch whatever is newly selected and has not already run. A validation runs at most once per pass, so a repair that keeps widening the diff cannot loop. Skip it after a validation that can only touch paths the branch already changed, such as a formatter running in current branch mode, since its commit cannot widen the diff.
Tell Per-Module Compile whether Full Portal Build is in the run and, when it is, whether it succeeded, since a successful build lets it narrow its work and a failed one does not. In the second batch, the subagent sees that result for itself, since it runs Full Portal Build first.
Give the subagent everything that the validations use but none of them defines:
- `${REPO_ROOT}`, `${BASE_BRANCH}`, `${SOURCE_SHA}`, and `${MERGE_BASE}`.
- `${BUILD_ROOT}` for a workspace validation.
- `${SKILL_DIR}` and `${VALIDATION_FILE}` for a branch or portal validation, as the absolute paths of the directory holding this document and of its validation file.
- The shared preconditions that ran, and that they are satisfied.
- The ticket that its **Autocommit** section writes into a commit title as `<TICKET>`.
Resolve `${REPO_ROOT}` with:
```bash
REPO_ROOT=$(git rev-parse --show-toplevel)
```
Resolve `<TICKET>` from the branch name the way [commit.md](../../rules/commit.md) does, which is the ticket pattern of uppercase letters, hyphen, and digits rather than the whole branch name, so `LRCI-8065-rules` and `LRCI-8065-fixture-pr1f` both give `LRCI-8065`. A subagent that is not given it commits under the literal string.
## Results Summary
After the two passes complete, emit a Results Summary block. It is the canonical record of what was tested, embedded verbatim by the `pr` skill into the PR description and reused by the `pr-check-publish` skill when recording a run on an existing PR.
Capture the tested commit with `git rev-parse HEAD` **after** Pass 2 completes, and in the same Bash call print `build/test-plan/result.json` for the test plan question below and run [record_run.sh](record_run.sh) beside this document, so the SHA reflects the tree that was actually exercised — including any autocommits the validations made, such as the `<TICKET> SF` source-format commit. This is the commit the `pr` skill pushes as the PR head and the commit the webhook binds the `pr-check` status to, so a reviewer can tell whether the current head is the one that was tested.
`record_run.sh` writes `build/pr-check/run.json` with the tested SHA, the minutes the run took, the model, a hash of this skill, and the tokens the runner, the subagents, and PR Reviewer used. The `pr` and `pr-check-publish` skills add those fields to the hidden marker, so leave them out of the Results Summary.
The block is the overall state and tested SHA, followed by a table with one row per **selected** validation, including any still `NOT RUN`, in the execution order above, apart from those that returned `NOT APPLICABLE`. A workspace validation has one row for each workspace it ran for, named with the workspace in parentheses, such as `Workspace Compile (liferay-aihub-workspace)`. Validations that were not selected are omitted rather than listed as skipped, so the table reflects only what the diff exercised. When no validation was selected, omit the table as well and say so in one line, since a header with no rows reads as a table that failed to render.
When the branch sits on the forward target, follow the overall state with one line saying that the diff was taken against `${FORWARD_TIP}` and that the pull request goes to the forward target.
Name every validation that returned `NOT APPLICABLE` on one line beneath the table, such as `Not applicable: HTML Escaping, Structural Smoke.`, and leave the line out when none did. A selection can come back wrongly empty, so without the line a broken selection reads exactly like a diff with nothing in it.
In a repository whose settings disable the portal scope, list every changed path that belongs to no workspace as unchecked, so that a change nothing examined never reads as a pass.
```markdown
**pr-check: PASS** — tested on `<head-SHA>`
| Validation | Result |
| --- | --- |
| Source Format | PASS |
| Module Registration | NO COVERAGE |
| Java Unit Tests | PASS |
Module Registration had nothing to run. The diff removes `.lfrbuild-ci` from `apps:blogs:blogs-api`, which drops the module from CI's deploy pass and breaks no build, so whether CI still needs it is the developer's judgment.
```
A row still `NOT RUN` when Pass 2 ends is a validation that matched the diff and never ran, which is how LPD-100427 shipped, so it stays in the table as `NOT RUN` and fails the run.
The overall state is `FAIL` when any row is `FAIL` or `NOT RUN`, and `PASS` otherwise. A `NO COVERAGE` or `NOT VERIFIED` row leaves the overall state alone, and the marker the `pr-check-publish` skill writes still records `success`, since the webhook accepts only `failure`, `skipped`, and `success` and silently discards anything else.
A validation may qualify its verdict, as **Baseline** does when it names the universe it compared, and the qualifier follows the verdict in the same cell rather than in a note. The overall state reads the verdict alone, so a qualified `PASS` is still a `PASS`.
Every row whose validation returned a note appends it below the table, separated by a blank line. A `FAIL`, a `NO COVERAGE`, and a `NOT VERIFIED` always carry one. A `PASS` carries one only when the run left something unexamined, as **Module Registration** does when a diff pairs an addition it verified with a removal it can only report. A `PASS` that examined the whole change carries none. The notes travel verbatim into the PR description through the `pr` skill and into any comment the `pr-check-publish` skill posts, so keep each to one short sentence naming what failed or what went unexamined. Leave out why a gap is acceptable or what else covers it, and leave out how the run went, such as the commands, flags, task counts, and modules built. Nothing else goes below the table, apart from the test plan line that a declined test plan adds.
Ask the developer whether to run the `test-plan` skill before emitting the Results Summary block in either of these cases, and wait for the answer.
- **Java Unit Tests** names a changed class that has no unit test.
- The diff changes a `*.batch-engine-data.json` file, a `resource-actions/*.xml` file, or a file under `src/main/resources/site-initializer`.
Do not ask when `build/test-plan/result.json` exists and its `head` is the tested SHA, since the `pr` and `pr-check-publish` skills already record that run. When the developer accepts, run the `test-plan` skill, then emit the block. When the developer declines, add a `Test plan: needed, not run.` line below the notes, so that the pull request records it.