--- name: pr description: > Create a PR from current branch. Auto-generates title and description from branch name and commits. Use when creating pull requests, submitting changes, or when user says /pr. model: haiku user-invocable: true --- # Create Pull Request @~/.claude/skills/gitea/SKILL.md Quick PR creation from current branch - lighter than full `/work-issue` flow for when you're already on a branch with commits. ## Prerequisites - Current branch is NOT main/master - Branch has commits ahead of main - Changes have been pushed to origin (or will be pushed) ## Process ### 1. Verify Branch State ```bash # Check current branch git branch --show-current # Ensure we're not on main # If on main, abort with message: "Cannot create PR from main branch" # Check for commits ahead of main git log main..HEAD --oneline ``` ### 2. Push if Needed ```bash # Check if branch is tracking remote git status -sb # If not pushed or behind, push with upstream git push -u origin ``` ### 3. Generate PR Title **Option A: Branch contains issue number** (e.g., `issue-42-add-feature`) Extract issue number and use format: `[Issue #] ` ```bash tea issues # Get the actual issue title ``` **Option B: No issue number** Generate from branch name or recent commit messages: - Convert branch name from kebab-case to title case: `add-user-auth` -> `Add user auth` - Or use the most recent commit subject line ### 4. Generate PR Description Analyze the diff and commits to generate a description: ```bash # Get diff against main git diff main...HEAD --stat # Get commit messages git log main..HEAD --format="- %s" ``` Structure the description: ```markdown ## Summary [1-2 sentences describing the overall change] ## Changes [Bullet points summarizing commits or key changes] [If issue linked: "Closes #"] ``` ### 5. Create PR Use tea CLI to create the PR: ```bash tea pulls create --title "" --description "" ``` Capture the PR number from the output (e.g., "Pull Request #42 created"). ### 6. Auto-review Inform the user that auto-review is starting, then spawn the `code-reviewer` agent in background: ``` Task tool with: - subagent_type: "code-reviewer" - run_in_background: true - prompt: | Review PR # in the repository at . 1. Checkout the PR: tea pulls checkout 2. Get the diff: git diff main...HEAD 3. Analyze for code quality, bugs, security, style, test coverage 4. Post structured review comment with tea comment 5. Merge with rebase if LGTM, otherwise leave for user ``` ### 7. Display Result Show the user: - PR URL/number - Generated title and description - Status of auto-review (spawned in background) ## Issue Linking To detect if branch is linked to an issue: 1. Check branch name for patterns: - `issue--*` - `-*` - `*-#` 2. If issue number found: - Fetch issue title from Gitea - Use `[Issue #N] ` format for PR title - Add `Closes #N` to description ## Example Output ``` Created PR #42: [Issue #15] Add /pr command ## Summary Adds /pr command for quick PR creation from current branch. ## Changes - Add commands/pr.md with auto-generation logic - Support issue linking from branch name Closes #15 --- Auto-review started in background. Check status with: tea pulls 42 --comments ```