Skip to content

/push-and-pr

Push current branch and create a pull request. Rebase workflow, auto-PR, merge prompt after checks pass. Triggers: "push-and-pr", "/push-and-pr", "push and pr", "create pr", "сделай пр", "запушь"

shell
$ npx -y skills add DefaultPerson/agent-setup --skill push-and-pr --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/push-and-pr
How auto-invocation works

Context preview

The summary Claude sees to decide when to auto-load this skill.

Push current branch and create a pull request. Rebase workflow, auto-PR, merge prompt after checks pass. Triggers: "push-and-pr", "/push-and-pr", "push and pr", "create pr", "сделай пр", "запушь"

SKILL.md

push-and-pr.SKILL.md
name: push-and-pr
description: >
  Push current branch and create a pull request. Rebase workflow, auto-PR,
  merge prompt after checks pass.
  Triggers: "push-and-pr", "/push-and-pr", "push and pr", "create pr", "сделай пр", "запушь"
allowed-tools: [Bash]
disallowed-tools: [Edit, Write, MultiEdit, NotebookEdit]

Context

  • Status: !`git status`
  • Branch: !`git branch --show-current`
  • Remote: !`git remote -v`
  • Unpushed commits: !`git log @{u}..HEAD --oneline 2>/dev/null || echo "No upstream set"`

Git Rules

  • Trunk-based development with rebase (linear history)
  • PR title = Conventional Commit format, ≤72 chars
  • PR description: what / why / how to test / risks
  • PR base always `main`, merge strategy: **Rebase and merge**
  • `--force-with-lease` only on personal feature branches after rebase
  • Use `gh` for all GitHub operations
  • Large PRs (>400 LOC) — consider splitting

Algorithm

1. **Guard**: `git status` — ensure working tree is clean (everything committed).

  • **If on `main`**: ask user (AskUserQuestion): "You're on main. Push directly or create a feature branch for PR?"
  • **Push directly**: `git push origin main` → output "Pushed to main." **STOP.**
  • **Create branch**: help create feature branch, switch to it, then continue.
  • **If on feature branch**: continue.

2. **Sync**: `git fetch origin` → `git rebase origin/main` → `git push -u origin HEAD --force-with-lease`. 3. **PR**:

  • Check if PR exists: `gh pr view --json number` — if exists, just push updates.
  • Create: `gh pr create --base main --head <current-branch>`.
  • Title: Conventional Commit format.
  • Body: what / why / how to test / risks.

4. **Checks**: `gh pr checks --watch` — if failing, diagnose and fix, re-push. 5. **Review**: Review using repo's PR template/checklist if present. 6. **Merge**: All checks green → ask user (AskUserQuestion): "Merge and delete branch?"

  • **Yes**: `gh pr merge --rebase` → `git switch main && git pull origin main` → `git branch -D <branch> && git push origin --delete <branch>`.
  • **No**: output PR link and stop.

7. **Output**: PR link, check statuses, summary of what was done.

Act immediately — no confirmation needed (except merge step).

Read more
Read it on GitHub ↗
Ships withagent-setup

Universal setup for Claude Code and OpenAI Codex CLI — security hooks, notifications, status line, and productivity commands.

Get the whole plugin, auto-invoked
Stats
11
Stars
0
Views
1
Forks
Active
Maintenance
Python
Language
MIT
License
28d ago
Last commit
8mo ago
Created

Repo: DefaultPerson/agent-setup

More skills in this plugin
See everything inside