Skip to content

Commit 0843b4b

Browse files
dvdksnclaude
andcommitted
docs: tighten branch and remote handling in create-pr skill
- Guard against running on the default branch (main/master) - Use git status --porcelain to catch staged/unstaged changes, not just unstaged ones - Handle the case where origin is upstream docker/docs by pushing to a separate fork remote, and derive FORK_OWNER from that remote - Note the docs:/scope title prefix convention Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 09d6cfc commit 0843b4b

1 file changed

Lines changed: 29 additions & 7 deletions

File tree

.agents/skills/create-pr/SKILL.md

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,41 @@ Push the branch and create a properly structured pull request.
1212

1313
## 1. Verify the branch
1414

15+
Confirm you're on a dedicated branch, not the default branch:
16+
17+
```bash
18+
git branch --show-current # must not be main or master
19+
```
20+
21+
If this returns `main` or `master`, stop. Create a branch and move your
22+
commits onto it before continuing.
23+
24+
Confirm commits exist and the working tree is clean:
25+
1526
```bash
1627
git log --oneline main..HEAD # confirm commits exist
17-
git diff --quiet # confirm no unstaged changes
28+
git status --porcelain # must print nothing
1829
```
1930

31+
If `git status --porcelain` prints anything, there are uncommitted or
32+
unstaged changes. Stop and commit them — or unstage stray files like
33+
`package-lock.json` — before opening a PR. Don't open a PR mid-edit.
34+
2035
## 2. Push the branch
2136

22-
Confirm origin points to your fork, not upstream:
37+
Identify the remote that points at your fork. Inspect the remotes:
2338

2439
```bash
25-
git remote get-url origin
40+
git remote -v
2641
```
2742

28-
Then push:
43+
If `origin` is your fork, use it. If `origin` points at canonical
44+
`docker/docs` (the upstream), push to your separate fork remote instead —
45+
never push the branch to `docker/docs` directly:
2946

3047
```bash
31-
git push -u origin <branch-name>
48+
FORK_REMOTE=origin # or the name of your fork remote if origin is upstream
49+
git push -u "$FORK_REMOTE" <branch-name>
3250
```
3351

3452
## 3. Create the PR
@@ -46,10 +64,10 @@ duplicate PR; report the existing PR instead. Only proceed if there is no open
4664
linked PR, or if the existing PR clearly does not address the issue and you
4765
explain why in the new PR body.
4866

49-
Derive the fork owner dynamically:
67+
Derive the fork owner dynamically from the same fork remote you pushed to:
5068

5169
```bash
52-
FORK_OWNER=$(git remote get-url origin | sed -E 's|.*[:/]([^/]+)/[^/]+(\.git)?$|\1|')
70+
FORK_OWNER=$(git remote get-url "$FORK_REMOTE" | sed -E 's|.*[:/]([^/]+)/[^/]+(\.git)?$|\1|')
5371
```
5472

5573
```bash
@@ -68,6 +86,10 @@ EOF
6886
)"
6987
```
7088

89+
Prefix the title with the change type to match repo convention — `docs:` for
90+
documentation changes (or another scope like `hub:` when appropriate), for
91+
example `docs: fix broken link on install page`.
92+
7193
Keep the body short. Reviewers need to know what changed and why — nothing
7294
else. Do **not** add a "Test plan" section — documentation PRs don't need one.
7395

0 commit comments

Comments
 (0)