agentleFS
abdullahkhawerabdullahkhawer/devops-skills/skills/bitbucket-cli/SKILL.md

bitbucket-cli

Skill8 starsChanged 7 months agoApache-2.0View on GitHub

Perform Bitbucket operations using the Bitbucket REST API via curl. Use for repositories, pull requests, pipelines, and issues. ALSO use this skill when asked to review a Bitbucket PR — when a Bitbucket PR URL or PR ID is provided, fetch and review the diff instead of the code-review skill.

The file

We split this skill into the rules it gives an agent

10 rules. About 0 are common, 5 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    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
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Update the workspace below before using this skill:

    line 12
  2. Distinctive:

    If the target workspace is unclear, ask the user before running any command.

    line 19
  3. Very specific:

    Create an App Password with Repositories: Read (and Write/Pull requests: Write if mutations are needed), then save …

    line 23
  4. Very specific:

    All API calls use curl with basic auth read from the credential file:

    line 31
  5. Distinctive:

    NEVER target any Bitbucket workspace other than the one configured above.

    line 78
  6. Very specific:

    NEVER print, display, log, or store the contents of ~/.bitbucket/token or any credential value.

    line 79
  7. Very specific:

    Always read the credential inline with $(cat ~/.bitbucket/token) — never hardcode it in a command.

    line 80
  8. Very specific:

    All list endpoints are paginated (next field in the response) — follow the next URL until it is absent to fetch all pages.

    line 81
  9. Distinctive:

    NEVER merge, decline, or delete a pull request/repository without explicit user instruction.

    line 82
  10. Distinctive:

    If a repo slug or PR ID is unfamiliar, look it up with a read-only call first.

    line 83

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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

Bitbucket CLI Skill

Bitbucket Cloud has no official first-party CLI equivalent to gh/glab — use the REST API via curl for all operations.

Configuration

Update the workspace below before using this skill:

SettingValue
Bitbucket Workspace<your-workspace>
Credential File~/.bitbucket/token

If the target workspace is unclear, ask the user before running any command.

Prerequisites (one-time setup by user)

Create an App Password with Repositories: Read (and Write/Pull requests: Write if mutations are needed), then save <username>:<app-password> to the credential file. Never print or display the credential value. Do not perform these steps yourself.

mkdir -p ~/.bitbucket && echo "<username>:<app-password>" > ~/.bitbucket/token && chmod 600 ~/.bitbucket/token

Command Format

All API calls use curl with basic auth read from the credential file:

curl -s -u "$(cat ~/.bitbucket/token)" \
  "https://api.bitbucket.org/2.0/<endpoint>" | jq .

PR Code Review

When asked to review a Bitbucket PR (URL or PR ID provided), extract the <workspace/repo> and <PR_ID> from the URL (ask the user if the repo is missing), then fetch the PR metadata (GET /2.0/repositories/<workspace>/<repo>/pullrequests/<PR_ID>) and its diff (GET /2.0/repositories/<workspace>/<repo>/pullrequests/<PR_ID>/diff). To fully understand the context and impact of all code changes, read the complete source branch codebase — the diff alone does not capture the surrounding logic, dependencies, or broader design that the changes interact with. Report the PR title, author, and branches, then review all changed files for: secrets/injection/XSS (security), inefficient algorithms/memory leaks (performance), code smells/dead code (quality), missing error handling, excessive or sensitive logging, and missing/outdated documentation. For each finding, include the file path, line number(s), the problematic snippet, and a suggested fix. If nothing is wrong, summarize what was reviewed and state it looks good.

Available API Endpoints

Read-only (safe, no confirmation needed)

EndpointMethodDescription
/2.0/repositories/<workspace>GETList repositories in the workspace
/2.0/repositories/<workspace>/<repo>GETGet repository details
/2.0/repositories/<workspace>/<repo>/pullrequestsGETList pull requests
/2.0/repositories/<workspace>/<repo>/pullrequests/<id>GETGet a pull request
/2.0/repositories/<workspace>/<repo>/pullrequests/<id>/diffGETGet PR diff
/2.0/repositories/<workspace>/<repo>/pullrequests/<id>/commitsGETList PR commits
/2.0/repositories/<workspace>/<repo>/pipelines/GETList pipeline runs
/2.0/repositories/<workspace>/<repo>/issuesGETList issues

Mutating operations (confirm with user before running)

EndpointMethodDescription
/2.0/repositories/<workspace>/<repo>/pullrequestsPOSTCreate a pull request
/2.0/repositories/<workspace>/<repo>/pullrequests/<id>PUTUpdate a pull request
/2.0/repositories/<workspace>/<repo>/pullrequests/<id>/commentsPOSTComment on a pull request
/2.0/repositories/<workspace>/<repo>/pullrequests/<id>/mergePOSTMerge a pull request
/2.0/repositories/<workspace>/<repo>/pipelines/POSTTrigger a pipeline run

Never run — requires explicit human approval

EndpointMethodReason
/2.0/repositories/<workspace>/<repo>/pullrequests/<id>/declinePOSTCloses a PR without merging
/2.0/repositories/<workspace>/<repo>DELETEIrreversibly deletes the repository
/2.0/repositories/<workspace>/<repo>/pullrequests/<id>DELETEIrreversible PR deletion
/2.0/repositories/<workspace>/<repo>/branch-restrictions/<id>DELETERemoves branch protection rules

Rules

  • NEVER target any Bitbucket workspace other than the one configured above. If a URL references a different workspace, stop and ask the user to confirm.
  • NEVER print, display, log, or store the contents of ~/.bitbucket/token or any credential value.
  • Always read the credential inline with $(cat ~/.bitbucket/token) — never hardcode it in a command.
  • All list endpoints are paginated (next field in the response) — follow the next URL until it is absent to fetch all pages.
  • NEVER merge, decline, or delete a pull request/repository without explicit user instruction.
  • If a repo slug or PR ID is unfamiliar, look it up with a read-only call first.

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.