agentsclimarketplace

Pr setup

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

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

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

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 authenticate with or configure access to a pull request hosting platform (GitHub or Bitbucket). Also use it to detect which platform a repository is hosted on, resolve authentication errors (401/403), set up tokens or API tokens, or register PR-platform credentials via the credential-storage skill. Triggers on 'how do I authenticate with Bitbucket', 'set up GitHub token', 'PR auth error', '401 from Bitbucket API', 'configure pull request access', or any question about connecting to a PR platform's REST API.

SKILL.md

9.2 KB, as published. Nobody here has run it

Pull Request Platform Setup

Authentication, platform detection, and credential configuration for GitHub and Bitbucket Cloud REST APIs.

Credentials are managed by the credential-storage skill. This skill describes the platform-specific concerns: which credentials to register, how to detect the platform from the git remote, and how to construct authenticated requests.


Platform Detection

Determine the hosting platform from the git remote URL before making any API calls.

# Get the remote URL
git remote get-url origin
URL patternPlatformWorkspace/OwnerRepo
[email protected]:{owner}/{repo}.gitGitHub{owner}{repo}
https://github.com/{owner}/{repo}.gitGitHub{owner}{repo}
[email protected]:{workspace}/{repo}.gitBitbucket{workspace}{repo}
https://bitbucket.org/{workspace}/{repo_slug}.gitBitbucket{workspace}{repo_slug}
https://{user}@bitbucket.org/{workspace}/{repo_slug}.gitBitbucket{workspace}{repo_slug}

Extracting components

# Parse owner and repo from remote URL
remote_url=$(git remote get-url origin)

# GitHub SSH
# [email protected]:owner/repo.git -> owner repo
echo "$remote_url" | sed -n 's|[email protected]:\([^/]*\)/\(.*\)\.git|\1 \2|p'

# GitHub HTTPS
# https://github.com/owner/repo.git -> owner repo
echo "$remote_url" | sed -n 's|https://github.com/\([^/]*\)/\(.*\)\.git|\1 \2|p'

# Bitbucket SSH
# [email protected]:workspace/repo.git -> workspace repo
echo "$remote_url" | sed -n 's|[email protected]:\([^/]*\)/\(.*\)\.git|\1 \2|p'

# Bitbucket HTTPS (with or without username@)
echo "$remote_url" | sed -n 's|https://\([^@]*@\)\?bitbucket.org/\([^/]*\)/\(.*\)\.git|\2 \3|p'

Credentials

This skill consumes two credentials registered via the credential-storage skill:

NameAccountStores
githubdefaultGitHub fine-grained personal access token
bitbucketAtlassian emailBitbucket Cloud API token

Reading credentials (macOS)

GitHub:

TOKEN=$(security find-generic-password -w -s 'agent-skills:github' -a 'default')

Bitbucket — the email lives in the index entry's account field; the token is in Keychain under that account:

BB_EMAIL=$(python3 -c "
import json, pathlib
data = json.loads((pathlib.Path.home() / '.agents/credentials.json').read_text())
print(data['credentials']['bitbucket']['account'])
")
BB_API_TOKEN=$(security find-generic-password -w -s 'agent-skills:bitbucket' -a "$BB_EMAIL")

After API calls, unset TOKEN BB_API_TOKEN to remove secrets from the shell environment.

For non-macOS platforms, dispatch via uname -s to the matching keystore. See the credential-storage skill's Platform Dispatch section.

First-time setup

If a credential is not yet registered, security exits with a non-zero status. Guide the user through obtaining the token, then register it.

GitHub:

  1. Go to GitHub Settings → Developer settings → Personal access tokens → Fine-grained tokens.

  2. Create a token with Pull requests: read and write permission, scoped to the target repositories.

  3. Register the token (paste at the prompt):

    security add-generic-password -U -s 'agent-skills:github' -a 'default'
    
  4. Add an index entry:

    python3 - <<'PY'
    import json, os, pathlib
    p = pathlib.Path.home() / ".agents" / "credentials.json"
    d = json.loads(p.read_text()) if p.exists() else {"version": 1, "credentials": {}}
    d["credentials"]["github"] = {}
    t = p.with_suffix(".json.tmp")
    t.write_text(json.dumps(d, indent=2) + "\n")
    os.chmod(t, 0o600)
    t.replace(p)
    PY
    

Bitbucket:

  1. Go to your Atlassian profile → Account settings → Security → Create and manage API tokens.

  2. Create an API token with Bitbucket Pull requests: Read and Pull requests: Write scopes.

  3. Register the token under your Atlassian email (replace <email>):

    security add-generic-password -U -s 'agent-skills:bitbucket' -a '<email>'
    
  4. Add an index entry:

    python3 - <<'PY'
    import json, os, pathlib
    p = pathlib.Path.home() / ".agents" / "credentials.json"
    d = json.loads(p.read_text()) if p.exists() else {"version": 1, "credentials": {}}
    d["credentials"]["bitbucket"] = {"account": "<email>"}
    t = p.with_suffix(".json.tmp")
    t.write_text(json.dumps(d, indent=2) + "\n")
    os.chmod(t, 0o600)
    t.replace(p)
    PY
    

If ~/.agents/ does not yet exist, create it first per the credential-storage skill's setup section (mkdir -p ~/.agents && chmod 700 ~/.agents).


Base URLs and Authentication Headers

GitHub

Base URL: https://api.github.com
curl -H "Authorization: Bearer $TOKEN" \
     -H "Accept: application/vnd.github+json" \
     -H "X-GitHub-Api-Version: 2022-11-28" \
     "https://api.github.com/repos/{owner}/{repo}/pulls"

Bitbucket Cloud

Base URL: https://api.bitbucket.org/2.0
curl -u "$BB_EMAIL:$BB_API_TOKEN" \
     -H "Content-Type: application/json" \
     "https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pullrequests"

Error Handling

HTTP StatusMeaningAction
401Invalid or expired tokenRe-check the credential via credential-storage; rotate the token if needed
403Insufficient permissionsCheck token scopes — needs PR read/write
404Repo not found or no accessVerify workspace/owner and repo slug; check token scope includes the repo
422Validation errorRead the error message body for field-level details
429Rate limitedWait and retry; GitHub includes X-RateLimit-Reset header

Debugging auth issues

# GitHub — verify token works
curl -s -o /dev/null -w "%{http_code}" \
  -H "Authorization: Bearer $TOKEN" \
  https://api.github.com/user

# Bitbucket — verify credentials work
curl -s -o /dev/null -w "%{http_code}" \
  -u "$BB_EMAIL:$BB_API_TOKEN" \
  https://api.bitbucket.org/2.0/user

Pagination

GitHub

Page-based. Use per_page (max 100) and page query params. Follow the rel="next" URL in the Link response header until absent.

# First page
curl -H "Authorization: Bearer $TOKEN" \
  "https://api.github.com/repos/{owner}/{repo}/pulls?per_page=100&page=1"
# Check Link header for next page URL

Bitbucket

Page-based. Use pagelen (max 100) and page query params. Follow the next URL in the JSON response until absent.

# First page
curl -u "$BB_EMAIL:$BB_API_TOKEN" \
  "https://api.bitbucket.org/2.0/repositories/{workspace}/{repo}/pullrequests?pagelen=50&page=1"
# Check .next in JSON response for next page URL

Quick Reference

ConceptGitHubBitbucket
Base URLhttps://api.github.comhttps://api.bitbucket.org/2.0
Auth headerAuthorization: Bearer <token>Basic auth (-u email:api_token)
Credential namegithubbitbucket
Credential accountdefaultAtlassian email
PR path prefix/repos/{owner}/{repo}/pulls/repositories/{workspace}/{repo_slug}/pullrequests
PR identifierpull_number (integer)pull_request_id (integer)
Paginationpage + per_page; Link headerpage + pagelen; next in JSON body
Token typeFine-grained PAT with PR permissionsAPI token with PR read/write scopes

Anti-Patterns

Anti-patternProblemFix
Hardcoding tokens in scripts or skill filesTokens leak into version controlRead via credential-storage at runtime; never embed token values in code
Echoing or logging the token after fetchPlaintext leaks to stdout, scrollback, and agent transcriptsCapture into a shell variable; use directly via header or -u; unset after
Assuming gh CLI is availablegh is GitHub-only and may not be installedUse curl against the REST API for both platforms
Skipping platform detectionWrong API endpoints, confusing errorsAlways parse the git remote URL first
Ignoring paginationMissing PRs/comments beyond the first pageFollow next/Link header until exhausted
Using classic GitHub tokens without repo scope404 errors on private reposUse fine-grained tokens with explicit repo + PR permissions
Calling endpoints before credentials are registeredCryptic curl errors with empty authVerify both github and bitbucket entries exist; guide the user through registration if missing
Falling back to plaintext token files on lookup failureQuietly downgrades the security postureFail loud; require the user to register the credential properly

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.