Creates a Pull Request for current branch changes. Runs pre-flight checks (typecheck, build), pushes the branch, generates a structured PR description with summary, changes, and checklist, and creates a draft PR via GitHub CLI. Use after /review passes.
You are creating a well-documented Pull Request. Follow these steps precisely.
Verify clean state:
git status --short
If there are uncommitted changes, ask if they should be committed first.
Verify branch:
CURRENT_BRANCH=$(git branch --show-current)
echo "Current branch: $CURRENT_BRANCH"
If on main or master, stop and tell the user to create a feature branch first.
Set base branch (use argument or default to main):
BASE_BRANCH="${ARGUMENTS:-main}"
echo "Base: $BASE_BRANCH"
Run typecheck:
pnpm run typecheck
Must pass. If it fails, stop and fix.
Run build:
pnpm run build
Must pass. If it fails, stop and fix.
Check for GitHub CLI:
which gh && gh auth status
If gh is not available or not authenticated, provide manual PR instructions instead.
git push -u origin $CURRENT_BRANCH
Commits on this branch:
git log $BASE_BRANCH..$CURRENT_BRANCH --oneline
Files changed:
git diff $BASE_BRANCH..$CURRENT_BRANCH --stat
Find related spec:
FEATURE=$(echo $CURRENT_BRANCH | sed 's|feature/||; s|fix/||; s|refactor/||')
SPEC_FILE="docs/specs/$FEATURE.md"
if [ -f "$SPEC_FILE" ]; then
echo "Found spec: $SPEC_FILE"
# Extract acceptance criteria
sed -n '/## 2. Acceptance Criteria/,/## 3/p' "$SPEC_FILE" | head -20
fi
Find related issue:
# Check spec for issue URL
if [ -f "$SPEC_FILE" ]; then
grep -o '#[0-9]*\|github.com/.*/issues/[0-9]*' "$SPEC_FILE" | head -1
fi
Build the PR using this template:
## Summary
<2-3 sentence description of what this PR does and why>
## Changes
### <Area 1>
- <change description>
- <change description>
### <Area 2>
- <change description>
## Related
- Spec: `docs/specs/<feature>.md` (if exists)
- Issue: #<number> (if found)
## Verification
- [x] `pnpm run typecheck` passes
- [x] `pnpm run build` passes
- [ ] Manual testing completed
## Checklist
- [ ] TypeScript strict — no `any` types
- [ ] All user strings through React Intl (en + vi)
- [ ] Zod validation on all API inputs
- [ ] No hardcoded secrets or credentials
- [ ] 8-bit/pixel art aesthetic maintained
- [ ] Database migrations generated (if schema changed)
- [ ] Conventional commit messages used
gh pr create \
--base $BASE_BRANCH \
--title "<type>(<scope>): <concise description under 70 chars>" \
--body "<generated description>" \
--draft
Use --draft by default. The title should follow conventional commit format derived from the branch name and commit messages.
/review hasn't been run, suggest: "Consider running /review first to catch any issues."