| name | commit-last-to-pr |
| description | Prepare local changes for a pull request without committing or pushing. Use when asked to prepare the last changes for a PR, update PR documentation, or make a branch ready for review; requires scanning every commit included in the PR and updating README.md, CONTRIBUTING.md, docs/, and other documentation when behavior or user-facing workflows change. |
Prepare Last Change For PR
Workflow
Use this skill when the user wants the latest work prepared for a pull request. Do not create commits and do not push. The goal is to inspect the full PR range, update documentation if needed, and draft a PR description that follows the repository template.
-
Establish the PR context:
- Run
git status --short --branch.
- Run
git diff and git diff --staged.
- Check whether the current branch has an open PR with
gh pr view --json url,baseRefName,headRefName,state,body.
- If there is no open PR, determine the intended base branch from the user or repository default.
- Read
.github/pull_request_template.md before drafting or updating the PR body. Every PR description must follow that template structure.
-
Infer the related issue:
- Treat the branch name as the leading signal. Look for issue numbers or slugs in the branch name first, then use commit messages, existing PR metadata, nearby issue references, or repository issue tracker results to confirm.
- Fill the Related Issue section with
Closes #123 or Closes https://github.com/<owner>/<repo>/issues/123 when confident.
- Do not invent an issue. If none can be inferred, leave a short note in Additional Notes explaining that no issue was linked.
-
Scan every commit that belongs to this PR branch, not only the last commit:
- Find the base branch from the PR, for example
main.
- Fetch or inspect the remote base if needed.
- Use
git merge-base HEAD origin/<base> when available.
- Review
git log --oneline --decorate <base-or-merge-base>..HEAD.
- Review
git diff --stat <base-or-merge-base>..HEAD.
- Review
git diff <base-or-merge-base>..HEAD enough to understand the full PR behavior.
- Include staged and unstaged changes in the review if they are part of the current preparation work.
-
Update docs when the PR changes user-facing behavior:
- Always check
README.md, CONTRIBUTING.md, docs/, CLI help text, examples, configuration docs, and release notes as relevant.
- Update docs for new flags, changed defaults, new environment variables, security/sandboxing changes, setup changes, and behavior users rely on.
- If docs are not needed, be ready to explain why in the final summary and leave the Documentation checkboxes unchecked with a note in Additional Notes.
-
Prepare the working tree:
- Include only relevant files.
- Do not stage or commit secrets, local credentials, generated caches, or unrelated user changes.
- Run focused tests or checks that match the change risk.
- If checks modify files, inspect the modifications before continuing.
-
Draft the PR body from the template:
- Start from
.github/pull_request_template.md.
- Remove HTML comments and placeholder text.
- Fill every section with concrete content from the full PR diff and test results.
- Mark applicable Type of Change checkboxes with
[x]; leave others as [ ].
- Mark Testing and Documentation checkboxes to reflect what was actually done.
- Use Test Details for commands run, test files added, and manual verification steps.
- Use Additional Notes only for PR-relevant reviewer context, follow-ups, migration notes, or residual risk. This section is for the pull request, not for agent meta-commentary. Usually keep it empty or omit it unless the note would help a reviewer understand the PR itself.
- Omit Screenshots entirely when not applicable; do not leave an empty optional section with only placeholder text.
- If the final response references a PR body file such as
/tmp/bubblehub-pr-body.md, create that file during this workflow before finishing. Do not tell the user to run gh pr create --body-file /tmp/... unless the referenced file already exists.
- Prefer giving the user a single copy-pasteable heredoc command that creates the PR body file first, followed by the exact
gh pr create or gh pr edit command using that file.
-
Stop before committing:
- Do not run
git add, git commit, git push, or gh pr create unless the user separately and explicitly asks for those actions.
- If useful, draft a suggested commit message for the user, but leave the repository uncommitted.
- If the user later asks to commit, follow the normal git safety protocol for commits.
-
Report the result:
- Summarize the full PR range reviewed, not just the last commit.
- Mention docs updates, tests run, and any skipped checks or residual risk.
- Include the filled PR body (or a clear draft) in the final summary so the user can review it before opening the PR.
- Mention that no commit or push was performed.
- If there is an existing PR, include its URL and note whether the body should be updated to match the template.
- End with a Next steps section containing copy-pasteable commands. These commands must be complete and self-contained: if they reference
/tmp/bubblehub-pr-body.md or another generated file, include the heredoc that creates that file before any command that consumes it.
Use this command sequence and replace placeholders with the actual files, branch, title, and filled template body. Prefer writing the body to a temporary Markdown file and passing it with --body-file; this keeps the final command readable and avoids nested quoting in long PR templates. If you choose this form, either actually create the file before finishing or include this heredoc in the user's next-step commands before any command that uses --body-file:
cat > /tmp/bubblehub-pr-body.md <<'EOF'
Closes
---
- ...
---
* [x] ✨ New feature
* [ ] 🐛 Bug fix
* [ ] ♻️ Refactor
* [ ] 📝 Documentation update
* [ ] 🎨 UI/UX improvement
* [ ] ⚡ Performance improvement
---
* [x] Existing tests pass
* [x] New tests added (if applicable)
* [x] Manually tested changes
- ...
---
* [x] Documentation updated
* [ ] README updated (if needed)
* [ ] Comments added/updated where appropriate
---
- ...
EOF
git add <updated-docs-and-related-files>
git commit --amend
git push
gh pr create --title "<title>" --body-file /tmp/bubblehub-pr-body.md
If the branch has no upstream, use git push -u origin HEAD. If a PR already exists, omit gh pr create and update it instead:
cat > /tmp/bubblehub-pr-body.md <<'EOF'
...filled template body...
EOF
gh pr edit --body-file /tmp/bubblehub-pr-body.md
Prefer the temporary-file HEREDOC form above so the body matches .github/pull_request_template.md exactly while keeping the gh command simple. Do not substitute a free-form Summary/Test plan block unless the user explicitly asks for a shorter body.
PR Review Checklist
Before finishing, verify:
Useful Commands
git status --short --branch
gh pr view --json url,baseRefName,headRefName,state,body
git merge-base HEAD origin/<base>
git log --oneline --decorate <merge-base>..HEAD
git diff --stat <merge-base>..HEAD
git diff <merge-base>..HEAD
git diff
git diff --staged
cat .github/pull_request_template.md