jpskill.com
🛠️ 開発・MCP コミュニティ

bitbucket-devops

Bitbucketのパイプライン状況確認、失敗分析、ログダウンロード、ビルド実行などを、Node.js APIを使って自動化し、パイプラインのデバッグやトラブルシューティングを効率的に行うSkill。

📜 元の英語説明(参考)

Comprehensive Bitbucket pipeline automation using direct Node.js API calls. Monitor pipeline status, analyze failures, download logs, and trigger builds. Use this skill when the user asks to check pipeline status, find failing pipelines, download logs, trigger builds, or debug pipeline failures. No MCP approval prompts required - uses Bash tool with node commands.

🇯🇵 日本人クリエイター向け解説

一言でいうと

Bitbucketのパイプライン状況確認、失敗分析、ログダウンロード、ビルド実行などを、Node.js APIを使って自動化し、パイプラインのデバッグやトラブルシューティングを効率的に行うSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o bitbucket-devops.zip https://jpskill.com/download/17226.zip && unzip -o bitbucket-devops.zip && rm bitbucket-devops.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/17226.zip -OutFile "$d\bitbucket-devops.zip"; Expand-Archive "$d\bitbucket-devops.zip" -DestinationPath $d -Force; ri "$d\bitbucket-devops.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して bitbucket-devops.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → bitbucket-devops フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
3

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Bitbucket DevOps Skill

この Skill は、Bash ツールを介した直接的な Node.js API 呼び出しを使用して、包括的な Bitbucket DevOps 自動化を提供します。bitbucket-mcp クライアントライブラリ上に構築されています。

主な利点: MCP ツールではなく、直接的な Node.js 呼び出し(自動承認)を使用するため、GitHub Issue #10801 の承認プロンプトの問題を解消します。

⚠️ 必須: ユーザーリクエストへの対応方法

すべての Bitbucket 操作において、この 3 段階のフォールバック戦略に必ず従ってください。これは必須であり、オプションではありません。

重要なルール:

  • Bitbucket API 呼び出しのために新しい .js ファイルを作成しないでください
  • インラインの Bitbucket API 操作に node -e を使用しないでください
  • 以下に示す事前構築済みの CLI ツールのみを使用してください
  • 常に Tier 1 から開始し、必要に応じて Tier 2 にフォールバックし、Tier 3 は最後の手段としてのみ使用してください

Tier 1: 高レベルヘルパー関数 (最初のステップとして必須)

他のアプローチを試みる前に、まずこれらのヘルパーをチェックする必要があります。

これらは、一般的なワークフローを単一のコマンドで解決します。ユーザーのリクエストがこれらのパターンのいずれかに一致する場合は、対応するヘルパーを必ず使用する必要があります。

場所: ~/.claude/skills/bitbucket-devops/lib/helpers.js

利用可能なコマンド:

  • get-latest-failed <workspace> <repo> - 最新の失敗したパイプラインを取得
  • get-latest <workspace> <repo> - 最新のパイプラインを取得 (ステータスに関係なく)
  • get-by-number <workspace> <repo> <build-number> - ビルド番号でパイプラインを検索
  • get-failed-steps <workspace> <repo> <pipeline-uuid> - すべての失敗したステップを取得
  • download-failed-logs <workspace> <repo> <pipeline-uuid> <build-number> - すべての失敗したステップのログをダウンロード
  • get-info <workspace> <repo> <pipeline-uuid> - フォーマットされたパイプライン + ステップ情報を取得

必ず使用するケース: "latest failed build"、"download logs for pipeline #123"、"what failed in this build"、"get pipeline by number"

使用方法:

node ~/.claude/skills/bitbucket-devops/lib/helpers.js <command> <args>

例:

# User: "What's the latest failing pipeline?"
# You MUST use:
node ~/.claude/skills/bitbucket-devops/lib/helpers.js get-latest-failed "workspace" "repo"

# DO NOT create a new script
# DO NOT use node -e
# DO NOT write custom API calls

Tier 2: 低レベル CLI コマンド (Tier 1 で解決できない場合)

Tier 1 ヘルパーがユーザーのリクエストに一致しない場合にのみ、Tier 2 を使用してください。

特定の操作のための直接的な API ラッパーです。Tier 1 ヘルパーでカバーされていない操作には、これらを必ず使用する必要があります。

場所: ~/.claude/skills/bitbucket-devops/bitbucket-mcp/dist/index-cli.js

主要なコマンド (完全なリストは docs/REFERENCE.md を参照):

パイプライン操作:

  • list-pipelines <workspace> <repo> [limit]
  • get-pipeline <workspace> <repo> <pipeline-uuid>
  • get-pipeline-steps <workspace> <repo> <pipeline-uuid>
  • get-step-logs <workspace> <repo> <pipeline-uuid> <step-uuid>
  • run-pipeline <workspace> <repo> <branch> [pipeline-name] [variables-json]
  • stop-pipeline <workspace> <repo> <pipeline-uuid>

プルリクエスト操作:

  • list-prs <workspace> <repo> [state] [limit]
  • get-pr <workspace> <repo> <pr_id>
  • approve-pr <workspace> <repo> <pr_id>
  • merge-pr <workspace> <repo> <pr_id> [message] [strategy]
  • decline-pr <workspace> <repo> <pr_id> [message]

リポジトリ操作:

  • get-branching-model <workspace> <repo>
  • list-repositories <workspace>

使用方法:

node ~/.claude/skills/bitbucket-devops/bitbucket-mcp/dist/index-cli.js <command> <args>

複数の Tier 2 コマンドをチェーンすることができます - 例については docs/PATTERNS.md を参照してください。

Tier 3: 直接的な Bitbucket API 呼び出し (Tier 1 と 2 が失敗した場合のみ)

Tier 1 と Tier 2 の両方でリクエストを解決できない場合にのみ、Tier 3 を使用してください。これはまれであるはずです。

Tier 3 を使用する前に、以下を必ず実行してください。

  1. Tier 1 ヘルパーが存在しないことを確認する
  2. Tier 2 CLI コマンドが存在しないことを確認する
  3. Tier 1 + Tier 2 の組み合わせで解決できないことを確認する

ドキュメント: ~/.claude/skills/bitbucket-devops/bitbucket-mcp/docs/

  • api-overview.md - 認証、ベース URL、レート制限
  • pipelines-api.md - 完全なパイプライン API リファレンス
  • repositories-api.md - リポジトリ操作
  • pull-requests-api.md - PR 操作 (将来)

必須の意思決定プロセス

Bitbucket 操作を実行する前に、必ず以下を実行してください。

  1. Tier 1 ヘルパーを確認する - 上記の 6 つのヘルパーを確認します。これで解決できますか?

    • YESnode ~/.claude/skills/bitbucket-devops/lib/helpers.js <command> で直ちに使用します
    • NO → ステップ 2 に進みます
  2. Tier 2 CLI を確認する - 上記の CLI コマンドを確認します。1 つまたは複数のコマンドで解決できますか?

    • YESnode ~/.claude/skills/bitbucket-devops/bitbucket-mcp/dist/index-cli.js <command> で使用します
    • NO → ステップ 3 に進みます
  3. Tier 3 ドキュメントを確認する - API ドキュメントを読みます。必要な直接的な API 呼び出しはありますか?

    • YES → ドキュメントを読み、認証情報を使用して curl を使用します
    • NO → ユーザーに説明を求めます

このプロセスを絶対にスキップしないでください。新しい .js ファイルを絶対に作成しないでください。常に事前構築済みのツールを使用してください。


既知の制限事項

パイプラインアーティファクトは API 経由でダウンロードできません

重要: Bitbucket Cloud は、パイプラインアーティファクトをダウンロードするための API を提供していません。

ユーザーがビルドアーティファクトのダウンロードを要求した場合:

  1. API 経由でのアーティファクトのダウンロードは不可能であることを伝えます
  2. Bitbucket Web UI に誘導します:
    • Repository → Pipelines → Build # → Step → Artifacts section → Download button
  3. 注: アーティファクトは 14 日後に自動的に期限切れになります

ヒント: プログラムによるアーティファクトアクセスについては、パイプライン中に S3/Azure Blob Storage へのアップロードを検討してください。

以下はしないでください: ドキュメント化されていないエンドポイントを検索しないでください - これは徹底的に調査されており、API は存在しません。


DevOps REPL の利点

従来のパイプラインのデバッグは遅いです: コードをプッシュ → 待機 → 失敗 → ログを調査 → 修正 → 反復 (サイクルごとに数時間)。

この Skill は、DevOps のための REPL のようなエクスペリエンス を実現します: Claude はパイプラインをリアルタイムで監視し、障害を即座に分析し、提案します

(原文がここで切り詰められています)

📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Bitbucket DevOps Skill

This skill provides comprehensive Bitbucket DevOps automation using direct Node.js API calls via the Bash tool. Built on the bitbucket-mcp client library.

Key Advantage: Uses direct Node.js calls (auto-approved) instead of MCP tools, eliminating the approval prompts issue from GitHub Issue #10801.

⚠️ MANDATORY: How to Approach User Requests

You MUST follow this three-tier fallback strategy for ALL Bitbucket operations. This is REQUIRED, not optional.

CRITICAL RULES:

  • DO NOT create new .js files for Bitbucket API calls
  • DO NOT use node -e for inline Bitbucket API operations
  • ONLY use the pre-built CLI tools listed below
  • ALWAYS start with Tier 1, fall back to Tier 2 if needed, use Tier 3 only as last resort

Tier 1: High-Level Helper Functions (REQUIRED FIRST STEP)

You MUST check these helpers FIRST before attempting any other approach.

These solve common workflows in a single command. If the user's request matches any of these patterns, you MUST use the corresponding helper.

Location: ~/.claude/skills/bitbucket-devops/lib/helpers.js

Available Commands:

  • get-latest-failed <workspace> <repo> - Get most recent failed pipeline
  • get-latest <workspace> <repo> - Get most recent pipeline (any status)
  • get-by-number <workspace> <repo> <build-number> - Find pipeline by build number
  • get-failed-steps <workspace> <repo> <pipeline-uuid> - Get all failed steps
  • download-failed-logs <workspace> <repo> <pipeline-uuid> <build-number> - Download all failed step logs
  • get-info <workspace> <repo> <pipeline-uuid> - Get formatted pipeline + steps info

MUST use for: "latest failed build", "download logs for pipeline #123", "what failed in this build", "get pipeline by number"

Usage:

node ~/.claude/skills/bitbucket-devops/lib/helpers.js <command> <args>

Example:

# User: "What's the latest failing pipeline?"
# You MUST use:
node ~/.claude/skills/bitbucket-devops/lib/helpers.js get-latest-failed "workspace" "repo"

# DO NOT create a new script
# DO NOT use node -e
# DO NOT write custom API calls

Tier 2: Low-Level CLI Commands (IF TIER 1 CANNOT SOLVE)

ONLY use Tier 2 if NO Tier 1 helper matches the user's request.

Direct API wrappers for specific operations. You MUST use these for operations not covered by Tier 1 helpers.

Location: ~/.claude/skills/bitbucket-devops/bitbucket-mcp/dist/index-cli.js

Key Commands (see docs/REFERENCE.md for complete list):

Pipeline Operations:

  • list-pipelines <workspace> <repo> [limit]
  • get-pipeline <workspace> <repo> <pipeline-uuid>
  • get-pipeline-steps <workspace> <repo> <pipeline-uuid>
  • get-step-logs <workspace> <repo> <pipeline-uuid> <step-uuid>
  • run-pipeline <workspace> <repo> <branch> [pipeline-name] [variables-json]
  • stop-pipeline <workspace> <repo> <pipeline-uuid>

Pull Request Operations:

  • list-prs <workspace> <repo> [state] [limit]
  • get-pr <workspace> <repo> <pr_id>
  • approve-pr <workspace> <repo> <pr_id>
  • merge-pr <workspace> <repo> <pr_id> [message] [strategy]
  • decline-pr <workspace> <repo> <pr_id> [message]

Repository Operations:

  • get-branching-model <workspace> <repo>
  • list-repositories <workspace>

Usage:

node ~/.claude/skills/bitbucket-devops/bitbucket-mcp/dist/index-cli.js <command> <args>

You MAY chain multiple Tier 2 commands - see docs/PATTERNS.md for examples.

Tier 3: Direct Bitbucket API Calls (ONLY IF TIER 1 AND 2 FAIL)

ONLY use Tier 3 if BOTH Tier 1 AND Tier 2 cannot solve the request. This should be RARE.

Before using Tier 3, you MUST:

  1. Verify no Tier 1 helper exists
  2. Verify no Tier 2 CLI command exists
  3. Verify no combination of Tier 1 + Tier 2 can solve it

Documentation: ~/.claude/skills/bitbucket-devops/bitbucket-mcp/docs/

  • api-overview.md - Authentication, base URLs, rate limits
  • pipelines-api.md - Complete pipeline API reference
  • repositories-api.md - Repository operations
  • pull-requests-api.md - PR operations (future)

REQUIRED Decision Process

Before performing ANY Bitbucket operation, you MUST:

  1. Check Tier 1 helpers - Review the 6 helpers above. Does one solve this?

    • YES → Use it immediately with node ~/.claude/skills/bitbucket-devops/lib/helpers.js <command>
    • NO → Continue to step 2
  2. Check Tier 2 CLI - Review the CLI commands above. Can one or more solve this?

    • YES → Use them with node ~/.claude/skills/bitbucket-devops/bitbucket-mcp/dist/index-cli.js <command>
    • NO → Continue to step 3
  3. Check Tier 3 docs - Read API docs. Is there a direct API call needed?

    • YES → Read docs, use curl with credentials
    • NO → Ask user for clarification

NEVER skip this process. NEVER create new .js files. ALWAYS use pre-built tools.


Known Limitations

Pipeline Artifacts Cannot Be Downloaded via API

IMPORTANT: Bitbucket Cloud does NOT provide an API to download pipeline artifacts.

If a user asks to download build artifacts:

  1. Inform them that artifact download via API is not possible
  2. Direct them to the Bitbucket web UI:
    • Repository → Pipelines → Build # → Step → Artifacts section → Download button
  3. Note: Artifacts expire automatically after 14 days

Tip: For programmatic artifact access, consider uploading to S3/Azure Blob Storage during your pipeline.

DO NOT: Search for undocumented endpoints - this has been thoroughly researched and no API exists.


The DevOps REPL Advantage

Traditional pipeline debugging is slow: push code → wait → fail → investigate logs → fix → repeat (hours per cycle).

This skill enables a REPL-like experience for DevOps: Claude observes pipelines in real-time, analyzes failures instantly, suggests precise fixes, and iterates with you until builds pass - reducing debugging cycles from hours to minutes.

The Loop:

  1. Read: Monitor pipeline execution and capture failures
  2. Eval: AI analyzes logs and identifies root cause
  3. Print: Claude presents findings and suggests fixes
  4. Loop: Apply fix, trigger build, repeat until green ✅

This transforms DevOps from slow batch processing into interactive, conversational development.


Prerequisites

This skill uses the Bash tool (auto-approved in Claude Code) to run Node.js commands. Required:

  • Node.js (v18+)
  • Git (for submodule management)

Note: No MCP server required - bitbucket-mcp is used as a library via git submodule.


Configuration

The skill directory is located at: ~/.claude/skills/bitbucket-devops/

Credentials are loaded with priority (first found wins):

  1. Project level: ./credentials.json or ./.bitbucket-credentials (current working directory)
  2. User level: ~/.bitbucket-credentials (home directory)
  3. Skill level: ~/.claude/skills/bitbucket-devops/credentials.json

Credential Format

IMPORTANT: Different credentials for different operations

{
  "url": "https://api.bitbucket.org/2.0",
  "workspace": "your-workspace-name",
  "user_email": "your-email@example.com",
  "username": "your-workspace-name",
  "password": "your-bitbucket-app-password"
}

Field explanations:

  • user_email: Your Bitbucket account email (for API authentication) - MUST contain @
  • username: Your Bitbucket workspace slug (for git operations) - MUST NOT contain @
  • password: App password from https://bitbucket.org/account/settings/app-passwords/
    • Required permissions: Repositories: Read, Pipelines: Read

See docs/GIT_OPERATIONS.md for details on credential requirements.


Quick Start: Essential Patterns

Pattern 0: Always Detect Workspace and Repository First

Before any pipeline operation, determine the workspace and repository.

Auto-detect from git remote:

git_url=$(git config --get remote.origin.url 2>/dev/null)
if [[ "$git_url" =~ bitbucket.org[:/]([^/]+)/([^/.]+) ]]; then
  WORKSPACE="${BASH_REMATCH[1]}"
  REPO="${BASH_REMATCH[2]}"
  echo "Detected: $WORKSPACE/$REPO"
fi

Or ask user: "What's your Bitbucket workspace and repository name?"

IMPORTANT: Use actual values in commands. Never use literal strings "workspace" or "repo".

Pattern 1: Find Latest Failing Pipeline

node ~/.claude/skills/bitbucket-devops/lib/helpers.js \
  get-latest-failed "workspace" "repo"

Present to user:

Latest failed pipeline:
- Pipeline #123
- Branch: main
- Commit: abc123d - "Fix bug in deployment"
- Status: FAILED

Pattern 2: Download Logs for Failed Pipeline

# Step 1: Get pipeline by build number
node ~/.claude/skills/bitbucket-devops/lib/helpers.js \
  get-by-number "workspace" "repo" 123

# Step 2: Download all failed step logs
node ~/.claude/skills/bitbucket-devops/lib/helpers.js \
  download-failed-logs "workspace" "repo" "{pipeline-uuid}" 123

Present to user:

Downloaded logs for 2 failed steps:

1. Deploy
   - Saved to: .pipeline-logs/pipeline-123-Deploy.log
   - Size: 12.4 KB

2. Integration_Tests
   - Saved to: .pipeline-logs/pipeline-123-Integration_Tests.log
   - Size: 45.2 KB

Important: Check log file size before displaying. If > 50KB, show summary only:

tail -n 100 .pipeline-logs/pipeline-123-Deploy.log
grep -i "error\|failed\|exception" .pipeline-logs/pipeline-123-Deploy.log

Pattern 3: The DevOps REPL Loop (Full Debugging Workflow)

User: "Fix the failing build"

1. READ - Find and Analyze Failure:

node ~/.claude/skills/bitbucket-devops/lib/helpers.js get-latest-failed "workspace" "repo"
node ~/.claude/skills/bitbucket-devops/lib/helpers.js get-failed-steps "workspace" "repo" "{uuid}"
node ~/.claude/skills/bitbucket-devops/lib/helpers.js download-failed-logs "workspace" "repo" "{uuid}" 123

2. EVAL - Analyze the Logs:

grep -i "error\|failed\|exception\|fatal" .pipeline-logs/*.log
grep -i -A 5 -B 5 "error" .pipeline-logs/pipeline-*.log

3. PRINT - Suggest Fix:

Found the issue in Pipeline #123:

Error Type: TypeScript compilation error
Location: src/auth/service.ts:42
Error: Property 'userId' does not exist on type 'User'

Root Cause: The User interface was updated but this file wasn't

Suggested Fix:
Change line 42 from:
  return user.userId
To:
  return user.id

Should I apply this fix?

4. LOOP - Apply Fix and Re-Test:

# Apply fix using Edit tool
# Commit changes
git add src/auth/service.ts
git commit -m "Fix: Update User property reference from userId to id"

# Trigger new pipeline run
node ~/.claude/skills/bitbucket-devops/bitbucket-mcp/dist/index-cli.js \
  run-pipeline "workspace" "repo" "branch-name"

# Monitor the new build
node ~/.claude/skills/bitbucket-devops/lib/helpers.js get-by-number "workspace" "repo" <new-build-number>

5. REPEAT or CELEBRATE:

  • If new build FAILS: Go back to step 1 with new logs
  • If new build SUCCEEDS: ✅ Success! Build is green
  • If new build IN_PROGRESS: Monitor with Pattern 9

This transforms hours of manual debugging into minutes of AI-assisted iteration.


Complete Documentation

For comprehensive coverage, refer to these detailed guides:


Log Storage

Logs are downloaded to .pipeline-logs/ in the directory where VSCode is opened (your working directory).

Structure:

/path/to/open-project/
├── .pipeline-logs/           ← Created automatically here
│   ├── pipeline-123-Deploy.log
│   ├── pipeline-123-Test.log
│   └── errors-only.txt
├── src/
└── ...

Important:

  • Logs are stored in the current working directory
  • Always use relative path: .pipeline-logs/filename.log
  • Tell user to add .pipeline-logs/ to their project's .gitignore
  • Logs persist across sessions for easy reference

Common Errors (Quick Reference)

Error Cause Solution
"Pipeline not found" Build number too old Use get-latest-failed instead
"Logs unavailable" Pipeline still running Wait for completion
"No credential file found" Missing credentials.json Copy from credentials.json.template
"Node.js not found" Node not installed Install Node.js v18+
"Submodule not initialized" Git submodule missing Run bash install.sh
"401 Unauthorized" Wrong credentials Check user_email (not username) in credentials.json
"Git auth failed" Wrong username Check username (not email) for git operations

For detailed troubleshooting: See docs/TROUBLESHOOTING.md


Best Practices

  1. Always confirm workspace/repo - Auto-detect from git or ask user
  2. Check pipeline status before logs - Don't request logs for running pipelines
  3. Limit initial results - Start with 10 recent pipelines, increase if needed
  4. Smart log filtering - Use grep to find errors first
  5. Cache results - Store JSON responses in variables to avoid redundant calls
  6. Use helper functions - Prefer Tier 1 helpers for common operations

Performance Notes

  • No approval prompts: Bash tool with node commands is auto-approved
  • Direct API calls: No MCP protocol overhead
  • Credential caching: Loaded once per invocation
  • Bitbucket rate limits: 60 requests/hour per user (standard tier)

Credits

This skill is built on bitbucket-mcp by Apra Labs, forked from @MatanYemini's original work.

Architecture: Uses bitbucket-mcp as a library (git submodule), NOT as an MCP server. This approach eliminates approval prompts while maintaining full API functionality.

License: CC BY 4.0 Maintained by: Apra Labs

同梱ファイル

※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。