.claude/skills/gwt-manage-pr/SKILL.md
Use when the user wants to create, inspect, update, or unblock a pull request and expects one visible entrypoint for the PR lifecycle.
npx skillsauth add akiojin/gwt gwt-manage-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.
Single skill for the full PR lifecycle: create, check status, and fix blockers. Auto-detects the appropriate mode from current branch PR state, or accepts an explicit mode from the user.
Use the current user's language for decision summaries, blocker reports, and next-step guidance returned from this workflow.
Canonical agent-facing surface is gwt pr ... / gwt actions ... for PR inspection, create/update, and fix flows. The current implementation may still use GitHub REST / gh internally as transport, while GraphQL remains the transport for unresolved review threads and thread reply/resolve.
On invocation, run Shared Preflight, then route:
mergeable: CONFLICTING|DIRTY|BEHIND → fixN > 0 + no open PR → createN > 0 + open PR + clean merge state → create (push-only + post-push fix)N = 0 + open PR → fix (check CI / reviews / conflicts)N = 0 + no open PR → report NO ACTIONEvery mode begins with these steps. The order is intentional — commit count against the base branch comes before PR state lookup so that the MERGED shortcut ("PR is done therefore nothing to do") is structurally impossible.
Repo + branches:
git rev-parse --show-toplevel / git rev-parse --abbrev-ref HEADdevelop unless user specifies.Branch protection: Only develop may target main. Refuse any other branch targeting main.
Working tree state: git status --porcelain. If dirty, pause and present options (continue / abort / cleanup). Do not auto-commit/stash.
Fetch: git fetch origin
Commit count against base (mandatory first check):
N=$(git rev-list --count "origin/$base..HEAD")
Baseline ref rule: ALWAYS compare against
origin/<base>(the PR target branch, defaultorigin/develop). NEVER useorigin/<head>(the remote tracking branch of the current branch) — that only tells you if commits are pushed, not whether develop has your work. Confusing the two is the root cause of the MERGED-state false NO ACTION bug.
PR lookup + open-PR check:
gwt pr current as the normal read path for the current branch.no current pull request as the canonical no-PR sentinel.has_open_pr = any entry with state == "open" && merged_at == nullmergeable:. CONFLICTING, DIRTY, and BEHIND are blocking merge states and immediately upgrade routing to fix.Route using the 2×2 matrix, with merge-state override:
| Commits (N) | Open PR? | Action | |---|---|---| | N > 0 | No | CREATE new PR | | N > 0 | Yes | PUSH ONLY to existing PR → then FIX | | N = 0 | Yes | FIX (CI / reviews / conflicts) | | N = 0 | No | NO ACTION |
If the open PR reports mergeable: CONFLICTING, DIRTY, or BEHIND,
use FIX immediately instead of push-only/create. Outside that
override, PR state (MERGED / CLOSED) is not consulted.
Detailed logic in references/create-flow.md.
Create mode is entered from the Preflight 2×2 matrix when N > 0.
CONFLICTING / DIRTY / BEHIND → enter Fix mode before any push-only path.origin/$base, merge origin/$base first (never rebase). Push after merge.<type>(<scope>): <subject> (Conventional Commits)feat/fix/docs/chore/refactor/test/ci/perffeat//fix/ must match title type.claude/skills/gwt-manage-pr/references/pr-body-template.md<!-- GUIDE: ... --> comments from final outputTODO in required sections; derive content from diff/Issues/SPECs before asking userClosing Issues: Closes #N or None only. Bare #N without keyword is forbidden.gwt pr create --base <base> [--head <head>] --title "<title>" -f <file> [--label <label>]* [--draft]gwt pr edit <number> [--title "<title>"] [-f <file>] [--add-label <label>]*gh internally, but agent-facing workflow should stay on the gwt pr surface.After PR creation or push, automatically enter fix mode and use gwt pr checks, gwt pr reviews, gwt pr review-threads, and gwt actions logs/job-logs as the normal inspection path.
Detailed logic in references/check-flow.md.
Read-only mode. Do not create/switch branches, push, or create/edit PRs.
gwt pr currentgwt pr view <number>gwt pr checks <number>gwt pr reviews <number>gwt pr review-threads <number>gwt actions logs --run <id> / gwt actions job-logs --job <id>Human-readable summary using signal prefixes:
| Prefix | Action | Meaning |
|--------|--------|---------|
| >> | CREATE PR | Create a new PR |
| > | PUSH ONLY | Push to existing PR |
| ~ | FIX | Fix CI / reviews / conflicts on existing PR |
| -- | NO ACTION | Nothing to do |
| !! | MANUAL CHECK | Manual check required |
Per-status templates:
Templates map directly from the Preflight 2×2 matrix:
>> CREATE PR -- <N> new commit(s) not covered by any PR.> PUSH ONLY -- Unmerged PR #<number> open for <head>. + PR URL~ FIX -- PR #<number> is <mergeable>; resolve base sync/conflicts before push-only.~ FIX -- PR #<number> open, checking CI/reviews/conflicts.-- NO ACTION -- No commits ahead of <base>, no open PR.!! MANUAL CHECK -- Could not determine commit count. + reasonAppend (!) Worktree has uncommitted changes. when dirty.
The commit count N = git rev-list --count origin/<base>..HEAD is
computed in the Shared Preflight and is the primary routing signal.
Check mode simply reports it:
N > 0 + no open PR → >> CREATE PR -- <N> new commit(s) not in any PR.N > 0 + open PR + clean merge state → > PUSH ONLY -- Unmerged PR open. + PR URLmergeable: CONFLICTING|DIRTY|BEHIND → ~ FIX -- PR is blocked by merge state.N = 0 + open PR → report CI / review / conflict statusN = 0 + no open PR → -- NO ACTIONThe old "Post-Merge Commit Check" logic (merge_commit ancestry,
fallback chain) is subsumed by git rev-list --count origin/<base>..HEAD
which directly answers "does develop have all my work?" regardless of
PR state.
Detailed logic in references/fix-flow.md.
mergeable / mergeStateStatus fields (CONFLICTING/DIRTY/BEHIND)CHANGES_REQUESTED state## Diagnosis Report: PR #<number>
**Merge Verdict: BLOCKED | CLEAR**
Blocking items: <N>
---
### BLOCKING
#### B1. [CATEGORY] <1-line title>
- **What:** Factual statement
- **Where:** file_path:line / check name / branch ref
- **Evidence:** Verbatim quote from output
- **Action:** Specific fix with file path/command
- **Auto-fix:** Yes | No (needs confirmation)
---
### INFORMATIONAL
#### I1. [CATEGORY] <1-line title>
- **What / Note**
---
**Summary:** <N> blocking, <M> informational.
Categories: CONFLICT, BRANCH-BEHIND, CI-FAILURE, CHANGE-REQUEST, UNRESOLVED-THREAD, REVIEW-COMMENT
Classification:
Each CHANGE-REQUEST, UNRESOLVED-THREAD, and UNANSWERED-COMMENT is a separate B-item.
Auto-fix: Yes --> proceed directly to fix.Auto-fix: No --> ask user about those items only.git fetch origin <base> && git merge origin/<base> && git pushNo reviewer comment may be left unanswered or unresolved.
gwt pr review-threads reply-and-resolve <number> -f <file> to reply to and resolve all unresolved threads on the PR.resolveReviewThread.Post a PR summary comment via gwt pr comment <number> -f <file>.
Re-run inspection with --mode all. Loop until exit code 0.
Same CI check fails 3 consecutive iterations --> report to user, ask continue/abort/change approach.
| Prohibited | Required Alternative |
|---|---|
| "We should look into..." | "Edit path/file.ts:42 to..." |
| "There seem to be some issues" | "3 blocking items detected" |
| "This might be causing..." | "Root cause: <error from log>" |
| "Consider fixing..." | "Action: Fix <what> in <where>" |
| "Various CI checks are failing" | "2 CI checks failing: build, lint" |
\n) in final comment text.When work is tracked in Issues:
Progress
- ...
Done
- ...
Next
- ...
PR lifecycle work is driven through the canonical gwt pr ... and
gwt actions ... surfaces. Do not depend on retired repo-local helper script
paths when running this workflow.
references/create-flow.md -- PR creation workflow detailsreferences/check-flow.md -- PR status checking detailsreferences/fix-flow.md -- CI/conflict/review fix detailsreferences/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.