Use when adding new error messages to React, or seeing "unknown error code" warnings.
npx skills add karfly/agent-skills --skill "wt-merge"
Install specific skill from multi-skill repository
# Description
Create a pull request from the current git worktree branch to its parent branch. Use when a user wants to merge their worktree feature branch back to the branch it was created from. Determines the parent branch from git config, asks the user if not found, then creates a PR for review.
# SKILL.md
name: wt-merge
description: Create a pull request from the current git worktree branch to its parent branch. Use when a user wants to merge their worktree feature branch back to the branch it was created from. Determines the parent branch from git config, asks the user if not found, then creates a PR for review.
metadata:
short-description: Create PR from worktree to parent branch
Worktree Merge (PR)
Overview
Create a pull request from the current worktree's feature branch to its parent branch (the branch it was originally created from).
Parent branch info is stored in git config branch.<branch>.parent.
Prerequisites
- Require GitHub CLI
gh. Checkgh --version. If missing, ask the user to install it. - Require authenticated
ghsession. Rungh auth status. If not authenticated, ask the user to rungh auth login. - Must be inside a git repository (can be a worktree).
Workflow
- Verify environment
- Run
gh auth statusto confirm GitHub CLI is authenticated. -
Run
git rev-parse --is-inside-work-treeto confirm we're in a git repo. -
Get current branch
-
Run
git branch --show-currentto get the current branch name. -
Determine parent branch
- Try to read parent from git config:
git config branch.<current-branch>.parent - If parent is not set, ask the user which branch to merge into (common options: main, master, develop).
-
Confirm the parent branch exists:
git rev-parse --verify <parent-branch> -
Check for uncommitted changes
- Run
git status --porcelain -
If there are uncommitted changes, warn the user and ask if they want to continue or commit first.
-
Push current branch
-
Ensure the current branch is pushed to remote:
git push -u origin $(git branch --show-current) -
Show summary and ask for confirmation
- Display:
- Current branch name
- Parent/target branch name
- Number of commits ahead of parent:
git rev-list --count <parent>..<current> - Brief diff stat:
git diff --stat <parent>..HEAD
-
Ask user to confirm before creating PR.
-
Create pull request
- Run:
gh pr create --base <parent-branch> --head <current-branch> --fill - If
--fillproduces poor results, use--titleand--bodywith a summary of changes. -
Output the PR URL to the user.
-
Optionally save parent for future
- If parent was manually specified, offer to save it:
git config branch.<current-branch>.parent <parent-branch>
Example Usage
User: merge this worktree
Agent:
1. Checks current branch is `feat/auth-refactor`
2. Finds parent is `main` from git config
3. Shows: "Creating PR: feat/auth-refactor -> main (3 commits)"
4. Asks for confirmation
5. Creates PR and returns URL
# Supported AI Coding Agents
This skill is compatible with the SKILL.md standard and works with all major AI coding agents:
Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.