🛠️ Google Workspace CLI
Google Workspaceの管理作業を効率化するSkillです
📺 まず動画で見る(YouTube)
▶ 【衝撃】最強のAIエージェント「Claude Code」の最新機能・使い方・プログラミングをAIで効率化する超実践術を解説! ↗
※ jpskill.com 編集部が参考用に選んだ動画です。動画の内容と Skill の挙動は厳密には一致しないことがあります。
📜 元の英語説明(参考)
Google Workspace administration via the gws CLI. Install, authenticate, and automate Gmail, Drive, Sheets, Calendar, Docs, Chat, and Tasks. Run security audits, execute 43 built-in recipes, and use 10 persona bundles. Use for Google Workspace admin, gws CLI setup, Gmail automation, Drive management, or Calendar scheduling.
🇯🇵 日本人クリエイター向け解説
Google Workspaceの管理作業を効率化するSkillです
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o google-workspace-cli.zip https://jpskill.com/download/4665.zip && unzip -o google-workspace-cli.zip && rm google-workspace-cli.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/4665.zip -OutFile "$d\google-workspace-cli.zip"; Expand-Archive "$d\google-workspace-cli.zip" -DestinationPath $d -Force; ri "$d\google-workspace-cli.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
google-workspace-cli.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
google-workspace-cliフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-17
- 取得日時
- 2026-05-18
- 同梱ファイル
- 11
💬 こう話しかけるだけ — サンプルプロンプト
- › Google Workspace CLI を使って、最小構成のサンプルコードを示して
- › Google Workspace CLI の主な使い方と注意点を教えて
- › Google Workspace CLI を既存プロジェクトに組み込む方法を教えて
これをClaude Code に貼るだけで、このSkillが自動発動します。
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
[Skill 名] google-workspace-cli
Google Workspace CLI
オープンソースの gws CLI を使用した Google Workspace 管理のための専門的なガイダンスと自動化。インストール、認証、18 以上のサービス API、43 の組み込みレシピ、およびロールベースのワークフローのための 10 のペルソナバンドルをカバーしています。
クイックスタート
インストールの確認
# gws がインストールされ、認証されていることを確認します
python3 scripts/gws_doctor.py
メールを送信する
gws gmail users.messages send me --to "team@company.com" \
--subject "Weekly Update" --body "Here's this week's summary..."
ドライブのファイルを一覧表示する
gws drive files list --json --limit 20 | python3 scripts/output_analyzer.py --select "name,mimeType,modifiedTime" --format table
インストール
npm (推奨)
npm install -g @anthropic/gws
gws --version
Cargo (ソースから)
cargo install gws-cli
gws --version
プレビルド済みバイナリ
macOS、Linux、または Windows 用は github.com/googleworkspace/cli/releases からダウンロードしてください。
インストールの確認
python3 scripts/gws_doctor.py
# チェック項目: PATH、バージョン、認証ステータス、サービス接続
認証
OAuth セットアップ (インタラクティブ)
# ステップ 1: Google Cloud プロジェクトと OAuth 認証情報を作成します
python3 scripts/auth_setup_guide.py --guide oauth
# ステップ 2: 認証セットアップを実行します
gws auth setup
# ステップ 3: 検証します
gws auth status --json
サービスアカウント (ヘッドレス/CI)
# セットアップ手順を生成します
python3 scripts/auth_setup_guide.py --guide service-account
# キーファイルで設定します
export GWS_SERVICE_ACCOUNT_KEY=/path/to/key.json
export GWS_DELEGATED_USER=admin@company.com
gws auth status
環境変数
# .env テンプレートを生成します
python3 scripts/auth_setup_guide.py --generate-env
| 変数 | 目的 |
|---|---|
GWS_CLIENT_ID |
OAuth クライアント ID |
GWS_CLIENT_SECRET |
OAuth クライアント シークレット |
GWS_TOKEN_PATH |
カスタムトークン保存パス |
GWS_SERVICE_ACCOUNT_KEY |
サービスアカウント JSON キーパス |
GWS_DELEGATED_USER |
偽装するユーザー (サービスアカウント) |
GWS_DEFAULT_FORMAT |
デフォルトの出力形式 (json/ndjson/table) |
認証の検証
python3 scripts/auth_setup_guide.py --validate --json
# 各サービスエンドポイントをテストします
ワークフロー 1: Gmail 自動化
目標: メール操作 (送信、検索、ラベル付け、フィルタ管理) を自動化します。
送信と返信
# 新しいメールを送信します
gws gmail users.messages send me --to "client@example.com" \
--subject "Proposal" --body "Please find attached..." \
--attachment proposal.pdf
# スレッドに返信します
gws gmail users.messages reply me --thread-id <THREAD_ID> \
--body "Thanks for your feedback..."
# メッセージを転送します
gws gmail users.messages forward me --message-id <MSG_ID> \
--to "manager@company.com"
検索とフィルタ
# メールを検索します
gws gmail users.messages list me --query "from:client@example.com after:2025/01/01" --json \
| python3 scripts/output_analyzer.py --count
# ラベルを一覧表示します
gws gmail users.labels list me --json
# フィルタを作成します
gws gmail users.settings.filters create me \
--criteria '{"from":"notifications@service.com"}' \
--action '{"addLabelIds":["Label_123"],"removeLabelIds":["INBOX"]}'
一括操作
# 30 日以上前の既読メールをすべてアーカイブします
gws gmail users.messages list me --query "is:read older_than:30d" --json \
| python3 scripts/output_analyzer.py --select "id" --format json \
| xargs -I {} gws gmail users.messages modify me {} --removeLabelIds INBOX
ワークフロー 2: ドライブとスプレッドシート
目標: ファイルの管理、スプレッドシートの作成、共有の設定、データのエクスポートを行います。
ファイル操作
# ファイルを一覧表示します
gws drive files list --json --limit 50 \
| python3 scripts/output_analyzer.py --select "name,mimeType,size" --format table
# ファイルをアップロードします
gws drive files create --name "Q1 Report" --upload report.pdf \
--parents <FOLDER_ID>
# Google スプレッドシートを作成します
gws sheets spreadsheets create --title "Budget 2026" --json
# ダウンロード/エクスポート
gws drive files export <FILE_ID> --mime "application/pdf" --output report.pdf
共有
# ユーザーと共有します
gws drive permissions create <FILE_ID> \
--type user --role writer --emailAddress "colleague@company.com"
# ドメインと共有します (閲覧のみ)
gws drive permissions create <FILE_ID> \
--type domain --role reader --domain "company.com"
# アクセス権を持つユーザーを一覧表示します
gws drive permissions list <FILE_ID> --json
スプレッドシートデータ
# 範囲を読み取ります
gws sheets spreadsheets.values get <SHEET_ID> --range "Sheet1!A1:D10" --json
# データを書き込みます
gws sheets spreadsheets.values update <SHEET_ID> --range "Sheet1!A1" \
--values '[["Name","Score"],["Alice",95],["Bob",87]]'
# 行を追加します
gws sheets spreadsheets.values append <SHEET_ID> --range "Sheet1!A1" \
--values '[["Charlie",92]]'
ワークフロー 3: カレンダーと会議
目標: イベントのスケジュール設定、空き時間の検索、スタンドアップレポートの生成を行います。
イベント管理
# イベントを作成します
gws calendar events insert primary \
--summary "Sprint Planning" \
--start "2026-03-15T10:00:00" --end "2026-03-15T11:00:00" \
--attendees "team@company.com" \
--location "Conference Room A"
# 今後のイベントを一覧表示します
gws calendar events list primary --timeMin "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
--maxResults 10 --json
# クイックイベント (自然言語)
gws helpers quick-event "Lunch with Sarah tomorrow at noon"
空き時間の検索
# 複数の人の空き時間を確認します
gws helpers find-time \
--attendees "alice@co.com,bob@co.com,charlie@co.com" \
--duration 60 --within "2026-03-15,2026-03-19" --json
スタンドアップレポート
# カレンダーとタスクから日次スタンドアップを生成します
gws recipes standup-report --json \
| python3 scripts/output_analyzer.py --format table
# 会議準備 (議題 + 出席者情報)
gws recipes meeting-prep --event-id <EVENT_ID>
ワークフロー 4: セキュリティ
(原文がここで切り詰められています)
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Google Workspace CLI
Expert guidance and automation for Google Workspace administration using the open-source gws CLI. Covers installation, authentication, 18+ service APIs, 43 built-in recipes, and 10 persona bundles for role-based workflows.
Quick Start
Check Installation
# Verify gws is installed and authenticated
python3 scripts/gws_doctor.py
Send an Email
gws gmail users.messages send me --to "team@company.com" \
--subject "Weekly Update" --body "Here's this week's summary..."
List Drive Files
gws drive files list --json --limit 20 | python3 scripts/output_analyzer.py --select "name,mimeType,modifiedTime" --format table
Installation
npm (recommended)
npm install -g @anthropic/gws
gws --version
Cargo (from source)
cargo install gws-cli
gws --version
Pre-built Binaries
Download from github.com/googleworkspace/cli/releases for macOS, Linux, or Windows.
Verify Installation
python3 scripts/gws_doctor.py
# Checks: PATH, version, auth status, service connectivity
Authentication
OAuth Setup (Interactive)
# Step 1: Create Google Cloud project and OAuth credentials
python3 scripts/auth_setup_guide.py --guide oauth
# Step 2: Run auth setup
gws auth setup
# Step 3: Validate
gws auth status --json
Service Account (Headless/CI)
# Generate setup instructions
python3 scripts/auth_setup_guide.py --guide service-account
# Configure with key file
export GWS_SERVICE_ACCOUNT_KEY=/path/to/key.json
export GWS_DELEGATED_USER=admin@company.com
gws auth status
Environment Variables
# Generate .env template
python3 scripts/auth_setup_guide.py --generate-env
| Variable | Purpose |
|---|---|
GWS_CLIENT_ID |
OAuth client ID |
GWS_CLIENT_SECRET |
OAuth client secret |
GWS_TOKEN_PATH |
Custom token storage path |
GWS_SERVICE_ACCOUNT_KEY |
Service account JSON key path |
GWS_DELEGATED_USER |
User to impersonate (service accounts) |
GWS_DEFAULT_FORMAT |
Default output format (json/ndjson/table) |
Validate Authentication
python3 scripts/auth_setup_guide.py --validate --json
# Tests each service endpoint
Workflow 1: Gmail Automation
Goal: Automate email operations — send, search, label, and filter management.
Send and Reply
# Send a new email
gws gmail users.messages send me --to "client@example.com" \
--subject "Proposal" --body "Please find attached..." \
--attachment proposal.pdf
# Reply to a thread
gws gmail users.messages reply me --thread-id <THREAD_ID> \
--body "Thanks for your feedback..."
# Forward a message
gws gmail users.messages forward me --message-id <MSG_ID> \
--to "manager@company.com"
Search and Filter
# Search emails
gws gmail users.messages list me --query "from:client@example.com after:2025/01/01" --json \
| python3 scripts/output_analyzer.py --count
# List labels
gws gmail users.labels list me --json
# Create a filter
gws gmail users.settings.filters create me \
--criteria '{"from":"notifications@service.com"}' \
--action '{"addLabelIds":["Label_123"],"removeLabelIds":["INBOX"]}'
Bulk Operations
# Archive all read emails older than 30 days
gws gmail users.messages list me --query "is:read older_than:30d" --json \
| python3 scripts/output_analyzer.py --select "id" --format json \
| xargs -I {} gws gmail users.messages modify me {} --removeLabelIds INBOX
Workflow 2: Drive & Sheets
Goal: Manage files, create spreadsheets, configure sharing, and export data.
File Operations
# List files
gws drive files list --json --limit 50 \
| python3 scripts/output_analyzer.py --select "name,mimeType,size" --format table
# Upload a file
gws drive files create --name "Q1 Report" --upload report.pdf \
--parents <FOLDER_ID>
# Create a Google Sheet
gws sheets spreadsheets create --title "Budget 2026" --json
# Download/export
gws drive files export <FILE_ID> --mime "application/pdf" --output report.pdf
Sharing
# Share with user
gws drive permissions create <FILE_ID> \
--type user --role writer --emailAddress "colleague@company.com"
# Share with domain (view only)
gws drive permissions create <FILE_ID> \
--type domain --role reader --domain "company.com"
# List who has access
gws drive permissions list <FILE_ID> --json
Sheets Data
# Read a range
gws sheets spreadsheets.values get <SHEET_ID> --range "Sheet1!A1:D10" --json
# Write data
gws sheets spreadsheets.values update <SHEET_ID> --range "Sheet1!A1" \
--values '[["Name","Score"],["Alice",95],["Bob",87]]'
# Append rows
gws sheets spreadsheets.values append <SHEET_ID> --range "Sheet1!A1" \
--values '[["Charlie",92]]'
Workflow 3: Calendar & Meetings
Goal: Schedule events, find available times, and generate standup reports.
Event Management
# Create an event
gws calendar events insert primary \
--summary "Sprint Planning" \
--start "2026-03-15T10:00:00" --end "2026-03-15T11:00:00" \
--attendees "team@company.com" \
--location "Conference Room A"
# List upcoming events
gws calendar events list primary --timeMin "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
--maxResults 10 --json
# Quick event (natural language)
gws helpers quick-event "Lunch with Sarah tomorrow at noon"
Find Available Time
# Check free/busy for multiple people
gws helpers find-time \
--attendees "alice@co.com,bob@co.com,charlie@co.com" \
--duration 60 --within "2026-03-15,2026-03-19" --json
Standup Report
# Generate daily standup from calendar + tasks
gws recipes standup-report --json \
| python3 scripts/output_analyzer.py --format table
# Meeting prep (agenda + attendee info)
gws recipes meeting-prep --event-id <EVENT_ID>
Workflow 4: Security Audit
Goal: Audit Google Workspace security configuration and generate remediation commands.
Run Full Audit
# Full audit across all services
python3 scripts/workspace_audit.py --json
# Audit specific services
python3 scripts/workspace_audit.py --services gmail,drive,calendar
# Demo mode (no gws required)
python3 scripts/workspace_audit.py --demo
Audit Checks
| Area | Check | Risk |
|---|---|---|
| Drive | External sharing enabled | Data exfiltration |
| Gmail | Auto-forwarding rules | Data exfiltration |
| Gmail | DMARC/SPF/DKIM records | Email spoofing |
| Calendar | Default sharing visibility | Information leak |
| OAuth | Third-party app grants | Unauthorized access |
| Admin | Super admin count | Privilege escalation |
| Admin | 2-Step verification enforcement | Account takeover |
Review and Remediate
# Review findings
python3 scripts/workspace_audit.py --json | python3 scripts/output_analyzer.py \
--filter "status=FAIL" --select "area,check,remediation"
# Execute remediation (example: restrict external sharing)
gws drive about get --json # Check current settings
# Follow remediation commands from audit output
Python Tools
| Script | Purpose | Usage |
|---|---|---|
gws_doctor.py |
Pre-flight diagnostics | python3 scripts/gws_doctor.py [--json] [--services gmail,drive] |
auth_setup_guide.py |
Guided auth setup | python3 scripts/auth_setup_guide.py --guide oauth |
gws_recipe_runner.py |
Recipe catalog & runner | python3 scripts/gws_recipe_runner.py --list [--persona pm] |
workspace_audit.py |
Security/config audit | python3 scripts/workspace_audit.py [--json] [--demo] |
output_analyzer.py |
JSON/NDJSON analysis | gws ... --json \| python3 scripts/output_analyzer.py --count |
All scripts are stdlib-only, support --json output, and include demo mode with embedded sample data.
Best Practices
Security
- Use OAuth with minimal scopes — request only what each workflow needs
- Store tokens in the system keyring, never in plain text files
- Rotate service account keys every 90 days
- Audit third-party OAuth app grants quarterly
- Use
--dry-runbefore bulk destructive operations
Automation
- Pipe
--jsonoutput throughoutput_analyzer.pyfor filtering and aggregation - Use recipes for multi-step operations instead of chaining raw commands
- Select a persona bundle to scope recipes to your role
- Use NDJSON format (
--format ndjson) for streaming large result sets - Set
GWS_DEFAULT_FORMAT=jsonin your shell profile for scripting
Performance
- Use
--fieldsto request only needed fields (reduces payload size) - Use
--limitto cap results when browsing - Use
--page-allonly when you need complete datasets - Batch operations with recipes rather than individual API calls
- Cache frequently accessed data (e.g., label IDs, folder IDs) in variables
Limitations
| Constraint | Impact |
|---|---|
| OAuth tokens expire after 1 hour | Re-auth needed for long-running scripts |
| API rate limits (per-user, per-service) | Bulk operations may hit 429 errors |
| Scope requirements vary by service | Must request correct scopes during auth |
| Pre-v1.0 CLI status | Breaking changes possible between releases |
| Google Cloud project required | Free, but requires setup in Cloud Console |
| Admin API needs admin privileges | Some audit checks require Workspace Admin role |
Required Scopes by Service
# List scopes for specific services
python3 scripts/auth_setup_guide.py --scopes gmail,drive,calendar,sheets
| Service | Key Scopes |
|---|---|
| Gmail | gmail.modify, gmail.send, gmail.labels |
| Drive | drive.file, drive.metadata.readonly |
| Sheets | spreadsheets |
| Calendar | calendar, calendar.events |
| Admin | admin.directory.user.readonly, admin.directory.group |
| Tasks | tasks |
同梱ファイル
※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。
- 📄 SKILL.md (10,362 bytes)
- 📎 assets/persona-profiles.md (8,075 bytes)
- 📎 assets/workspace-config.json (1,762 bytes)
- 📎 references/gws-command-reference.md (10,717 bytes)
- 📎 references/recipes-cookbook.md (8,510 bytes)
- 📎 references/troubleshooting.md (6,796 bytes)
- 📎 scripts/auth_setup_guide.py (13,112 bytes)
- 📎 scripts/gws_doctor.py (9,014 bytes)
- 📎 scripts/gws_recipe_runner.py (20,205 bytes)
- 📎 scripts/output_analyzer.py (11,636 bytes)
- 📎 scripts/workspace_audit.py (11,154 bytes)