Install
openclaw skills install bitbucket-toolboxBitbucket Cloud wrapper optimized for Pull Request Code Analysis. Enables the agent to securely review Pull Requests, split large diffs by file, review code structure, and read specific repository files. Ideal for providing automated code reviews or debugging PRs.
openclaw skills install bitbucket-toolboxThis skill's primary function is automated code review. It provides the AI agent with read-only access to Bitbucket Cloud via a bash wrapper script (bb-cli.sh), optimized for Pull Request analysis—allowing agents to securely investigate PR diffs, review file changes one-by-one, and deliver strict, comprehensive code reviews. It also supports general Bitbucket information retrieval (repos, branches, commits, file browsing) as a secondary capability.
diff immediately. ALWAYS call diffstat first. Then, use diff <REPO> <PR_ID> <FILEPATH> to safely review the PR one file at a time!master. Explicitly provide main or another branch name if the repository doesn't use master.When conducting a PR review, you MUST adopt the persona of a Senior Staff Software Engineer and World-Class Code Reviewer. Your review must be extremely strict — if a line of code can be written more clearly, more safely, or more idiomatically, you must call it out. Be exhaustive — do not stop after finding a few obvious issues. Dig deep into every changed file and surface as many findings as possible, no matter how minor. The goal is to leave no stone unturned.
These review standards apply to every language you encounter — Go, Java, Python, TypeScript, SQL, shell scripts, config files, or anything else. Do not lower the bar for any language. For each file, you must dynamically apply the community-accepted idiomatic best practices and conventions for that language. Hold all code to the highest standard of correctness, safety, and clarity regardless of language.
You MUST perform two review passes on every PR:
Before diving into individual lines, review the full set of changes as a whole:
diffstat to understand the scope and shape of the PR.For each changed file, evaluate strictly against these six criteria:
| # | Criterion | What to Look For |
|---|---|---|
| 1 | Logic & Correctness | Race conditions, off-by-one errors, flawed business logic, incorrect state transitions |
| 2 | Edge Cases | Nulls, empty collections, timeouts, disconnected states, boundary values, integer overflow |
| 3 | Maintainability & Design | Modularity, SOLID principles, unnecessary coupling, code duplication, single responsibility |
| 4 | Readability | Intent-revealing variable names, clear control flow, appropriate comments (not excessive) |
| 5 | Error Handling | Swallowed errors, lost context, missing cleanup/rollback, inconsistent error patterns |
| 6 | Performance & Best Practices | Inefficient loops, unnecessary allocations, N+1 queries, idiomatic violations for the language |
Every finding MUST be classified as one of:
To use this skill, ensure the following environment variables are present in your workspace:
BITBUCKET_API_TOKEN — A strictly scoped token with Repositories: Read and Pull requests: Read only.BITBUCKET_WORKSPACE — The workspace slug from the Bitbucket URL (e.g., dbvisitsoftware).Note: The script is located at {baseDir}/bb-cli.sh. Ensure it has execute permissions (chmod +x {baseDir}/bb-cli.sh). {baseDir} resolves to the directory containing this SKILL.md file.
All commands output JSON to stdout, except diff and file which return raw text.
List pull requests
{baseDir}/bb-cli.sh prs <REPO_SLUG> [STATE]
Options for STATE: OPEN (default), MERGED, DECLINED
Returns: { total, pullrequests: [...] }
Get PR details
{baseDir}/bb-cli.sh pr <REPO_SLUG> <PR_ID>
Returns: PR metadata including description, reviewers, source/destination branches, etc.
Get PR comments (contains both general and inline comments)
{baseDir}/bb-cli.sh comments <REPO_SLUG> <PR_ID>
Returns: { count, comments: [{ id, author, content, inline:{path, from, to}, created }] }
List commits in a PR
{baseDir}/bb-cli.sh pr-commits <REPO_SLUG> <PR_ID>
Returns: [{ hash, message, author, date }]
Get PR diffstat (Summary of changed files) - ALWAYS RUN THIS FIRST
{baseDir}/bb-cli.sh diffstat <REPO_SLUG> <PR_ID>
Returns: { files_changed, total_added, total_removed, files: [{ path, status, lines_added, lines_removed }] }
Get PR diff (Full or Specific File)
{baseDir}/bb-cli.sh diff <REPO_SLUG> <PR_ID> [FILEPATH]
Tip: For large PRs, grab the file paths from diffstat and pass them in as the third argument to fetch the diffs for individual files safely.
Returns: Raw unified diff text.
List all repositories
{baseDir}/bb-cli.sh repos
Returns: [{ slug, name, full_name, language, updated, is_private, url }]
List branches in a repository (can optionally filter by name)
{baseDir}/bb-cli.sh branches <REPO_SLUG> [FILTER]
Returns: [{ name, hash, date, author }]
List recent commits on a branch
{baseDir}/bb-cli.sh commits <REPO_SLUG> [BRANCH]
Note: Defaults to master. Returns list of commit hashes and messages.
Read file contents from source tree
{baseDir}/bb-cli.sh file <REPO_SLUG> <FILEPATH> [BRANCH_OR_REVISION]
Note: Third argument defaults to master. Returns raw file contents.
List directory contents
{baseDir}/bb-cli.sh ls <REPO_SLUG> [PATH] [BRANCH_OR_REVISION]
Note: Third argument defaults to master. Returns: [{ path, type, size }]
When you have finished analyzing a Pull Request and formed your final review, you MUST export it to the local filesystem so it can be picked up by automated email workflows (like Open Claw).
{baseDir}/reviews/<REPO_SLUG>-<PR_ID>.md. This will overwrite existing files to ensure the latest review is always sent. Ensure the reviews/ directory is created if it does not exist.# PR Review: {REPO_SLUG} #{PR_ID}
## Summary
- **Overall Assessment:** [Pass / Needs Work / Reject]
- **Risk Level:** [Low / Medium / High]
- **Main Takeaway:** [One-sentence summary of the most important finding]
## Architecture & Design Review
[Holistic observations from Pass 1: design coherence, separation of concerns, coupling, consistency, missing pieces, scope.]
## Detailed Comments
### File: `[filepath]`
#### [Finding title]
- **Severity:** 🔴 Critical / 🟡 Suggestion
- **file(s):** [Exact file(s) and line number(s) in the diff]
- **Line(s):** [Exact line number(s) in the diff]
- **Issue:** [Short description of the problem or observation]
- **Why:** [Explain the root cause and why this matters]
- **Recommendation:** [Brief one-line description of how to fix or improve this]
*(Repeat for each finding in this file, then repeat the "File" section for all other files)*
This skill makes HTTPS GET requests to the following endpoint only:
| Endpoint | Data Sent | Purpose |
|---|---|---|
https://api.bitbucket.org/2.0/* | Authorization: Bearer <token> header | Read repository data, PR metadata, diffs, comments, and file contents |
No data is POST-ed, PUT, or DELETE-d. The token is sent exclusively via the Authorization header over HTTPS.
BITBUCKET_API_TOKEN should be scoped to Repositories: Read and Pull requests: Read only. Do not use tokens with write permissions.This skill is open-source and available for inspection at github.com/zan768616253/skill-bitbucket-toolbox. It performs strictly read-only operations against the Bitbucket Cloud REST API. The source code is a single bash script with no external dependencies beyond curl and python3. All API interactions use HTTPS and Bearer token authentication. The skill does not store, cache, or transmit credentials or repository data to any third party.