ai-diff-reviewer-open-pr
Author a well-documented GitHub pull request — title and body — for the current branch. Reads the diff and commit trail, infers a Conventional Commits (or repo-native) title, drafts a structured body with the sections a good PR review actually needs (Summary, Changes, Test plan, Related issues, Screenshots when UI files changed, Breaking changes when applicable, Risks), merges with `.github/pull_request_template.md` when present (never overwrites), previews everything to the developer, and executes via `gh pr create` (new PR) or `gh pr edit` (refresh existing PR). Supports draft PRs, stacked PRs against non-default bases, and forks. Use when the developer says "open the PR", "create a pull request", "draft the PR title and description", "write the PR body", "update the PR description", "the PR body is a one-liner — rewrite it properly", or "make a draft PR for this branch".
DailybotHQ · 已有静态检查记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add DailybotHQ/deepworkplan-skill --skill ai-diff-reviewer-open-pr技能说明
name: ai-diff-reviewer-open-pr
description: Author a well-documented GitHub pull request — title and body — for the current branch. Reads the diff and commit trail, infers a Conventional Commits (or repo-native) title, drafts a structured body with the sections a good PR review actually needs (Summary, Changes, Test plan, Related issues, Screenshots when UI files changed, Breaking changes when applicable, Risks), merges with .github/pull_request_template.md when present (never overwrites), previews everything to the developer, and executes via gh pr create (new PR) or gh pr edit (refresh existing PR). Supports draft PRs, stacked PRs against non-default bases, and forks. Use when the developer says "open the PR", "create a pull request", "draft the PR title and description", "write the PR body", "update the PR description", "the PR body is a one-liner — rewrite it properly", or "make a draft PR for this branch".
version: "2.0.1"
documentation_url: https://github.com/DailybotHQ/ai-diff-reviewer/blob/main/skills/ai-diff-reviewer/open-pr/SKILL.md
user-invocable: true
metadata: {"openclaw":{"emoji":"📝","homepage":"https://github.com/DailybotHQ/ai-diff-reviewer","requires":{"anyBins":["git","gh"]}}}
allowed-tools: Bash, Read, Grep, Glob
AI Diff Reviewer — Open PR (sub-skill)
Companion to the ai-diff-reviewer skill. Where the parent
reviews the current branch's diff locally, this sub-skill takes the
next logical step: authors a well-documented pull request from the
same diff — title, body, and (on request) a draft opener.
The design philosophy is unopinionated where it can be, opinionated where it needs to be:
- Unopinionated: the section shape adapts to your
.github/pull_request_template.mdwhen one exists. If your team already writes PRs with## Rollout planand a## Security reviewcheckbox, those survive intact. - Opinionated: every PR gets a Summary that leads with the outcome, a Test plan a reviewer can actually run, and — when the diff signals it — a Screenshots prompt for UI changes and a Breaking changes callout for API changes. These are the sections whose absence reviewers complain about; the skill won't let them slip.
Nothing gets pushed. Nothing gets merged. The skill only ever writes the
PR title + body on the remote via gh, always after a single-yes
preview.
When it fires
Create a fresh PR — triggers:
- "Open the PR", "open a pull request for this branch"
- "Create the PR", "create a pull request"
- "Draft the PR title and description"
- "I'm ready to push this for review — write the PR"
- "Make a draft PR" (adds
--draft)
Refresh / fix an existing PR — triggers:
- "Update the PR description"
- "The PR body is a one-liner — rewrite it in the proper format"
- "Fix the PR title, it doesn't match the diff anymore"
- "Refresh the PR body — I pushed new commits"
Fall through to a sibling skill when the developer:
- Wants a local review before pushing → parent
ai-diff-reviewerskill (default review flow). This sub-skill is the natural next step after that review. - Wants to install the CI action →
setup. - Wants to customize the review →
generate-extension. - Wants a git commit message (not a PR body) → defer; this skill writes PRs, not individual commits.
If the intent is ambiguous ("write the PR" on a branch that's not
pushed yet, or on a repo with no origin set), ask ONE clarifying
question before acting.
Step 0 — Trust boundary
This skill writes two things on the remote, both only after an explicit yes in the Step 6 preview:
- The PR title (via
gh pr create --titleorgh pr edit --title). - The PR body (via
--body-fileso multi-line Markdown round-trips cleanly).
It does not:
- Push commits, force-push, rebase, cherry-pick, or rewrite git history.
- Auto-add reviewers, assignees, labels, milestones, or projects unless
the developer explicitly asks and confirms. (
--assignee @meis the one exception in create mode — always applied.) - Auto-merge, auto-approve, or convert draft ↔ ready-for-review without explicit intent in the trigger.
- Touch any file in the working tree.
- Call the LLM provider directly, or send data anywhere besides the
ghAPI calls it announces in the preview.
If the branch is not pushed, the skill surfaces the exact command
(git push -u origin <branch>) and stops. It never runs git push
itself.
Step 1 — Detect context
Establish the mode (create vs. edit vs. refuse) before drafting anything.
# Current branch + head SHA
HEAD_BRANCH="$(git branch --show-current)"
HEAD_SHA="$(git rev-parse --short HEAD)"
# Base: prefer the tracked upstream's short name, fall back to the repo's
# default branch (asks gh; falls back to `main` if gh unavailable).
BASE="$(git rev-parse --abbrev-ref --symbolic-full-name '@{u}' 2>/dev/null | sed 's|.*/||')"
if [ -z "$BASE" ]; then
BASE="$(gh repo view --json defaultBranchRef --jq .defaultBranchRef.name 2>/dev/null || echo main)"
fi
# Repo slug (owner/repo)
REPO="$(gh repo view --json nameWithOwner --jq .nameWithOwner 2>/dev/null || echo '')"
# Does a PR already exist for the current branch?
PR_JSON="$(gh pr view --json number,url,title,body,isDraft,baseRefName,headRefName,state,author 2>/dev/null || true)"
Decide the mode from the state:
| State | Mode | Skill behavior |
|---|---|---|
On main / master / develop / trunk with no PR | refuse | Ask the developer to switch to a feature branch first. |
| Detached HEAD | refuse | Ask the developer to check out a branch first. |
PR_JSON non-empty and state is OPEN | edit | Load the existing title + body; go to Step 2 (edit path). |
PR_JSON non-empty and state is CLOSED or MERGED | refuse-soft | Do not edit a closed/merged PR. Offer: (a) open a new PR |