|
| 1 | +--- |
| 2 | +name: pr |
| 3 | +description: Creates and updates GitHub pull requests for cloudflare-docs changes. Load when asked to open, create, submit, update, edit, or write a title or description for a PR. Covers title conventions, PR body structure, and the documentation checklist template. |
| 4 | +--- |
| 5 | + |
| 6 | +Use this skill when creating a GitHub pull request for changes to this repository, or when editing an existing PR's title or description. |
| 7 | + |
| 8 | +## `gh` CLI |
| 9 | + |
| 10 | +This skill uses the `gh` CLI throughout. If a `gh` command fails because it is not installed or not authenticated, fall back to providing the PR title and body clearly so the user can copy-paste them, along with the relevant GitHub URL: |
| 11 | + |
| 12 | +- **New PR**: `https://github.com/cloudflare/cloudflare-docs/compare/production...<branch>` (get branch from `git branch --show-current`) |
| 13 | +- **Edit existing PR**: `https://github.com/cloudflare/cloudflare-docs/pull/<number>` — instruct them to select **Edit** on the description. |
| 14 | + |
| 15 | +## Editing an existing PR |
| 16 | + |
| 17 | +When asked to update or edit an existing PR description (or title), follow these rules strictly — then stop. Do not proceed to the "Creating a new PR" steps below. |
| 18 | + |
| 19 | +1. **Always read the current PR description first** using `gh pr view <number> --json title,body` before making any changes. |
| 20 | +2. **If the description is empty**, treat it as a new PR body and follow the template and guidelines in the "Creating a new PR" section below. |
| 21 | +3. **Follow the existing format** — if the author has structured their description in a particular way, preserve that structure. Do not reformat, reorder, or restructure sections they wrote. |
| 22 | +4. **Only change what was asked** — make the minimum edit necessary to fulfill the request. Do not "improve" unrelated phrasing, fix grammar elsewhere, rewrite the summary, or modify checklist items that were not part of the request. |
| 23 | +5. Apply the edit using `gh pr edit <number> --body "..."` or `--title "..."`. |
| 24 | + |
| 25 | +## Creating a new PR |
| 26 | + |
| 27 | +Follow Steps 1–4 below only when creating a new PR (or when an existing PR has an empty description). |
| 28 | + |
| 29 | +## Step 1 — Gather context |
| 30 | + |
| 31 | +Run `--stat` first to understand the scope without blowing up context: |
| 32 | + |
| 33 | +```bash |
| 34 | +git log --oneline production..HEAD |
| 35 | +git diff production...HEAD --stat |
| 36 | +``` |
| 37 | + |
| 38 | +If the stat output shows more than ~20 files changed, do **not** run the full diff. Instead, read specific files that are unclear from the stat output. For smaller changesets (under ~20 files), the full diff is fine: |
| 39 | + |
| 40 | +```bash |
| 41 | +git diff production...HEAD |
| 42 | +``` |
| 43 | + |
| 44 | +## Step 2 — Write the PR title |
| 45 | + |
| 46 | +### Branch: `production` |
| 47 | + |
| 48 | +This repo uses `production` as the default branch, not `main`. Always use `--base production` when creating PRs. Contributors from other repos often expect `main` — this is intentional. |
| 49 | + |
| 50 | +### Format |
| 51 | + |
| 52 | +For content changes, the dominant convention is product brackets: |
| 53 | + |
| 54 | +``` |
| 55 | +[Product] Short description |
| 56 | +``` |
| 57 | + |
| 58 | +For changes spanning multiple products: |
| 59 | + |
| 60 | +``` |
| 61 | +[Product1, Product2] Short description |
| 62 | +``` |
| 63 | + |
| 64 | +For non-content changes (tooling, CI, config, components, worker code, repo maintenance), use a conventional commit prefix instead: |
| 65 | + |
| 66 | +``` |
| 67 | +chore: Short description |
| 68 | +fix: Short description |
| 69 | +feat: Short description |
| 70 | +``` |
| 71 | + |
| 72 | +### Inferring the product bracket from file paths |
| 73 | + |
| 74 | +Do not ask the author what product bracket to use — infer it from the changed file paths. |
| 75 | + |
| 76 | +- `src/content/docs/{slug}/` and `src/content/partials/{slug}/` map directly to a product. Read the `title` field from `src/content/docs/{slug}/index.mdx` to get the display name, then strip any "Cloudflare " prefix to get the bracket (e.g. title "Cloudflare Workers" → `[Workers]`). |
| 77 | +- `src/content/changelog/{slug}/` maps the same way — use the product bracket, not `[Changelog]`. Use `[Changelog]` only when the PR exclusively adds or updates changelog entries across multiple products. |
| 78 | +- If the change spans more than 3 products, use the 2–3 most prominent ones. |
| 79 | + |
| 80 | +### Rules |
| 81 | + |
| 82 | +- Use title case for product names inside brackets: `[Workers]`, `[AI Search]`, `[Zero Trust]` |
| 83 | +- Keep the description under ~60 characters |
| 84 | +- Use imperative mood: add, fix, update, remove, document, correct |
| 85 | +- Do not end with a period |
| 86 | +- Common abbreviations in brackets: `[DO]` for Durable Objects, `[KV]`, `[ZT]` for Zero Trust, `[R2]`, `[D1]` |
| 87 | + |
| 88 | +### Title examples (from real PRs) |
| 89 | + |
| 90 | +``` |
| 91 | +[AI Search] Add hybrid search and boosting configuration docs |
| 92 | +[Hyperdrive, Workers VPC] Document TCP services, TLS cert verification |
| 93 | +[Browser Rendering] Add Wrangler CLI commands documentation |
| 94 | +[Billing] Restructure billing docs into intent-based sections |
| 95 | +[DMARC Management] ELI5 |
| 96 | +[Client-side security] ELI5 updates |
| 97 | +[DNS, Fundamentals] Onboarding review and add video |
| 98 | +[Style Guide] Adding products frontmatter to all visible examples |
| 99 | +[Workers] Document Durable Object Facets |
| 100 | +[Changelog] CDP + WebMCP changelog entries |
| 101 | +``` |
| 102 | + |
| 103 | +Use the `[Product]` bracket format as your default for content changes. Use conventional commit prefixes for non-content changes. |
| 104 | + |
| 105 | +## Step 3 — Write the PR body |
| 106 | + |
| 107 | +Read the PR template from the repository before writing the body: |
| 108 | + |
| 109 | +```bash |
| 110 | +cat .github/pull_request_template.md |
| 111 | +``` |
| 112 | + |
| 113 | +Use that file as the exact base for the PR body. Do not rely on any hardcoded version of the template — always read it fresh from disk in case it has changed. |
| 114 | + |
| 115 | +### How to fill out each section |
| 116 | + |
| 117 | +**Summary** |
| 118 | + |
| 119 | +Write a short explanation covering: |
| 120 | + |
| 121 | +- What type of documentation is being changed (new page, update, fix, restructure, changelog entry) |
| 122 | +- Why the change is needed or what prompted it |
| 123 | +- Links to any relevant public context: GitHub issues, Jira tickets, related PRs, or public docs pages. |
| 124 | + |
| 125 | +Keep it factual. Do not repeat what the checklist items say. For small, focused PRs 1-2 sentences is enough. For larger PRs touching many files or multiple areas, a longer description is appropriate — use tables, lists, or code blocks over paragraphs of prose where it makes the summary easier to scan. |
| 126 | + |
| 127 | +Good examples: |
| 128 | + |
| 129 | +Small, focused PR: |
| 130 | + |
| 131 | +> Adds a caution note for the `active` attribute mapping behavior in SCIM provisioning. |
| 132 | +> |
| 133 | +> Fixes https://github.com/cloudflare/cloudflare-docs/issues/1234 |
| 134 | +
|
| 135 | +Medium PR: |
| 136 | + |
| 137 | +> Updates the Access policies index to reflect the new policy grouping UI. Fixes stale screenshots and outdated step ordering. |
| 138 | +
|
| 139 | +Larger PR spanning multiple areas: |
| 140 | + |
| 141 | +> Restructures the billing docs into intent-based sections to make it easier for users to find pricing and usage information. |
| 142 | +> |
| 143 | +> | Before | After | |
| 144 | +> | ---------------------- | ------------------------------ | |
| 145 | +> | `billing/usage.mdx` | `billing/usage-and-limits.mdx` | |
| 146 | +> | `billing/limits.mdx` | _(merged into above)_ | |
| 147 | +> | `billing/overview.mdx` | `billing/index.mdx` | |
| 148 | +> |
| 149 | +> - Updated all internal links pointing to moved pages |
| 150 | +> - Added redirects for all renamed files |
| 151 | +
|
| 152 | +**Screenshots (optional)** |
| 153 | + |
| 154 | +Skip this section entirely unless the PR changes something visual — new pages, rearranged navigation, updated UI steps, or modified images. Do not leave the empty comment placeholder if screenshots are not needed. |
| 155 | + |
| 156 | +If the PR does change something visual, include the section with a `<!-- TODO: add screenshots before requesting review -->` comment so the human knows to fill it in before the PR is ready for review. |
| 157 | + |
| 158 | +**Documentation checklist** |
| 159 | + |
| 160 | +Go through each item and decide whether it applies: |
| 161 | + |
| 162 | +1. **Changelog entry** — Required if the PR documents a new feature, enhancement, or noteworthy change to a Cloudflare product. Remove this item if the PR is a fix, typo correction, internal restructure, or style update. |
| 163 | + |
| 164 | +2. **Style guide adherence** — Keep this item only if the PR touches user-facing authored content in `src/content/` (MDX pages, partials, changelogs, frontmatter, or images). The style guide covers writing guidelines, formatting, grammar, component usage, content types, and links — all of which only apply to content rendered on the site. Remove this item for PRs that change source code, tooling, CI, configuration files, agent skills, or any other non-content assets — even if those files happen to be Markdown. |
| 165 | + |
| 166 | +3. **Issue opened for larger changes** — Keep this item if the PR adds a new page, restructures a section, or addresses known inaccuracies. Remove it for small focused changes. |
| 167 | + |
| 168 | +4. **Redirects for renamed/moved files** — Keep this item if any `.mdx` files were renamed, moved, or deleted. Remove it if no files changed location. |
| 169 | + |
| 170 | +Remove individual checklist items that genuinely do not apply. Do not leave unchecked items that are irrelevant — they create noise for reviewers. Only remove the entire Documentation checklist section if **none** of the items apply (e.g. a pure CI or tooling change). If even one item applies, keep the section and remove only the irrelevant items. |
| 171 | + |
| 172 | +### What not to do |
| 173 | + |
| 174 | +These patterns create review friction and will result in the PR being sent back: |
| 175 | + |
| 176 | +- **Context-free rewrites** — If the PR significantly changes or restructures content, the summary must explain what changed and why. A diff with no explanation forces reviewers to reverse-engineer intent. |
| 177 | +- **Diff narration** — Do not summarise the PR by listing what changed line by line ("changed X to Y on line 42", "updated heading from A to B"). Explain why the change was made, not what it mechanically did. |
| 178 | +- **Cross-product changes without explanation** — If the PR touches files across multiple product areas, explain the connection. Unrelated-looking changes with no stated reason are a red flag for reviewers. |
| 179 | +- **Pruning the checklist wrong** — Remove individual items that do not apply. Do not delete the entire checklist section unless none of the items are relevant. Reviewers use the remaining items to quickly verify coverage. |
| 180 | + |
| 181 | +## Step 4 — Create the PR |
| 182 | + |
| 183 | +Build the PR body by starting from the template read in Step 3 — replace the summary placeholder comment with your actual summary, remove checklist items that do not apply, and handle the screenshots section per the guidance above. Then create the PR as a **draft**: |
| 184 | + |
| 185 | +```bash |
| 186 | +gh pr create --base production --draft --title "[Product] short description" --body "$BODY" |
| 187 | +``` |
| 188 | + |
| 189 | +All PRs MUST be created as drafts. Most contributors should not land straight into the review queue — the author should review the deploy preview first and mark the PR ready when it looks correct. |
| 190 | + |
| 191 | +## Output |
| 192 | + |
| 193 | +Share the PR URL and let the user know it has been created as a draft — they should verify the changes and deploy preview look correct, then mark it as ready for review when they are satisfied. Do not push follow-up commits, do not request reviewers, do not make further edits to the PR unprompted. The human takes it from here. |
0 commit comments