mcpField
J
jules

jules

github.com/sanjay3290エージェントワークフロー447389 回インストール7 週間前に更新
リポジトリ

jules について

GitHub リポジトリのコーディング作業を Google の Jules AI エージェントに委任するスキルです。対話型 CLI と API キーによるヘッドレス自動化に対応し、セッションの追跡や変更の取得も行えます。

主な機能

  1. 01Jules のコーディングタスク作成
  2. 02CLI または API による認証
  3. 03GitHub リポジトリとブランチの指定
  4. 04タスクセッションの監視
  5. 05完了した変更の取得または適用

活用シーン

  1. 01バグ修正を Jules に委任
  2. 02テストやドキュメントの作成依頼
  3. 03タスクの進捗確認と差分の確認
  4. 04完了した作業をローカルブランチに適用

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/sanjay3290/ai-skills --skill jules

インストール後、Claude Code で/julesを入力して読み込まれたか確認します。

詳細

Jules タスクの委任

GitHub リポジトリのコーディングタスクを、Google の Jules AI エージェントに委任します。

環境変数

変数必須説明
JULES_API_KEYAPI 認証に必要jules.google.com/settings で取得する API キー

セットアップ(最初のコマンドを実行する前に)

2 つの認証方法があります。対話形式で使用する場合は 方法 1、ヘッドレス/エージェントで使用する場合は 方法 2 を選択してください。

方法 1:CLI(対話形式)
1. CLI をインストール
which jules || npm install -g @google/jules
2. 認証を確認
jules remote list --repo

失敗した場合 → jules login を実行するようユーザーに伝えてください(ヘッドレスの場合は --no-launch-browser を指定)

方法 2:API キー(ヘッドレス/エージェントでの使用)
1. API キーを取得

jules.google.com/settings でキーを取得します(アカウントごとに最大 3 キー)。

2. 環境変数を設定
export JULES_API_KEY="your-api-key"
3. 確認
curl -s -H "x-goog-api-key: $JULES_API_KEY" \
  "https://jules.googleapis.com/v1alpha/sessions?pageSize=1" | head -20
共通のセットアップ(両方の方法)
リポジトリを自動検出
git remote get-url origin 2>/dev/null | sed -E 's#.*(github\.com)[/:]([^/]+/[^/.]+)(\.git)?#\2#'

GitHub でない場合、または git リポジトリ内でない場合 → --repo owner/repo を指定するようユーザーに尋ねてください

リポジトリの接続を確認

リポジトリが jules remote list --repo にあるか確認します。ない場合 → https://jules.google.com に誘導してください

コマンド(CLI)

タスクの作成
jules new "Fix auth bug"                                   # Auto-detected repo
jules new --repo owner/repo "Add unit tests"               # Specific repo
jules new --repo owner/repo --parallel 3 "Implement X"     # Parallel sessions
cat task.md | jules new --repo owner/repo                  # From stdin
監視
jules remote list --session    # All sessions
jules remote list --repo       # Connected repos
結果の取得
jules remote pull --session <id>         # View diff
jules remote pull --session <id> --apply # Apply locally
jules teleport <id>                      # Clone + apply
最新セッションのショートカット
LATEST=$(jules remote list --session 2>/dev/null | awk 'NR==2 {print $1}')
jules remote pull --session $LATEST

コマンド(API)

タスクの作成
curl -s -X POST "https://jules.googleapis.com/v1alpha/sessions" \
  -H "x-goog-api-key: $JULES_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Fix auth bug",
    "prompt": "Fix the authentication timeout issue in src/auth.ts",
    "sourceContext": {
      "repository": "owner/repo",
      "branchName": "main"
    },
    "automationMode": "AUTO_CREATE_PR",
    "requirePlanApproval": false
  }'

主なフィールド:

  • prompt — タスクの説明(必須)
  • sourceContext.repository — GitHub の owner/repo(必須)
  • sourceContext.branchName — 対象ブランチ(デフォルト:リポジトリのデフォルトブランチ)
  • automationMode — PR を自動作成する場合は "AUTO_CREATE_PR" を指定し、手動の場合は省略します
  • title — セッションの表示名
  • requirePlanApproval — 実行前に計画レビューのため一時停止する場合は true
セッションの一覧表示
curl -s -H "x-goog-api-key: $JULES_API_KEY" \
  "https://jules.googleapis.com/v1alpha/sessions?pageSize=10"
セッションのステータスを取得
curl -s -H "x-goog-api-key: $JULES_API_KEY" \
  "https://jules.googleapis.com/v1alpha/sessions/SESSION_ID"
完了するまでポーリング(API)
SESSION_ID="<id>"
while true; do
  STATE=$(curl -s -H "x-goog-api-key: $JULES_API_KEY" \
    "https://jules.googleapis.com/v1alpha/sessions/$SESSION_ID" \
    | python3 -c "import sys,json; print(json.load(sys.stdin).get('state','UNKNOWN'))")
  case "$STATE" in
    COMPLETED)
      echo "Done!"
      break ;;
    FAILED)
      echo "Failed. Check: https://jules.google.com/session/$SESSION_ID"
      break ;;
    *)
      echo "State: $STATE - waiting 30s..."
      sleep 30 ;;
  esac
done

コンテキストのスマートな注入

現在のコンテキストをプロンプトに追加して、結果を改善します。

BRANCH=$(git branch --show-current)
RECENT_FILES=$(git diff --name-only HEAD~3 2>/dev/null | head -10 | tr '\n' ', ')
RECENT_COMMITS=$(git log --oneline -5 | tr '\n' '; ')
STAGED=$(git diff --cached --name-only | tr '\n' ', ')

タスクを作成するときに使用(CLI):

jules new --repo owner/repo "Fix the bug in auth module. Context: branch=$BRANCH, recently modified: $RECENT_FILES"

タスクを作成するときに使用(API):

curl -s -X POST "https://jules.googleapis.com/v1alpha/sessions" \
  -H "x-goog-api-key: $JULES_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{
    \"prompt\": \"Fix the bug in auth module. Context: branch=$BRANCH, recently modified: $RECENT_FILES\",
    \"sourceContext\": {\"repository\": \"owner/repo\", \"branchName\": \"$BRANCH\"},
    \"automationMode\": \"AUTO_CREATE_PR\"
  }"

プロンプトテンプレート

よく使うタスク向けのクイックコマンド:

テストの追加
FILES=$(git diff --name-only HEAD~3 2>/dev/null | grep -E '\.(js|ts|py|go|java)$' | head -5 | tr '\n' ', ')
jules new "Add unit tests for recently modified files: $FILES. Include edge cases and mocks where needed."
ドキュメントの追加
FILES=$(git diff --name-only HEAD~3 2>/dev/null | grep -E '\.(js|ts|py|go|java)$' | head -5 | tr '\n' ', ')
jules new "Add documentation comments to: $FILES. Include function descriptions, parameters, return values, and examples."
Lint エラーの修正
jules new "Fix all linting errors in the codebase. Run the linter, identify issues, and fix them while maintaining code functionality."
PR のレビュー
PR_NUM=123
PR_INFO=$(gh pr view $PR_NUM --json title,body,files --jq '"\(.title)\n\(.body)\nFiles: \(.files[].path)"')
jules new "Review this PR for bugs, security issues, and improvements: $PR_INFO"

Git 統合(適用+コミット)

Jules の完了後、新しいブランチに変更を適用します。

SESSION_ID="<id>"
TASK_DESC="<brief description>"

# Create branch, apply, commit
git checkout -b "jules/$SESSION_ID"
jules remote pull --session "$SESSION_ID" --apply
git add -A
git commit -m "feat: $TASK_DESC

Jules session: $SESSION_ID"

# Optional: push and create PR
git push -u origin "jules/$SESSION_ID"
gh pr create --title "$TASK_DESC" --body "Automated changes from Jules session $SESSION_ID"

完了するまでポーリング(CLI)

セッションの完了を待ちます。

SESSION_ID="<id>"
while true; do
  STATUS=$(jules remote list --session 2>/dev/null | grep "$SESSION_ID" | awk '{print $NF}')
  case "$STATUS" in
    Completed)
      echo "Done!"
      jules remote pull --session "$SESSION_ID"
      break ;;
    Failed)
      echo "Failed. Check: https://jules.google.com/session/$SESSION_ID"
      break ;;
    *User*)
      echo "Needs input: https://jules.google.com/session/$SESSION_ID"
      break ;;
    *)
      echo "Status: $STATUS - waiting 30s..."
      sleep 30 ;;
  esac
done

AGENTS.md テンプレート

Jules の結果を改善するため、リポジトリのルートに作成します。

# AGENTS.md

## Project Overview
[Brief description]

## Tech Stack
- Language: [TypeScript/Python/Go/etc.]
- Framework: [React/FastAPI/Gin/etc.]
- Testing: [Jest/pytest/go test/etc.]

## Code Conventions
- [Linter/formatter used]
- [Naming conventions]
- [File organization]

## Testing Requirements
- Unit tests for new features
- Integration tests for APIs
- Coverage target: [X]%

## Build & Deploy
- Build: `[command]`
- Test: `[command]`

セッションの状態

ステータス操作
計画中/進行中待機
ユーザー F の応答待ちWeb UI で応答
完了結果を取得
失敗Web UI を確認

注意事項

  • CLI から返信できない場合 → Jules からの質問には Web UI を使用します
  • CLI からキャンセルできない場合 → Web UI からキャンセルします
  • GitHub のみ対応 → GitLab/Bitbucket はサポートされていません
  • AGENTS.md → Jules はコンテキストとしてリポジトリのルートから読み込みます
  • API と CLI の使い分け → ヘッドレス/エージェントによる自動化には API(JULES_API_KEY)を使用し、対話形式のセッションには CLI を使用します

コメント