Publishes current branch changes to origin and manages associated pull requests. Automates pushing, PR creation, and updates.
Install
mkdir -p .claude/skills/push-karanhudia && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/17469" && unzip -o skill.zip -d .claude/skills/push-karanhudia && rm skill.zipInstalls to .claude/skills/push-karanhudia
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Push current branch changes to origin and create or update the correspondingKey capabilities
- →Create a new pull request if none exists for the branch.
- →Update an existing open pull request.
- →Keep branch history clean when the remote has moved.
- →Write proper PR titles that describe the change outcome.
- →Fill every section of the PR body using `.github/PULL_REQUEST_TEMPLATE.md`.
How it works
This skill pushes local branch changes to the remote origin and then creates or updates a corresponding pull request, ensuring the PR title and body are properly formatted and reflect the current scope.
Inputs & outputs
When to use push
- →Publishing local branch changes
- →Updating an existing pull request
- →Creating a new PR for a feature branch
About this skill
Push
Prerequisites
ghCLI is installed and available inPATH.gh auth statussucceeds for GitHub operations in this repo.
Goals
- Push current branch changes to
originsafely. - Create a PR if none exists for the branch, otherwise update the existing PR.
- Keep branch history clean when remote has moved.
Related Skills
pull: use this when push is rejected or sync is not clean (non-fast-forward, merge conflict risk, or stale branch).
Steps
-
Identify current branch and confirm remote state.
-
Run Borg UI validation appropriate to the changed files before pushing.
-
Push branch to
originwith upstream tracking if needed, using whatever remote URL is already configured. -
If push is not clean/rejected:
- If the failure is a non-fast-forward or sync problem, run the
pullskill to mergeorigin/main, resolve conflicts, and rerun validation. - Push again; use
--force-with-leaseonly when history was rewritten. - If the failure is due to auth, permissions, or workflow restrictions on the configured remote, stop and surface the exact error instead of rewriting remotes or switching protocols as a workaround.
- If the failure is a non-fast-forward or sync problem, run the
-
Ensure a PR exists for the branch:
- If no PR exists, create one.
- If a PR exists and is open, update it.
- If branch is tied to a closed/merged PR, create a new branch + PR.
- Write a proper PR title that clearly describes the change outcome
- For branch updates, explicitly reconsider whether current PR title still matches the latest scope; update it if it no longer does.
-
Write/update PR body explicitly using
.github/PULL_REQUEST_TEMPLATE.md:- Fill every section with concrete content for this change.
- Replace all placeholder comments (
<!-- ... -->). - Keep bullets/checkboxes where template expects them.
- If PR already exists, refresh body content so it reflects the total PR scope (all intended work on the branch), not just the newest commits, including newly added work, removed work, or changed approach.
- Do not reuse stale description text from earlier iterations.
-
Validate the PR body has no template comments or unresolved placeholders.
-
Reply with the PR URL from
gh pr view.
Commands
# Identify branch
branch=$(git branch --show-current)
# Minimal validation gate for Borg UI setup and docs changes.
git diff --check
# Backend validation for backend changes.
if git diff --name-only origin/main...HEAD | rg -q '^(app|tests|requirements.txt|pytest.ini|ruff.toml)(/|$)'; then
ruff check app tests
ruff format --check app tests
pytest tests/unit -v
fi
# Frontend validation for frontend changes.
if git diff --name-only origin/main...HEAD | rg -q '^frontend/'; then
(cd frontend && npm run check:locales && npm run typecheck && npm run lint && npm run build)
fi
# Initial push: respect the current origin remote.
git push -u origin HEAD
# If that failed because the remote moved, use the pull skill. After
# pull-skill resolution and re-validation, retry the normal push:
git push -u origin HEAD
# If the configured remote rejects the push for auth, permissions, or workflow
# restrictions, stop and surface the exact error.
# Only if history was rewritten locally:
git push --force-with-lease origin HEAD
# Ensure a PR exists (create only if missing)
pr_state=$(gh pr view --json state -q .state 2>/dev/null || true)
if [ "$pr_state" = "MERGED" ] || [ "$pr_state" = "CLOSED" ]; then
echo "Current branch is tied to a closed PR; create a new branch + PR." >&2
exit 1
fi
# Write a clear, human-friendly title that summarizes the shipped change.
pr_title="<clear PR title written for this change>"
if [ -z "$pr_state" ]; then
gh pr create --title "$pr_title"
else
# Reconsider title on every branch update; edit if scope shifted.
gh pr edit --title "$pr_title"
fi
# Write/edit PR body to match .github/PULL_REQUEST_TEMPLATE.md before validation.
# Example workflow:
# 1) open the template and draft body content for this PR
# 2) gh pr edit --body-file /tmp/pr_body.md
# 3) for branch updates, re-check that title/body still match current diff
tmp_pr_body=$(mktemp)
gh pr view --json body -q .body > "$tmp_pr_body"
if rg -n '<!--|Fixes #$|TODO|TBD' "$tmp_pr_body"; then
echo "PR body still contains template comments or unresolved placeholders." >&2
exit 1
fi
rm -f "$tmp_pr_body"
# Show PR URL for the reply
gh pr view --json url -q .url
Notes
- Do not use
--force; only use--force-with-leaseas the last resort. - Distinguish sync problems from remote auth/permission problems:
- Use the
pullskill for non-fast-forward or stale-branch issues. - Surface auth, permissions, or workflow restrictions directly instead of changing remotes or protocols.
- Use the
When not to use it
- →Do not use `--force` for pushing.
- →Do not rewrite remotes or switch protocols as a workaround for auth, permissions, or workflow restrictions.
- →Do not create a new branch + PR if the current branch is tied to a closed/merged PR.
Prerequisites
Limitations
- →The skill requires `gh` CLI to be installed and authenticated.
- →It does not use `--force` for pushing.
- →It will not create a new branch + PR if the current branch is tied to a closed/merged PR.
How it compares
This skill automates the process of pushing changes and managing pull requests, including template-based PR body generation and title updates, which is more structured than manual Git and GitHub CLI operations.
Compared to similar skills
push side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| push (this skill) | 0 | 2mo | Review | Beginner |
| github-release-management | 4 | 5mo | Review | Advanced |
| macos-spm-app-packaging | 1 | 4mo | Review | Intermediate |
| aur-publish | 1 | 6mo | Review | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by karanhudia
View all by karanhudia →You might also like
github-release-management
ruvnet
Comprehensive GitHub release orchestration with AI swarm coordination for automated versioning, testing, deployment, and rollback management
macos-spm-app-packaging
Dimillian
Scaffold, build, and package SwiftPM-based macOS apps without an Xcode project. Use when you need a from-scratch macOS app layout, SwiftPM targets/resources, a custom .app bundle assembly script, or signing/notarization/appcast steps outside Xcode.
aur-publish
peteonrails
Publish voxtype to AUR. Updates PKGBUILD, generates checksums, and pushes to AUR. Use after a GitHub release is published.
hex-release
agentjido
Guides interactive Hex package release. Bumps version in mix.exs, updates CHANGELOG with commits, creates git tag. Triggers on: release, hex publish, bump version, new release.
agent-release-swarm
ruvnet
Agent skill for release-swarm - invoke with $agent-release-swarm
magerun-release
netz98
Technical release process for n98-magerun2