/elastic-docs-skills:docs-review-pr [pr-number-or-url-or-path]from elastic-docs-skills
Reviews Elastic documentation PRs against a six-criteria checklist (user focus, technical accuracy, applicability, maintainability, language, style) and outputs a merged report with an approve/comment/request-changes recommendation. Use when reviewing a docs PR, checking a branch before requesting review, or deciding if a change is ready to merge.
Ships in elastic-docs-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
You review Elastic documentation pull requests against the docs team review checklist. You produce one merged report covering all six review criteria — user focus, technical accuracy, applicability, maintainability, language, style — and recommend whether to approve, comment, or request changes.
You are an orchestrator. The catalog already has skills that check style, tagging, content type, contradictions, metadata, and code samples. You dispatch those and merge their findings into checklist shape. You do not re-implement their rubrics.
This skill deliberately omits context: fork, which most catalog skills set. It has to stay in the main context to dispatch companions through the Skill and Agent tools and to ask the user about gh pr checkout in Step 1. Each companion forks itself, so their output still stays out of context.
This skill always runs a full review. There is no light or trivial mode. The reviewer decides how much of the report to act on; your job is to produce the complete picture.
This skill is read-only.
gh pr review, gh pr comment, or gh pr merge.docs-applies-to-tagging declares Edit and its validate mode reports or fixes, and docs-validate-code-samples declares Write and can write an output file. Both go through the subagent path only, where the spawn prompt can forbid writes — see Step 3.gh pr checkout in Step 1, which you offer and never run without the user saying yes.$ARGUMENTS is a PR number, a GitHub PR URL, a file, or a directory. If empty, review the current branch against its base.
Always read references/review-criteria.md (next to this file). That is the rubric, and it works with no network, no MCP, and no authentication — the case in agentic workflows and CI.
Then, if the elastic-internal-docs MCP is reachable, refresh it against the canonical pages with get_internal_document_by_url and includeBody: true:
| Page | URL |
|---|---|
| Docs review checklists | /r/docs-content-internal/processes/docs-review-checklists |
| PR review guidelines | /r/docs-content-internal/processes/pr-reviews |
The fetched pages take precedence where they differ, and any conflict goes in the report. If the MCP is unavailable or unauthenticated, the reference file alone is enough — say so in the report header with Rubric source: references/review-criteria.md (MCP not reachable) so the reader knows the rubric was not refreshed.
$ARGUMENTS | How to resolve |
|---|---|
| PR number or GitHub PR URL | gh pr view <n> --json number,title,body,author,labels,files,baseRefName,baseRefOid,headRefName,headRefOid,headRepository,isCrossRepository,url and gh pr diff <n> |
| Empty | Current branch against the branch it forked from. First check whether the branch already has a PR — gh pr view with no number resolves one when it exists. If it does, use it and run the PR-only checks. Only when there is no PR do you skip them |
| File or directory path | Treat the files there as the review scope. There is no diff, so every line counts as in scope — you cannot separate introduced from pre-existing, and Step 5 must say so instead of guessing. PR-only checks are skipped |
State which input mode you used in the report header, and whether PR metadata was available. A branch with an open PR gets the full review; a branch without one loses the PR-only checks, and so does a path input. The reader needs to know which.
$BASE and $BASE_REPO are used later in this step to read deleted pages, and in Step 5 to scope findings. Set them during target resolution for whichever mode you are in — not only for branch reviews. A PR review that reaches the deleted-page read with them unset runs git fetch "https://github.com/.git" "", which fails with an unhelpful error.
PR mode — take both from the PR itself. gh pr view has no baseRepository field, so the base repo comes from the PR URL:
BASE=$(gh pr view <n> --json baseRefName -q .baseRefName)
BASE_REPO=$(gh pr view <n> --json url \
-q '.url | capture("github\\.com/(?<r>[^/]+/[^/]+)/pull").r')
Branch mode — ask GitHub what the branch targets, and fall back to the repository default. Do not use the upstream tracking branch (@{u}): that is where the branch pushes, not what it forked from, so on a pushed branch it resolves to the branch's own remote copy, the diff comes back empty, and you report a clean review of nothing.
BASE=$(gh pr view --json baseRefName -q .baseRefName 2>/dev/null) \
|| BASE=$(gh repo view --json defaultBranchRef -q .defaultBranchRef.name)
BASE_REPO=$(gh repo view --json parent,nameWithOwner \
-q 'if .parent then .parent.nameWithOwner else .nameWithOwner end')
git fetch "https://github.com/$BASE_REPO.git" "$BASE"
git diff -U0 "$(git merge-base HEAD FETCH_HEAD)"...HEAD
Path mode — there is no diff and no base. Leave both unset and skip every step that needs them, marking those checks Not checked — no base to compare against.
Two things these recipes are careful about:
gh pr view with no number resolves the current branch's PR when one exists, which is the most reliable answer about what a branch targets. When it succeeds, the branch is not PR-less: reuse that PR's metadata for labels, author, and body rather than reporting the PR-only checks as skipped.origin. In a fork clone origin is the fork, so origin/main is the contributor's copy of main — stale, or missing entirely — and diffing against it gives a wrong changed-file set. Fetching by URL into FETCH_HEAD sidesteps the question of what any local remote happens to point at.If the resulting diff is empty, stop and say so rather than reporting a clean review — an empty diff nearly always means the base was resolved wrongly, not that there is nothing to review.
Do this before reading any file. Several checks in Step 4 — orphaned images, missing redirects, cross-references from parent pages — grep the local repo. If the PR's head ref is not checked out here, those greps read a different tree and you report confidently wrong results.
Compare the commit, not the branch name. A local branch can share a name with the PR's head and point somewhere else entirely. So:
git rev-parse HEAD must equal headRefOid. That single check subsumes branch name, fork, and staleness — a matching commit is a matching tree.gh repo view --json nameWithOwner against the PR's base repository — the owner/name in the PR URL — by owner/name, never by remote URL string, since the SSH and HTTPS forms of one repo differ as text.Never compare the local repo against headRepository. On a fork PR (isCrossRepository: true) the head repository is the contributor's fork, which nobody has checked out. Fork PRs are reviewed from a clone of the base repo: gh pr checkout fetches the fork's head into a local branch there. Comparing against headRepository would reject every fork PR as the wrong repository — exactly the contributions that most need a careful review.
Commit matches — proceed.
Not a git repo, or not the PR's base repo — stop. Tell the user which repo to run from.
Right repo, wrong ref — check for uncommitted work first with git status --porcelain --untracked-files=no. Only tracked modifications block a switch: if there are any, do not offer to check out, and tell the user to stash or commit. Untracked files do not block, because gh pr checkout leaves them alone — mention them and carry on. When nothing is blocking, ask whether to run gh pr checkout <n>, and wait for an answer. Never check out without one.
User declines the checkout — continue in degraded mode. Write each changed file to its own scratchpad path, preserving the repo-relative structure, and review those copies:
SCRATCH=$(mktemp -d) # create it once, reuse for every file
mkdir -p "$SCRATCH/$(dirname <path>)"
gh api "repos/{owner}/{repo}/contents/<path>?ref=<headRefOid>" --jq .content \
| base64 -d > "$SCRATCH/<path>"
Create $SCRATCH before the first fetch and report the path, so the user can inspect what you reviewed.
Redirecting to a file is the point — decoded content on stdout gives the later Read, Grep, and companion steps nothing to open. Dispatch companions against the scratchpad paths. Mark every repo-hygiene check in Step 4 as Not checked — ran against a different ref, because the rest of the repo is still at the wrong commit. Do not report them clean.
Read each changed .md file from end to end, not only the diff hunks. H1 accuracy, admonition stacking, content placement, and heading structure are all page-level properties that a hunk cannot show you.
Deleted and renamed pages need the base version. Once the head ref is checked out, a deleted page — or the source side of a rename — is no longer on disk, and those are exactly the files the orphaned-asset and redirect checks depend on. Read them from the base.
The base commit is usually not in the local clone, so fetch it before reading, or git show fails with a bad-object error:
git fetch "https://github.com/$BASE_REPO.git" "$BASE"
git show "$(git merge-base HEAD FETCH_HEAD)":<path>
When the fetch cannot succeed — a shallow clone, or no access to the base repo — read the file over the API instead, using baseRefOid from the gh pr view output:
gh api "repos/{owner}/{repo}/contents/<path>?ref=<baseRefOid>" --jq .content | base64 -d
If neither works, mark the orphaned-asset and redirect checks Not checked — base version unavailable. Do not infer a deleted page's contents.
Read the non-Markdown files in the diff too. Navigation files (toc.yml, docset.yml) and redirect files are part of the change and decide whether pages build and stay reachable. They are in scope even though the six criteria are about prose.
Keep a record of which lines the diff actually touched — gh pr diff <n> for a PR, or git diff -U0 <base>...HEAD for a branch. A name-only listing is not enough: Step 5 needs line ranges to separate what this PR introduced from what it merely sits next to. For a file or directory input there is no diff at all, so treat every line as in scope and say so in the report rather than guessing which lines are new.
From the PR review guidelines. This shapes emphasis, not depth — the full checklist runs either way.
| Author | Where to focus |
|---|---|
| Developer | Usually safe to assume the information is technically correct. Weight language and style. |
| Writer, with a developer tagged | Note that a pending technical review might trigger significant changes worth re-reviewing. |
| Non-writer, non-developer (for example, a customer-facing team) | For anything beyond a typo fix, flag that a writer with subject matter expertise should take it, and that a technical reviewer might still be needed. |
gh pr view gives you a GitHub login, not a role. Infer the author type only from real evidence — team membership you can see, how the PR describes itself, the repos the author normally touches. When the evidence is thin, record Author signal: unknown and weight nothing. An invented author type silently reshapes the whole review.
Record this as one line in the report header.
Every companion whose Gate condition is satisfied runs on every review — there is no tier that skips a companion. Two gates are conditional, because a code-sample validator has nothing to say about a PR with no code blocks, and the tagging skill has nothing to say about a diff that never touches applies_to. Check the Gate column before dispatching. Do not run a gated companion on a PR it does not apply to.
| # | Companion | Dispatch | Gate | Findings report under |
|---|---|---|---|---|
| 1 | docs-check-style | Either | Always | Language, Style |
| 2 | docs-flag-jargon-skill | Either | Always | Language |
| 3 | docs-content-type-checker | Either | Always | User focus |
| 4 | docs-check-contradictions | Either | Always | Technical accuracy |
| 5 | docs-frontmatter-audit | Either | Always | User focus |
| 6 | docs-applies-to-tagging | Subagent only | Diff touches applies_to or version-scoped content | Applicability |
| 7 | docs-validate-code-samples | Subagent only | Diff adds or changes code blocks | Technical accuracy |
Seven companions, seven separate dispatches. Never combine two into one call or one subagent. The last column says where a companion's findings are reported; it is not a grouping key. Companions 1 and 2 both feed Language, and 3 and 5 both feed User focus, but each is its own dispatch with its own rubric — bundling them means one of the two rubrics silently does not run, and the run table then claims coverage you do not have.
The five Always-gated companions are dispatched on every review without exception. "Not dispatched" is never a valid outcome for them — if one could not be reached, it is Not installed or did not return, and it is reported that way.
Every companion maps onto one of the six report sections. Nothing produces a seventh — docs-frontmatter-audit findings belong under User focus, as findability and metadata.
Companions are model-invocable, so the Skill tool can reach them whether they are installed standalone or as part of the elastic-docs-skills plugin. The one exception is docs-validate-code-samples, which keeps disable-model-invocation: true because it can write files; it always takes the subagent path, which reads its SKILL.md from disk and is not affected by the flag.
The Path column decides where each companion goes. Read-only companions try path 1 and drop to path 2 if it fails; write-capable companions go straight to path 2. Record which path each one actually used, and report it.
Skill tool — read-only companions only, per the Path column. Pass one file to review as args. Use the plugin-prefixed frontmatter name, elastic-docs-skills:docs-content-type-checker, which is the form the README documents. Fall back to the bare name if the prefixed one is refused. A copy installed as a project skill under .claude/skills/ answers to its directory name, not its frontmatter name, so try that form last.
A companion that declares Edit or Write never goes down this path. args is the only thing you control on a Skill call, and asking politely for validation is not a guarantee: docs-applies-to-tagging treats a file path as validate mode, and validate mode still reports or fixes. The subagent spawn prompt is the only channel that can actually forbid a write, so applies-to-tagging and docs-validate-code-samples always use path 2, even when the Skill tool would accept them.
One changed file per call. Companions declare <file-or-directory> and glob $ARGUMENTS, so a space-separated list is read as one bad path, not many good ones. Invoke once per changed file. Pass a directory only when it contains exactly the changed set and nothing else — otherwise the companion globs unrelated pages and their findings leak into the report and skew the recommendation. When in doubt, one file per call. This applies to both dispatch paths.
Subagent. The required path for write-capable companions, and the fallback whenever both Skill name forms are refused or unlisted. Spawn one subagent per companion, all in a single message so they run in parallel. Each subagent:
SKILL.md by globbing ~/.claude/skills/*/SKILL.md, ~/.claude/plugins/**/skills/**/SKILL.md, and the local repo's skills/**/SKILL.md, matching on either the directory name or the frontmatter name: field.$ARGUMENTS — one file, or the common parent directory — following the same one-target rule as path 1.Reading the rubric from the companion is what keeps this skill thin. Never copy a companion's rules into this file.
Not installed. If a companion is nowhere to be found, mark its criterion Not checked — <skill> not installed and give the install command:
npx --yes skills@latest add elastic/elastic-docs-skills --skill <name> -g
Use the companion's frontmatter name: — docs-check-contradictions, not its check-contradictions directory. That is what the install command takes. The invocation name is a separate question: a copy installed as a project skill under .claude/skills/ answers to its directory name instead, so try that form before reporting a companion as not installed.
This applies to every reason a companion produced nothing — not installed, refused, errored, or dispatched and never returned.
docs-review-pr and keep it in its own row — never merge it into a missing companion's slot.On the Skill path, pass arguments that ask for validation or review only, never generation or fixes — and remember that this is a request, not an enforcement, which is why write-capable companions are excluded from that path. On the subagent path, put this in the spawn prompt verbatim:
Do not Edit or Write any file. Do not modify the working tree. Return findings only.
Both dispatch paths fork and run in the background. Results arrive as notifications, not as return values from the call you made.
Before writing the report, check the count. The run table must have exactly seven rows, one per companion in the dispatch table. Every Always-gated companion must read Ran, Not installed, or did not return — never Not dispatched. If a row says you skipped one, you either missed it or bundled it into another call; go back and dispatch it.
This is your own contribution to the review. Scope every finding to what the PR changed.
type:. When docs-content-type-checker identifies the page as a how-to, tutorial, overview, or troubleshooting page and the frontmatter carries no type: field, recommend adding it — naming the type it should be. Do this for edited pages, not only new ones: an existing page never passed through a template, so the field is the one most often missing. Recommend it even when nothing consumes the field yet. Structural findings about a content type without the tag that names it leave the reader to infer what you already determined.elastic-docs MCP tool find_related_docs on the page topic.You cannot confirm that an SME reviewed a change. You can report whether the evidence is there.
When that evidence is a code PR or commit — elastic/elasticsearch#12345, a GitHub PR URL, "Docs for kibana#678", a branch named after an issue — do not stop at noting it exists. Read it and compare. A linked code change pins the repository, the ref, and the version, so this is the one technical check you can make without guessing which source to trust. Skip this whole block when no code change is referenced; never go looking for one to scan.
Resolve the reference and read both sides:
gh pr view <n> --repo <owner/repo> --json title,body,state,mergedAt,baseRefName,files
gh pr diff <n> --repo <owner/repo>
Pass the number with --repo, or a full PR URL. The shorthand gh pr view elastic/elasticsearch#12345 does not work — gh reads it as a branch name and reports no PR found, which looks like a missing PR rather than a bad command.
Pull the checkable facts out of the code diff: setting, flag, and parameter names; default values, limits, and enum values; error and log message text; and any added or changed tests, which assert intended behavior more reliably than comments describe it.
Compare each against what the docs change asserts. Report under Technical accuracy, citing the code PR and the file in its diff, so the writer can follow the same trail.
Four things to get right, because each is a way to be confidently wrong:
baseRefName tells you which branch it landed on. Cross-check that against the page's applies_to. Docs tagged for 9.2 describing a change that landed on 8.19 is a real finding, and one nothing else in this review would catch.find_related_docs or search_docs to check whether a dedicated page already covers it. Flag intra-page duplication too — read Option 1 and Option 2, or Method A and Method B, side by side.redirects.yml or _redirects.yml, next to the content set's docset.yml or _docset.yml — check both names before reporting one missing, or you will raise false findings.{{ reaches the rendered output, and every substitution resolves.applies_to tags work alongside page-level tags.Skip this block when the input was a path rather than a PR.
gh pr view --json labels.One report, sectioned by the six criteria in checklist order.
Target: <PR #, title, URL — or branch/path>
Author signal: <author type → where you focused>
Rubric source: internal MCP | embedded fallback — <reason>
Working tree: head ref checked out | degraded — <what was skipped>
Then a companion run table: each skill, and whether it ran, and through which path, was skipped (not relevant, with the reason), or is not installed.
Group by criterion: User focus, Technical accuracy, Applicability, Maintainability, Language, Style. Under each, one line per finding:
| Severity | file:line | Finding | Guideline | Source |
references/review-criteria.md. Link the section anchor when the table lists one, otherwise the page that governs the criterion. Cite the rule the finding actually rests on, not the section it happens to sit in: a missing description is a metadata and findability rule, not seo#headings; an ambiguous trigger condition is a clarity problem, not grammar-spelling. A criterion name such as "Technical accuracy" is not a citation — it names where the finding is filed, not what decides it. If nothing in the table fits, leave the column empty rather than reaching for the nearest link; a wrong citation sends the writer to a rule that does not say what you claim. The column holds a link or nothing — a bare word such as findability, or a criterion name, is not a citation and must not appear there. Every Language and Style finding must carry one, and so must any other finding a specific page decides. A writer who disagrees needs somewhere to go and check; "the style guide says so" is not a citation. When a companion reports a rule name of its own, such as a Vale rule like Elastic.OxfordComma, include that too, so the writer knows which check fired. Never invent an anchor — if nothing listed covers it, cite the page and say which part applies.docs-review-pr for your own checks. The reader needs to know what to re-run.Severity: / Finding: blocks partway through the report — one format throughout, so the reader can scan it.docs-flag-jargon-skill and docs-flag-jargon are not two sources.When one issue repeats across the PR, report it once as a pattern with a count and a couple of examples. Per the review etiquette in the PR review guidelines, a single global comment beats commenting on every instance.
Anything you noticed that this PR did not introduce goes in its own section, clearly labeled. The author is not responsible for unrelated debt, and mixing the two makes a review feel arbitrary.
This section holds problems, not praise. A good change the PR makes belongs under What is working; putting it here tells the author their improvement is a pre-existing defect. If there are no pre-existing issues, say so in one line.
Where the content is strong, say so, briefly and specifically. Positive feedback reinforces good writing habits and makes the review less daunting.
Build this list from the findings above, never from memory. Each action item restates one finding you already wrote, in the same direction. Do not re-derive a fix while summarising: that is how a report ends up telling the author to change select to click when its own finding said the opposite, and the summary is the part people act on. Before writing an item, re-read the finding it comes from and check the direction matches. If an item has no finding above it, either it does not belong in the list or the finding is missing from the report.
One of Approve, Comment, or Request changes, with the reasoning:
End with this, so nobody treats the report as the review itself:
This is a first pass, not a substitute for review. AI-generated results are not always accurate — confirm findings before acting on them.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
elastic-docs, documentation-review, pr-review, docs-checklist
25 skills in this plugin
/docs-applies-to-taggingValidate and generate applies_to tags in Elastic documentation, including for cumulative docs across versions and deployment types. Use when writing new docs pages, reviewing existing pages for correct applies_to usage, deciding whether to preserve or replace existing version-scoped content, or when content changes lifecycle state (experimental, preview, beta, GA, deprecated, removed)./docs-check-contradictionsCheck whether newly written or updated documentation contradicts existing content elsewhere in the docs — procedures, concepts, prerequisites, values, names, recommendations, or cross-references — both in the local repo and across all published Elastic docs. Use when the user asks for a contradiction or consistency check on a docs change, or when a docs review runs. Do not trigger on ordinary drafting or editing./docs-check-kibana-oasnpx claudepluginhub elastic/elastic-docs-skills --plugin elastic-docs-skillsOther plugins' skills for the same job