Agent skill

sym-push

Push current branch changes to origin and create or update the corresponding pull request (with the correct base branch); use when asked to push, publish updates, or create pull request.

Stars 28
Forks 2

Install this agent skill to your Project

npx add-skill https://github.com/gannonh/kata/tree/main/.agents/skills/sym-push

SKILL.md

Push

Prerequisites

  • gh CLI is installed and available in PATH.
  • gh auth status succeeds for GitHub operations in this repo.

Goals

  • Push current branch changes to origin safely.
  • 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

  1. Identify current branch and confirm remote state.

  2. Determine the PR/merge base branch:

    • Use a workflow-configured base branch when task context provides one (for Symphony workflows, this is workspace.base_branch).
    • Default to main when no explicit base branch is available.
  3. Run local validation (cd apps/symphony && cargo test && cargo clippy -- -D warnings) before pushing.

  4. Push branch to origin using explicit first-push upstream setup:

    • first publish of a new branch: git push -u origin "$branch"
    • subsequent updates: git push Use whatever remote URL is already configured.
  5. If push is not clean/rejected:

    • If the failure is a non-fast-forward or sync problem, run the pull skill to merge origin/<base-branch>, resolve conflicts, and rerun validation.
    • Retry with git push -u origin "$branch" so upstream is set even when the first push failed before tracking was recorded.
    • Use --force-with-lease only 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.
  6. 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.
  7. 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.
  8. Reply with the PR URL from gh pr view.

Commands

sh
# Identify branch
branch=$(git branch --show-current)
base_branch="${BASE_BRANCH:-main}"

# Minimal validation gate
cd apps/symphony && cargo test && cargo clippy -- -D warnings

# Initial push for a new branch: set upstream explicitly.
git push -u origin "$branch"

# 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 "$branch"

# After upstream is set, routine branch updates can use:
git push

# 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 --base "$base_branch" --title "$pr_title"
else
  # Reconsider title on every branch update; edit if scope shifted.
  gh pr edit --base "$base_branch" --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"
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-lease as the last resort.
  • Distinguish sync problems from remote auth/permission problems:
    • Use the pull skill for non-fast-forward or stale-branch issues.
    • Surface auth, permissions, or workflow restrictions directly instead of changing remotes or protocols.

Expand your agent's capabilities with these related and highly-rated skills.

gannonh/kata

kata-context

Structural and semantic codebase intelligence with persistent memory — index TypeScript and Python repos into a knowledge graph with vector embeddings, query symbol dependencies, run semantic search by intent, search code patterns, fuzzy-find symbols, and persist/recall agent memories with git audit trail. Use when you need to understand code structure, find what depends on a symbol, trace dependencies, search by meaning, search for code patterns, find symbols by name, or remember/recall project decisions, patterns, and learnings.

28 2
Explore
gannonh/kata

claude-md-improver

Audit and improve CLAUDE.md files in repositories. Use when user asks to check, audit, update, improve, or fix CLAUDE.md files. Scans for all CLAUDE.md files, evaluates quality against templates, outputs quality report, then makes targeted updates. Also use when the user mentions "CLAUDE.md maintenance" or "project memory optimization".

28 2
Explore
gannonh/kata

frontend-design

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts, posters, or applications (examples include websites, landing pages, dashboards, React components, HTML/CSS layouts, or when styling/beautifying any web UI). Generates creative, polished code and UI design that avoids generic AI aesthetics.

28 2
Explore
gannonh/kata

debug-like-expert

Deep analysis debugging mode for complex issues. Activates methodical investigation protocol with evidence gathering, hypothesis testing, and rigorous verification. Use when standard troubleshooting fails or when issues require systematic root cause analysis.

28 2
Explore
gannonh/kata

swiftui

SwiftUI apps from scratch through App Store. Full lifecycle - create, debug, test, optimize, ship.

28 2
Explore
gannonh/kata

sym-address-comments

Help address review/issue comments on the open GitHub PR for the current branch using gh CLI; verify gh auth first and prompt the user to authenticate if not logged in.

28 2
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results