agentsclimarketplace

Pr management

Skill Tyr0/agent-skills/plugins/pr-expert/skills/pr-management

A collection of skills, plugins, and agents for AI workflows.

Install
npx -y skills add Tyr0/agent-skills --skill pr-management

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Use this skill whenever you need to create, list, view, update, merge, or decline a pull request on GitHub or Bitbucket. Also use it for viewing PR diffs, checking merge conflict status, viewing CI/build statuses, listing PR commits, syncing a PR branch with its base, or declining/closing a PR. Triggers on 'create a PR', 'open a pull request', 'merge this PR', 'list open PRs', 'check if PR has conflicts', 'view the diff', 'what is the CI status', 'close this PR', 'update the PR description', or any question about managing the lifecycle of a pull request on GitHub or Bitbucket.

SKILL.md

13.1 KB, as published. Nobody here has run it

Pull Request Management

Create, list, update, merge, decline, and inspect pull requests on GitHub and Bitbucket Cloud via their REST APIs.


Prerequisites

Before calling any endpoint, complete the steps in the pr-setup skill:

  1. Detect the platform from git remote get-url origin
  2. Read credentials via the credential-storage skill (entries github and bitbucket)
  3. Set the correct base URL and auth headers

All examples below use placeholder variables: $TOKEN (GitHub), $BB_EMAIL:$BB_API_TOKEN (Bitbucket), {owner} / {workspace}, {repo}, and {id} (PR number/ID).


List Pull Requests

GitHub

curl -H "Authorization: Bearer $TOKEN" \
     -H "Accept: application/vnd.github+json" \
     "https://api.github.com/repos/{owner}/{repo}/pulls?state=open&per_page=50"

Query params: state (open/closed/all), head, base, sort (created/updated/popularity/long-running), direction (asc/desc).

Bitbucket

curl -u "$BB_EMAIL:$BB_API_TOKEN" \
     "https://api.bitbucket.org/2.0/repositories/{workspace}/{repo}/pullrequests?state=OPEN&pagelen=50"

Query params: state (OPEN/MERGED/DECLINED/SUPERSEDED — repeatable), q (filter expression), sort (e.g., -updated_on).

Bitbucket filter examples:

q=source.branch.name="feature/login"
q=destination.branch.name="main"
q=author.uuid="{user-uuid}"
q=state="OPEN" AND source.branch.name="feature/login"

Get a Single Pull Request

GitHub

curl -H "Authorization: Bearer $TOKEN" \
     -H "Accept: application/vnd.github+json" \
     "https://api.github.com/repos/{owner}/{repo}/pulls/{id}"

Key response fields: number, title, body, state, head, base, mergeable (boolean or null), mergeable_state, draft, user, requested_reviewers.

Bitbucket

curl -u "$BB_EMAIL:$BB_API_TOKEN" \
     "https://api.bitbucket.org/2.0/repositories/{workspace}/{repo}/pullrequests/{id}"

Key response fields: id, title, description, state, source, destination, author, reviewers, participants, close_source_branch, links.


Create a Pull Request

GitHub

curl -X POST -H "Authorization: Bearer $TOKEN" \
     -H "Accept: application/vnd.github+json" \
     "https://api.github.com/repos/{owner}/{repo}/pulls" \
     -d '{
       "title": "Fix login timeout",
       "body": "## Summary\n- Resolves session expiration bug\n\n## Test Plan\n- Manual login test",
       "head": "tcalderone/fix-login-timeout",
       "base": "main",
       "draft": false
     }'

Required: title, head (source branch), base (target branch). Optional: body, draft, maintainer_can_modify.

Bitbucket

curl -X POST -u "$BB_EMAIL:$BB_API_TOKEN" \
     -H "Content-Type: application/json" \
     "https://api.bitbucket.org/2.0/repositories/{workspace}/{repo}/pullrequests" \
     -d '{
       "title": "Fix login timeout",
       "description": "## Summary\n- Resolves session expiration bug\n\n## Test Plan\n- Manual login test",
       "source": { "branch": { "name": "tcalderone/fix-login-timeout" } },
       "destination": { "branch": { "name": "main" } },
       "close_source_branch": true,
       "reviewers": [ { "uuid": "{user-uuid}" } ]
     }'

Required: title, source.branch.name. Defaults to repo default branch for destination if omitted.


Update a Pull Request

GitHub

curl -X PATCH -H "Authorization: Bearer $TOKEN" \
     -H "Accept: application/vnd.github+json" \
     "https://api.github.com/repos/{owner}/{repo}/pulls/{id}" \
     -d '{
       "title": "Updated title",
       "body": "Updated description",
       "state": "open"
     }'

Updatable: title, body, state (open/closed), base, maintainer_can_modify.

Bitbucket

curl -X PUT -u "$BB_EMAIL:$BB_API_TOKEN" \
     -H "Content-Type: application/json" \
     "https://api.bitbucket.org/2.0/repositories/{workspace}/{repo}/pullrequests/{id}" \
     -d '{
       "title": "Updated title",
       "description": "Updated description",
       "reviewers": [ { "uuid": "{user-uuid}" } ],
       "close_source_branch": true
     }'

Updatable: title, description, reviewers, close_source_branch, destination.branch.name.


Merge a Pull Request

GitHub

curl -X PUT -H "Authorization: Bearer $TOKEN" \
     -H "Accept: application/vnd.github+json" \
     "https://api.github.com/repos/{owner}/{repo}/pulls/{id}/merge" \
     -d '{
       "merge_method": "squash",
       "commit_title": "Fix login timeout (#42)",
       "commit_message": "Resolves session expiration bug"
     }'
merge_methodBehavior
mergeStandard merge commit (--no-ff)
squashSquash all commits into one
rebaseRebase onto base branch

Optional sha field: if provided, must match HEAD of the PR branch (prevents merging stale state).

Bitbucket

curl -X POST -u "$BB_EMAIL:$BB_API_TOKEN" \
     -H "Content-Type: application/json" \
     "https://api.bitbucket.org/2.0/repositories/{workspace}/{repo}/pullrequests/{id}/merge" \
     -d '{
       "merge_strategy": "squash",
       "close_source_branch": true,
       "message": "Fix login timeout (PR #42)"
     }'
merge_strategyBehavior
merge_commitStandard merge (--no-ff)
squashSquash all commits into one
fast_forwardFast-forward only (--ff-only)

Close / Decline a Pull Request

GitHub

Close by setting the state to closed:

curl -X PATCH -H "Authorization: Bearer $TOKEN" \
     -H "Accept: application/vnd.github+json" \
     "https://api.github.com/repos/{owner}/{repo}/pulls/{id}" \
     -d '{ "state": "closed" }'

Bitbucket

curl -X POST -u "$BB_EMAIL:$BB_API_TOKEN" \
     "https://api.bitbucket.org/2.0/repositories/{workspace}/{repo}/pullrequests/{id}/decline"

Check if a PR Is Merged

GitHub

curl -s -o /dev/null -w "%{http_code}" \
     -H "Authorization: Bearer $TOKEN" \
     "https://api.github.com/repos/{owner}/{repo}/pulls/{id}/merge"
# 204 = merged, 404 = not merged

Bitbucket

Check the state field on the PR object — MERGED if merged.


View Diffs

GitHub — Raw unified diff

curl -H "Authorization: Bearer $TOKEN" \
     -H "Accept: application/vnd.github.diff" \
     "https://api.github.com/repos/{owner}/{repo}/pulls/{id}"

GitHub — Structured file list with patches

curl -H "Authorization: Bearer $TOKEN" \
     -H "Accept: application/vnd.github+json" \
     "https://api.github.com/repos/{owner}/{repo}/pulls/{id}/files?per_page=100"

Each file entry: filename, status (added/removed/modified/renamed), additions, deletions, changes, patch.

Bitbucket — Raw unified diff

curl -u "$BB_EMAIL:$BB_API_TOKEN" \
     "https://api.bitbucket.org/2.0/repositories/{workspace}/{repo}/pullrequests/{id}/diff"

Bitbucket — Structured diffstat (JSON)

curl -u "$BB_EMAIL:$BB_API_TOKEN" \
     "https://api.bitbucket.org/2.0/repositories/{workspace}/{repo}/pullrequests/{id}/diffstat"

Each file entry: status (added/removed/modified/renamed), old.path, new.path, lines_added, lines_removed.


Merge Conflicts and Mergeability

GitHub

The mergeable field on a PR object indicates conflict status:

ValueMeaning
trueNo conflicts, can be merged
falseHas merge conflicts
nullGitHub is still computing — poll again after a short delay
# Fetch PR and check mergeability
curl -H "Authorization: Bearer $TOKEN" \
     "https://api.github.com/repos/{owner}/{repo}/pulls/{id}" \
  | python3 -c "import sys,json; d=json.load(sys.stdin); print(f'mergeable={d[\"mergeable\"]} state={d[\"mergeable_state\"]}')"

GitHub — Sync PR branch with base

curl -X PUT -H "Authorization: Bearer $TOKEN" \
     -H "Accept: application/vnd.github+json" \
     "https://api.github.com/repos/{owner}/{repo}/pulls/{id}/update-branch"

Bitbucket

Attempting to merge a PR with conflicts returns an HTTP error. Check for conflicts by attempting a merge with --dry-run logic or inspecting the PR state and error responses. The PR object itself does not expose a dedicated mergeable boolean — conflict detection is implicit in the merge attempt response.


CI / Build Status

GitHub — Combined commit status

curl -H "Authorization: Bearer $TOKEN" \
     "https://api.github.com/repos/{owner}/{repo}/commits/{head_sha}/status"

Response includes state: pending, success, failure, or error.

GitHub — Check runs (GitHub Actions, etc.)

curl -H "Authorization: Bearer $TOKEN" \
     "https://api.github.com/repos/{owner}/{repo}/commits/{head_sha}/check-runs"

Each check run: name, status (queued/in_progress/completed), conclusion (success/failure/neutral/cancelled/skipped/timed_out/action_required).

GitHub — Re-request a check run

curl -X POST -H "Authorization: Bearer $TOKEN" \
     "https://api.github.com/repos/{owner}/{repo}/check-runs/{check_run_id}/rerequest"

Bitbucket — Build statuses on a PR

curl -u "$BB_EMAIL:$BB_API_TOKEN" \
     "https://api.bitbucket.org/2.0/repositories/{workspace}/{repo}/pullrequests/{id}/statuses"

Each status: state (SUCCESSFUL/FAILED/INPROGRESS/STOPPED), key, name, url, description.

Bitbucket — Build status on a specific commit

curl -u "$BB_EMAIL:$BB_API_TOKEN" \
     "https://api.bitbucket.org/2.0/repositories/{workspace}/{repo}/commit/{hash}/statuses/build"

List PR Commits

GitHub

curl -H "Authorization: Bearer $TOKEN" \
     "https://api.github.com/repos/{owner}/{repo}/pulls/{id}/commits?per_page=100"

Max 250 commits per PR.

Bitbucket

curl -u "$BB_EMAIL:$BB_API_TOKEN" \
     "https://api.bitbucket.org/2.0/repositories/{workspace}/{repo}/pullrequests/{id}/commits"

Paginated — follow next for additional pages.


PR Activity Feed (Bitbucket only)

Bitbucket provides a chronological feed of all PR events (comments, approvals, updates, merges):

curl -u "$BB_EMAIL:$BB_API_TOKEN" \
     "https://api.bitbucket.org/2.0/repositories/{workspace}/{repo}/pullrequests/{id}/activity"

GitHub equivalent: use the Timeline API or list events on the issue.


Cross-Platform Quick Reference

OperationGitHubBitbucket
List PRsGET /repos/{o}/{r}/pullsGET /repositories/{w}/{r}/pullrequests
Get PRGET /repos/{o}/{r}/pulls/{id}GET /repositories/{w}/{r}/pullrequests/{id}
Create PRPOST /repos/{o}/{r}/pullsPOST /repositories/{w}/{r}/pullrequests
Update PRPATCH /repos/{o}/{r}/pulls/{id}PUT /repositories/{w}/{r}/pullrequests/{id}
Merge PRPUT /repos/{o}/{r}/pulls/{id}/mergePOST /repositories/{w}/{r}/pullrequests/{id}/merge
Close/DeclinePATCH ...pulls/{id} state=closedPOST .../pullrequests/{id}/decline
Diff (raw)Accept: application/vnd.github.diffGET .../pullrequests/{id}/diff
Diff (structured)GET ...pulls/{id}/filesGET .../pullrequests/{id}/diffstat
CommitsGET ...pulls/{id}/commitsGET .../pullrequests/{id}/commits
CI statusGET /repos/{o}/{r}/commits/{sha}/check-runsGET .../pullrequests/{id}/statuses
Mergeability.mergeable field on PR objectImplicit in merge attempt response
Source branchhead fieldsource.branch.name field
Target branchbase fielddestination.branch.name field

Anti-Patterns

Anti-patternProblemFix
Merging without checking CI statusBroken builds land on mainAlways check build/check-run status before merging
Not verifying mergeable (GitHub) before mergingMerge conflicts cause 405/409 errorsFetch PR, check mergeable field; if null, poll briefly
Using PUT for Bitbucket updates when GitHub uses PATCH405 Method Not AllowedGitHub uses PATCH for updates; Bitbucket uses PUT
Forgetting Content-Type: application/json on POST/PUT415 or silent failures on BitbucketAlways include the header on requests with JSON bodies
Merging without sha validation (GitHub)Merging outdated PR statePass the HEAD SHA in the merge request to prevent stale merges
Ignoring close_source_branch on BitbucketStale feature branches accumulateSet close_source_branch: true when creating or merging
Assuming mergeable: null means conflictGitHub is still computingPoll the PR endpoint again after a brief delay

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.