agentleFS
dmzoneilldmzoneill/skills/rebase-pr/SKILL.md

rebase-pr

Skill2 starsChanged 19 days agoApache-2.0View on GitHub

Rebase a PR branch onto main. Handles merge commits, conflicts (auto-resolve when possible), linting, force push. Use when user says "rebase", "rebase PR", "rebase branch".

  • Deletes or force-pushes
  • Commits and pushes

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 1 is distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If mr_id: gitlab_mr_view(project, mr_id) → extract branch via extract_branch_from_mr

    line 31
  2. Very specific:

    If issue_key: git_branch_list(repo, all_branches=true) → parse_git_branches with issue filter

    line 32
  3. Very specific:

    If conflicts: parse_conflict_markers — auto-resolve when: identical, ours empty (accept theirs), theirs empty (accept ours), …

    line 49
  4. Distinctive:

    If needs human: list files, show conflict markers, guide: git add → git rebase --continue → git push --force-with-lease

    line 52
  5. Very specific:

    If mr_id: skill_run("ci_retry", '{"mr_id": X, "project": "..."}') — restart pipeline

    line 61
  6. Very specific:

    Update state/current_work.open_mrs — last_rebase, rebase_success, pushed

    line 69

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Rebase PR Branch

Inputs

InputTypeDefaultPurpose
mr_idint-GitLab MR ID — find branch
issue_keystring-Jira key — find branch and resolve repo
branchstring-Branch name directly
repo_pathstring""Repo path; resolved from issue_key/repo_name if empty
repo_namestring-Config repo name
base_branchstring""Rebase onto (default: main from config)
force_pushboolfalseAuto force-push after rebase
run_lintingbooltrueRun black/flake8 before push

Workflow

1. Bootstrap

  • persona_load("developer")
  • check_known_issues("git_rebase") — known rebase patterns
  • Load learned/patterns.rebases — conflict-prone files
  • knowledge_query(project="automation-analytics-backend", section="patterns.coding")

2. Resolve Repo & Branch

  • Resolve repo from repo_path, repo_name, or issue_key via config
  • If mr_id: gitlab_mr_view(project, mr_id) → extract branch via extract_branch_from_mr
  • If issue_key: git_branch_list(repo, all_branches=true) → parse_git_branches with issue filter
  • Require one of: mr_id, issue_key, branch

3. Pre-rebase

  • git_fetch(repo, prune=true)
  • git_log(repo, range_spec="origin/main..origin/branch", merges_only=true) — merge commits
  • git_status(repo) — uncommitted changes
  • If dirty: git_stash(repo, action="push", message="rebase_pr: auto-stash")
  • git_checkout(repo, target=branch) — or force_create=true, start_point=origin/branch if local missing
  • git_pull(repo) or git_reset(repo, target=origin/branch, mode="hard") if pull fails

4. Rebase

  • git_fetch(repo, remote="origin", branch=default_branch) — update base
  • git_rebase(repo, onto="origin/main") — or origin/{default_branch}
  • Parse: success ("Successfully rebased"), conflicts (extract conflict files via extract_conflict_files)

5. Handle Conflicts

  • If conflicts: parse_conflict_markers — auto-resolve when: identical, ours empty (accept theirs), theirs empty (accept ours), whitespace-only, subset merge
  • Stage resolved: git_add(repo, files="...")
  • git_rebase(repo, continue_rebase=true) if all resolved
  • If needs human: list files, show conflict markers, guide: git add → git rebase --continue → git push --force-with-lease

6. Linting (if success and run_linting)

  • lint_python(repo, fix=false) — or black --check + flake8
  • Block push if lint fails

7. Force Push (if success and force_push)

  • Dry-run: git_push(repo, branch, force=true, dry_run=true) — check protection
  • If allowed: git_push(repo, branch, force=true)
  • If mr_id: skill_run("ci_retry", '{"mr_id": X, "project": "..."}') — restart pipeline
  • persona_load("developer") — restore after ci_retry

8. Notify & Memory

  • skill_run("notify_team", '{"message": "Branch rebased and force-pushed for MR !X", "channel": "team"}')
  • memory_session_log("Rebased MR !X", "Success|Conflicts|Failed")
  • Record in learned/patterns.rebases — branch, mr_id, had_conflicts, auto_resolved, conflict_files
  • Track conflict_prone_files for files with repeated conflicts
  • Update state/current_work.open_mrs — last_rebase, rebase_success, pushed

9. Failure Learning

  • "conflict" → learn_tool_fix("git_rebase", "conflict", "Merge conflicts", "Resolve, git add, git rebase --continue")
  • "no such host" → learn_tool_fix("gitlab_mr_view", "no such host", "VPN", "vpn_connect()")
  • "permission denied" → ssh-add, check credentials

Key MCP Tools

  • persona_load, git_fetch, git_status, git_stash, git_checkout, git_pull, git_reset, git_log, git_rebase, git_add, git_push, git_rev_parse
  • gitlab_mr_view
  • lint_python or black/flake8 subprocess
  • knowledge_query, check_known_issues, learn_tool_fix
  • memory_session_log, skill_run

Conflict Resolution

Auto-resolve: identical, accept_theirs (ours empty), accept_ours (theirs empty), whitespace_only, subset_merge. Complex conflicts: guide user through <<<<<<<, =======, >>>>>>> resolution.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.