jpskill.com
🛠️ 開発・MCP コミュニティ 🔴 エンジニア向け 👤 エンジニア・AI開発者

🛠️ Gmail Automation

gmail-automation

Gmailの機能を他のシステムと連携させ、

⏱ ライブラリ調査+組込 半日 → 1時間

📺 まず動画で見る(YouTube)

▶ 【衝撃】最強のAIエージェント「Claude Code」の最新機能・使い方・プログラミングをAIで効率化する超実践術を解説! ↗

※ jpskill.com 編集部が参考用に選んだ動画です。動画の内容と Skill の挙動は厳密には一致しないことがあります。

📜 元の英語説明(参考)

Lightweight Gmail integration with standalone OAuth authentication. No MCP server required.

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

一言でいうと

Gmailの機能を他のシステムと連携させ、

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

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

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

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

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

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して gmail-automation.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → gmail-automation フォルダができる
  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-17
取得日時
2026-05-17
同梱ファイル
1

💬 こう話しかけるだけ — サンプルプロンプト

  • Gmail Automation を使って、最小構成のサンプルコードを示して
  • Gmail Automation の主な使い方と注意点を教えて
  • Gmail Automation を既存プロジェクトに組み込む方法を教えて

これをClaude Code に貼るだけで、このSkillが自動発動します。

📖 Skill本文(日本語訳)

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

Gmail

スタンドアロンのOAuth認証による軽量なGmail連携です。MCPサーバーは不要です。

⚠️ Google Workspaceアカウントが必要です。 個人のGmailアカウントはサポートされていません。

使用する場面

  • MCPサーバーなしで、コマンドラインからGmailメッセージを検索、閲覧、または送信する必要がある場合。
  • Google Workspaceアカウントの受信トレイワークフローを自動化している場合。
  • スタンドアロンのOAuthスクリプトによってサポートされる軽量なGmail連携が必要な場合。

初回セットアップ

Googleで認証します(ブラウザが開きます):

python scripts/auth.py login

認証ステータスを確認します:

python scripts/auth.py status

必要に応じてログアウトします:

python scripts/auth.py logout

コマンド

すべての操作はscripts/gmail.pyを介して行われます。ログインしていない場合は、初回使用時に自動的に認証されます。

メールを検索する

# Gmailクエリ構文で検索
python scripts/gmail.py search "from:someone@example.com is:unread"

# 最近のメールを検索(クエリなしはすべてを返します)
python scripts/gmail.py search --limit 20

# ラベルでフィルタリング
python scripts/gmail.py search --label INBOX --limit 10

# スパムとゴミ箱を含める
python scripts/gmail.py search "subject:important" --include-spam-trash

メールの内容を閲覧する

# メッセージの全内容を取得
python scripts/gmail.py get MESSAGE_ID

# メタデータ(ヘッダー)のみを取得
python scripts/gmail.py get MESSAGE_ID --format metadata

# 最小限の応答(IDのみ)を取得
python scripts/gmail.py get MESSAGE_ID --format minimal

メールを送信する

# シンプルなメールを送信
python scripts/gmail.py send --to "user@example.com" --subject "Hello" --body "Message body"

# CCとBCCを付けて送信
python scripts/gmail.py send --to "user@example.com" --cc "cc@example.com" --bcc "bcc@example.com" \
  --subject "Team Update" --body "Update message"

# エイリアスから送信(Gmail設定で設定されている必要があります)
python scripts/gmail.py send --to "user@example.com" --subject "Hello" --body "Message" \
  --from "Mile9 Accounts <accounts@mile9.io>"

# HTMLメールを送信
python scripts/gmail.py send --to "user@example.com" --subject "HTML Email" \
  --body "<h1>Hello</h1><p>HTML content</p>" --html

下書きの管理

# 下書きを作成
python scripts/gmail.py create-draft --to "user@example.com" --subject "Draft Subject" \
  --body "Draft content"

# 既存の下書きを送信
python scripts/gmail.py send-draft DRAFT_ID

メッセージの変更(ラベル)

# 既読にする(UNREADラベルを削除)
python scripts/gmail.py modify MESSAGE_ID --remove-label UNREAD

# 未読にする
python scripts/gmail.py modify MESSAGE_ID --add-label UNREAD

# アーカイブする(INBOXから削除)
python scripts/gmail.py modify MESSAGE_ID --remove-label INBOX

# メッセージにスターを付ける
python scripts/gmail.py modify MESSAGE_ID --add-label STARRED

# メッセージのスターを外す
python scripts/gmail.py modify MESSAGE_ID --remove-label STARRED

# 重要マークを付ける
python scripts/gmail.py modify MESSAGE_ID --add-label IMPORTANT

# 複数のラベル変更を一度に行う
python scripts/gmail.py modify MESSAGE_ID --remove-label UNREAD --add-label STARRED

ラベルを一覧表示する

# すべてのGmailラベル(システムおよびユーザー作成)を一覧表示
python scripts/gmail.py list-labels

Gmailクエリ構文

Gmailは強力な検索演算子をサポートしています:

クエリ 説明
from:user@example.com 特定の送信者からのメール
to:user@example.com 特定の受信者へのメール
subject:meeting 件名に「meeting」を含むメール
is:unread 未読メール
is:starred スター付きメール
is:important 重要マーク付きメール
has:attachment 添付ファイル付きメール
after:2024/01/01 指定日以降のメール
before:2024/12/31 指定日以前のメール
newer_than:7d 過去7日間のメール
older_than:1m 1ヶ月以上前のメール
label:work 特定のラベルが付いたメール
in:inbox 受信トレイ内のメール
in:sent 送信済みメール
in:trash ゴミ箱内のメール

AND (スペース)、OR、または - (NOT) と組み合わせて使用します:

python scripts/gmail.py search "from:boss@company.com is:unread newer_than:1d"
python scripts/gmail.py search "subject:urgent OR subject:important"
python scripts/gmail.py search "from:newsletter@example.com -is:starred"

一般的なラベルID

ラベル ID
受信トレイ INBOX
送信済み SENT
下書き DRAFT
スパム SPAM
ゴミ箱 TRASH
スター付き STARRED
重要 IMPORTANT
未読 UNREAD

トークン管理

トークンはシステムキーリングを使用して安全に保存されます:

  • macOS: キーチェーン
  • Windows: Windows資格情報マネージャー
  • Linux: Secret Service API (GNOME Keyring、KDE Walletなど)

サービス名: gmail-skill-oauth

トークンはGoogleのクラウド機能を使用して、期限切れ時に自動的に更新されます。

制限事項

  • このスキルは、タスクが上記の範囲と明確に一致する場合にのみ使用してください。
  • 出力を環境固有の検証、テスト、または専門家によるレビューの代わりとして扱わないでください。
  • 必要な入力、権限、安全境界、または成功基準が不足している場合は、停止して説明を求めてください。
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Gmail

Lightweight Gmail integration with standalone OAuth authentication. No MCP server required.

⚠️ Requires Google Workspace account. Personal Gmail accounts are not supported.

When to Use

  • You need to search, read, or send Gmail messages from the command line without an MCP server.
  • You are automating inbox workflows for a Google Workspace account.
  • You want a lightweight Gmail integration backed by standalone OAuth scripts.

First-Time Setup

Authenticate with Google (opens browser):

python scripts/auth.py login

Check authentication status:

python scripts/auth.py status

Logout when needed:

python scripts/auth.py logout

Commands

All operations via scripts/gmail.py. Auto-authenticates on first use if not logged in.

Search Emails

# Search with Gmail query syntax
python scripts/gmail.py search "from:someone@example.com is:unread"

# Search recent emails (no query returns all)
python scripts/gmail.py search --limit 20

# Filter by label
python scripts/gmail.py search --label INBOX --limit 10

# Include spam and trash
python scripts/gmail.py search "subject:important" --include-spam-trash

Read Email Content

# Get full message content
python scripts/gmail.py get MESSAGE_ID

# Get just metadata (headers)
python scripts/gmail.py get MESSAGE_ID --format metadata

# Get minimal response (IDs only)
python scripts/gmail.py get MESSAGE_ID --format minimal

Send Emails

# Send a simple email
python scripts/gmail.py send --to "user@example.com" --subject "Hello" --body "Message body"

# Send with CC and BCC
python scripts/gmail.py send --to "user@example.com" --cc "cc@example.com" --bcc "bcc@example.com" \
  --subject "Team Update" --body "Update message"

# Send from an alias (must be configured in Gmail settings)
python scripts/gmail.py send --to "user@example.com" --subject "Hello" --body "Message" \
  --from "Mile9 Accounts <accounts@mile9.io>"

# Send HTML email
python scripts/gmail.py send --to "user@example.com" --subject "HTML Email" \
  --body "<h1>Hello</h1><p>HTML content</p>" --html

Draft Management

# Create a draft
python scripts/gmail.py create-draft --to "user@example.com" --subject "Draft Subject" \
  --body "Draft content"

# Send an existing draft
python scripts/gmail.py send-draft DRAFT_ID

Modify Messages (Labels)

# Mark as read (remove UNREAD label)
python scripts/gmail.py modify MESSAGE_ID --remove-label UNREAD

# Mark as unread
python scripts/gmail.py modify MESSAGE_ID --add-label UNREAD

# Archive (remove from INBOX)
python scripts/gmail.py modify MESSAGE_ID --remove-label INBOX

# Star a message
python scripts/gmail.py modify MESSAGE_ID --add-label STARRED

# Unstar a message
python scripts/gmail.py modify MESSAGE_ID --remove-label STARRED

# Mark as important
python scripts/gmail.py modify MESSAGE_ID --add-label IMPORTANT

# Multiple label changes at once
python scripts/gmail.py modify MESSAGE_ID --remove-label UNREAD --add-label STARRED

List Labels

# List all Gmail labels (system and user-created)
python scripts/gmail.py list-labels

Gmail Query Syntax

Gmail supports powerful search operators:

Query Description
from:user@example.com Emails from a specific sender
to:user@example.com Emails to a specific recipient
subject:meeting Emails with "meeting" in subject
is:unread Unread emails
is:starred Starred emails
is:important Important emails
has:attachment Emails with attachments
after:2024/01/01 Emails after a date
before:2024/12/31 Emails before a date
newer_than:7d Emails from last 7 days
older_than:1m Emails older than 1 month
label:work Emails with a specific label
in:inbox Emails in inbox
in:sent Sent emails
in:trash Trashed emails

Combine with AND (space), OR, or - (NOT):

python scripts/gmail.py search "from:boss@company.com is:unread newer_than:1d"
python scripts/gmail.py search "subject:urgent OR subject:important"
python scripts/gmail.py search "from:newsletter@example.com -is:starred"

Common Label IDs

Label ID
Inbox INBOX
Sent SENT
Drafts DRAFT
Spam SPAM
Trash TRASH
Starred STARRED
Important IMPORTANT
Unread UNREAD

Token Management

Tokens stored securely using the system keyring:

  • macOS: Keychain
  • Windows: Windows Credential Locker
  • Linux: Secret Service API (GNOME Keyring, KDE Wallet, etc.)

Service name: gmail-skill-oauth

Tokens automatically refresh when expired using Google's cloud function.

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.