Create a GitHub pull request from the current branch using gh CLI. Reads chalk.json for project context to generate better test instructions and embeds visual artifacts if available.
Workflow
Check prerequisites — Run
git statusto verify:- Not on
main/master(if so, warn and suggest creating a branch) - No uncommitted changes (if there are, suggest running
/commitfirst) - Branch has commits ahead of base branch
- Not on
Analyze changes — Run
git log main..HEAD --onelineandgit diff main...HEAD --statto understand all changes.Read project context — Read
.chalk/chalk.jsonif it exists:test.command— for test plan instructionsdev.command— for setup instructionsroutes— to identify affected pagesproject.framework— for framework-specific review notes
Determine base branch — Default to
main. If the user specifies a different target, use that.Push the branch — Run
git push -u origin <branch>if not already pushed.Create the PR — Use
gh pr createwith:- A concise title (under 70 characters) following conventional commit style
- A structured body (see format below)
Report — Show the user the PR URL.
PR Body Format
## Summary
<1-3 bullet points describing what changed and why>
## Changes
<Bulleted list of specific changes, grouped by area>
## Test plan
<How to verify — include actual commands from chalk.json if available>
<e.g., "1. Run `npm run dev` 2. Navigate to /dashboard 3. Verify...">
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Visual Preview Section
After generating the body, check if .github/pr-screenshots/ exists and contains .png or .gif files. If it does, append a ## Visual Preview section before the footer:
## Visual Preview
### <Page Name>


- Group images by page/route with subheadings
- Include both screenshots and GIFs if both exist
- Use relative paths — GitHub renders these inline in PR descriptions
- If no screenshots exist, omit this section
If no screenshots exist and the branch has UI changes (changes to components, pages, styles, templates), suggest running /capture-pr-visuals first.
Title Convention
Match the conventional commit style of the primary change:
feat(scope): descriptionfor feature branchesfix(scope): descriptionfor bug fix branches- If the branch has mixed types, use the most significant one
Rules
- NEVER force push
- NEVER create PRs to
mainwithout user confirmation if there are destructive changes - Always use
gh pr create(not the GitHub web UI) - Pass the PR body via HEREDOC for proper formatting
- If
ghis not authenticated, tell the user to rungh auth login - Include relevant issue references (e.g., "Closes #34") if the branch name or commits reference an issue
- Test plan should use actual commands from
chalk.jsonwhen available (e.g., realtest.command, realdev.command)