plugins/gwt/skills/gwt-pr/SKILL.md
Create or update GitHub Pull Requests with the gh CLI, preferring REST-first `gh api` flows for PR list/create/update/view while deciding whether to create a new PR or only push based on existing PR merge status. Use when the user asks to open/create/edit a PR, generate a PR body/template, or says 'open a PR/create a PR/gh pr'. Defaults: base=develop, head=current branch (same-branch only; never create/switch branches).
npx skillsauth add akiojin/gwt gwt-prInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Create or update GitHub Pull Requests with the gh CLI using a detailed body template, strict same-branch rules, and REST-first transport for PR list/create/update/view operations.
develop may target main. If the base is main and the head branch is anything other than develop, refuse to create the PR and instruct the user to merge into develop first, then create a release PR from develop.git status --porcelaingit stash, git commit, or git clean automatically unless explicitly requested.gh repo view --json nameWithOwner -q .nameWithOwner<owner>/<repo>gh api repos/<owner>/<repo>/pulls?state=all&head=<owner>:<head>&per_page=100mergedAt is null) → push only and finish (do not create a new PR).
mergedAt.When all PRs for the head branch are merged, you must check whether there are new commits after the merge:
merge_commit_sha).git merge-base --is-ancestor <merge_commit> HEADHEAD, count commits after the merge:
git rev-list --count <merge_commit>..HEADHEAD, fallback to the branch upstream first:
git rev-list --count origin/<head>..HEAD0 or fails, compare against the base branch:
git rev-list --count origin/<base>..HEAD0 → report "No new changes since merge" and finishMANUAL CHECK<type>(<scope>): <subject> — follow Conventional Commits.feat / fix / docs / chore / refactor / test / ci / perf.gui, core, pty).feat/ or fix/, the title type must match that prefix.| Section | Required | Notes |
|---------|----------|-------|
| Summary | YES | 1-3 bullet points. Include both the what and the why. |
| Changes | YES | Enumerate changes by file or module. |
| Testing | YES | List the commands run or the exact manual test steps. |
| Closing Issues | YES | Closes #N 形式。クローズ対象がなければ "None"。 |
| Related Issues / Links | YES | 参照のみ(自動クローズしない)。 |
| Checklist | YES | Review every item and mark it checked or N/A. |
| Context | Conditional | Required when 3 or more files changed or the rationale is non-trivial. |
| Risk / Impact | Conditional | Required when the change is breaking, performance-sensitive, or needs rollback steps. |
| Screenshots | Conditional | Required only for UI changes. |
| Deployment | Optional | Include only when deployment steps exist. |
| Notes | Optional | Include only when reviewers need extra context. |
TODO.- [ ] Docs updated — N/A: no user-facing change).#123 or as a URL. If nothing applies, explicitly write "None".Closes #N または None のみ許可。- #N(キーワードなし)は不可。Related Issues / Links に #N があり、その Issue をリリースで閉じたい場合は、同じ番号を Closing Issues にも Closes #N で必ず記載する。Related Issues / Links のみでは auto-close されない。\n.\n, \t).When work is tracked in GitHub Issues, progress updates must use this template:
Progress
- ...
Done
- ...
Next
- ...
Next, explicitly state blockers or the immediate next action.Confirm repo + branches
git rev-parse --show-toplevelgit rev-parse --abbrev-ref HEADdevelop unless user specifies.Check local working tree state (preflight)
git status --porcelain.git commit / git stash / git clean) and rerunFetch latest remote state
git fetch origin to ensure accurate comparisonCheck branch sync against base (critical)
git rev-list --left-right --count "HEAD...origin/$base".ahead behind.behind == 0, continue.behind > 0, merge origin/$base into the current branch before PR creation.git merge origin/$base; do not use rebase for this workflow.Check existing PR for head branch
merged_at as the source of truth for "merged".If all PRs are merged, perform post-merge commit check
GET /repos/<owner>/<repo>/pulls?state=all&head=<owner>:<head>HEAD, count git rev-list --count <merge_commit>..HEADgit rev-list --count origin/<head>..HEAD first0, still count git rev-list --count origin/<base>..HEAD before concluding NO_ACTIONMANUAL CHECKMANUAL CHECKEnsure the head branch is pushed
git push -u origin <head>git pushCollect PR inputs (for new PR or explicit update)
Build PR body from template
PR_BODY_TEMPLATE="${CLAUDE_PLUGIN_ROOT}/skills/gwt-pr/references/pr-body-template.md"${PR_BODY_TEMPLATE} and fill all required placeholders.<!-- GUIDE: ... --> comments from the final output.Create or update the PR
gh api repos/<owner>/<repo>/pulls --method POST --input <json-file>gh api repos/<owner>/<repo>/pulls/<number> --method PATCH --input <json-file>gh pr create -B <base> -H <head> --title "<title>" --body-file <file>gh pr edit <number> --title "<title>" --body-file <file>was submitted too quickly, retry with the other path before stopping.gh pr paths.Return PR URL
gh api repos/<owner>/<repo>/pulls/<number> --jq .html_urlPost-PR CI/merge check (automatic).
skills/gwt-pr-fix/SKILL.md and follow its workflow to inspect CI status, merge state, and review feedback.head=$(git rev-parse --abbrev-ref HEAD)
base=develop
PR_BODY_TEMPLATE="${CLAUDE_PLUGIN_ROOT}/skills/gwt-pr/references/pr-body-template.md"
if [ ! -f "$PR_BODY_TEMPLATE" ]; then
echo "PR template not found: $PR_BODY_TEMPLATE" >&2
exit 1
fi
# Preflight: local working tree state
status_lines=$(git status --porcelain)
if [ -n "$status_lines" ] && [ "${ALLOW_DIRTY_WORKTREE:-0}" != "1" ]; then
echo "Detected local uncommitted/untracked changes:" >&2
echo "$status_lines" >&2
echo "Choose one before continuing: continue as-is, abort, or manual cleanup then rerun." >&2
echo "Set ALLOW_DIRTY_WORKTREE=1 only after explicit user confirmation to continue." >&2
exit 1
fi
# Fetch latest remote state
git fetch origin
# Check branch sync against base before PR creation
divergence=$(git rev-list --left-right --count "HEAD...origin/$base" 2>/dev/null) || {
echo "Failed to compare HEAD with origin/$base" >&2
exit 1
}
ahead_count=$(echo "$divergence" | awk '{print $1}')
behind_count=$(echo "$divergence" | awk '{print $2}')
if [ "${behind_count:-0}" -gt 0 ]; then
echo "Merging origin/$base into $head before PR creation"
git merge "origin/$base" || {
echo "Base-branch merge produced conflicts. Inspect and resolve them before continuing." >&2
exit 1
}
git push -u origin "$head"
fi
# Check existing PRs for the head branch (REST-first)
repo_slug=$(gh repo view --json nameWithOwner -q .nameWithOwner)
owner="${repo_slug%%/*}"
pr_json=$(gh api "repos/$repo_slug/pulls?state=all&head=$owner:$head&per_page=100")
pr_count=$(echo "$pr_json" | jq 'length')
unmerged_count=$(echo "$pr_json" | jq 'map(select(.merged_at == null)) | length')
if [ "$pr_count" -eq 0 ]; then
action=create
elif [ "$unmerged_count" -gt 0 ]; then
action=push_only
else
# All PRs are merged - check for post-merge commits
merge_commit=$(echo "$pr_json" | jq -r 'map(select(.merged_at != null)) | sort_by(.updated_at) | last | .merge_commit_sha')
new_commits=""
if [ -n "$merge_commit" ] && [ "$merge_commit" != "null" ] && \
git merge-base --is-ancestor "$merge_commit" HEAD 2>/dev/null; then
new_commits=$(git rev-list --count "$merge_commit"..HEAD 2>/dev/null || echo "")
fi
if [ -n "$new_commits" ]; then
if [ "$new_commits" -gt 0 ]; then
echo "Found $new_commits commit(s) after merge - creating new PR"
action=create
else
echo "No new commits since merge - nothing to do"
action=none
fi
else
upstream_commits=$(git rev-list --count "origin/$head"..HEAD 2>/dev/null || echo "")
if [ -n "$upstream_commits" ] && [ "$upstream_commits" -gt 0 ]; then
echo "Found $upstream_commits commit(s) ahead of origin/$head - creating new PR"
action=create
else
fallback_commits=$(git rev-list --count "origin/$base"..HEAD 2>/dev/null || echo "")
if [ -n "$fallback_commits" ]; then
if [ "$fallback_commits" -gt 0 ]; then
echo "Upstream comparison unavailable; found $fallback_commits commit(s) ahead of origin/$base - creating new PR"
action=create
else
echo "No commits ahead of origin/$head or origin/$base - nothing to do"
action=none
fi
else
echo "Manual check required: could not determine whether new commits exist after the last merge" >&2
action=manual_check
fi
fi
fi
fi
# Execute action
case "$action" in
create)
cp "$PR_BODY_TEMPLATE" /tmp/pr-body.md
git push -u origin "$head"
jq -n --arg title "..." --arg head "$head" --arg base "$base" --rawfile body /tmp/pr-body.md \
'{title:$title, head:$head, base:$base, body:$body}' >/tmp/pr-create.json
gh api "repos/$repo_slug/pulls" --method POST --input /tmp/pr-create.json || {
gh pr create -B "$base" -H "$head" --title "..." --body-file /tmp/pr-body.md
}
;;
push_only)
echo "Existing unmerged PR found - pushing changes only"
git push
echo "$pr_json" | jq -r 'map(select(.merged_at == null)) | sort_by(.updated_at) | last | .html_url'
;;
none)
echo "No action needed - no new changes since last merge"
;;
manual_check)
echo "Manual check required - post-merge commit status could not be determined" >&2
exit 1
;;
esac
${CLAUDE_PLUGIN_ROOT}/skills/gwt-pr/references/pr-body-template.md: PR body templatetools
Create distinctive, production-grade terminal user interfaces. Use when building TUI components with ratatui, CLI output styling, or xterm.js terminal rendering. Triggers: 'design TUI', 'terminal UI', 'TUIデザイン', 'ターミナルUI', 'ratatui widget'
testing
Semantic search over SPEC Issues (GitHub Issue cache at ~/.gwt/cache/issues/) using vector embeddings. Use when searching for existing specs, finding related specs, checking for duplicate specs, or determining which spec owns a scope. Mandatory preflight before gwt-discussion when the work may need a SPEC owner. Use when user says 'search specs', 'find related specs', 'check for duplicate specs', or asks which spec owns a scope.
testing
Mandatory preflight before gwt-discussion, gwt-register-issue, and gwt-fix-issue. Use proactively before creating any SPEC or Issue owner or before reusing an existing one. Searches SPEC Issues, GitHub Issues, and project files via ChromaDB. Triggers: 'search', 'find related', 'check duplicates'.
business
Use when the user wants to register new work from a bug report, idea, or task description and an existing GitHub Issue number is not already known.