Skip to content

Instantly share code, notes, and snippets.

@swombat
Created February 19, 2026 16:47
Show Gist options
  • Select an option

  • Save swombat/ae26e573e824713eae59404a87a7bbab to your computer and use it in GitHub Desktop.

Select an option

Save swombat/ae26e573e824713eae59404a87a7bbab to your computer and use it in GitHub Desktop.
Claude Code SKILL.md - Gmail, Google Docs, Drive & Calendar skill definition
name description
gmail
Access Gmail, Google Docs, Drive, and Calendar. Use when asked about emails, documents, meeting notes, calendar, files, or schedule. Supports multiple accounts.

Google Services Skill (Gmail, Docs, Drive, Calendar)

Access multiple Gmail/Google accounts via the command line.

Available Accounts

Alias Email Use For Gmail Docs/Drive/Cal
personal you@gmail.com Personal email
work you@company.com Work email
business you@business.io Business/consulting

Configure your own accounts in the ACCOUNTS dict at the top of each script.

Quick Reference

All commands use this pattern:

python3 ~/.claude/skills/gmail/scripts/gmail_cli.py --account ACCOUNT [--json] COMMAND [OPTIONS]

List Recent Emails

# Personal inbox (default)
python3 ~/.claude/skills/gmail/scripts/gmail_cli.py list --limit 10

# Specific account
python3 ~/.claude/skills/gmail/scripts/gmail_cli.py --account work list --limit 10

# Only unread
python3 ~/.claude/skills/gmail/scripts/gmail_cli.py --account business list --unread

# JSON output (for processing)
python3 ~/.claude/skills/gmail/scripts/gmail_cli.py --json --account personal list --limit 5

Search Emails

Uses Gmail search syntax:

# Search by sender
python3 ~/.claude/skills/gmail/scripts/gmail_cli.py --account work search "from:colleague@company.com"

# Search by subject
python3 ~/.claude/skills/gmail/scripts/gmail_cli.py search "subject:invoice"

# Recent emails with attachments
python3 ~/.claude/skills/gmail/scripts/gmail_cli.py search "has:attachment newer_than:7d"

# Unread from specific person
python3 ~/.claude/skills/gmail/scripts/gmail_cli.py search "is:unread from:someone@example.com"

Read Specific Email

python3 ~/.claude/skills/gmail/scripts/gmail_cli.py read MESSAGE_ID

# With JSON output
python3 ~/.claude/skills/gmail/scripts/gmail_cli.py --json read MESSAGE_ID

Send Email

# Simple send
python3 ~/.claude/skills/gmail/scripts/gmail_cli.py --account work send \
  --to "recipient@example.com" \
  --subject "Subject line" \
  --body "Email body here"

# With body from stdin (useful for longer messages)
echo "Long email body..." | python3 ~/.claude/skills/gmail/scripts/gmail_cli.py send \
  --to "recipient@example.com" \
  --subject "Subject" \
  --body -

# With CC and attachments
python3 ~/.claude/skills/gmail/scripts/gmail_cli.py send \
  --to "main@example.com" \
  --cc "copy@example.com" \
  --subject "Report attached" \
  --body "Please find attached." \
  --attachments /path/to/file.pdf

Reply to Email

echo "Reply body..." | python3 ~/.claude/skills/gmail/scripts/gmail_cli.py reply MESSAGE_ID --body -

Manage Emails

# Mark as read
python3 ~/.claude/skills/gmail/scripts/gmail_cli.py mark-read MESSAGE_ID

# Mark as unread
python3 ~/.claude/skills/gmail/scripts/gmail_cli.py mark-unread MESSAGE_ID

# List labels
python3 ~/.claude/skills/gmail/scripts/gmail_cli.py labels

Check Account Status

python3 ~/.claude/skills/gmail/scripts/gmail_cli.py accounts

Gmail Search Syntax Quick Reference

Query Description
from:name From specific sender
to:name To specific recipient
subject:word In subject line
is:unread Unread messages
is:starred Starred messages
has:attachment Has attachments
newer_than:7d Last 7 days
older_than:1m Older than 1 month
after:2024/01/01 After specific date
label:LABEL With specific label
in:inbox In inbox
in:sent In sent

Combine with AND (space) or OR: from:alice OR from:bob

Routing Guidelines

Customize this section to tell Claude which account to use based on context. For example:

  • Work mentions (colleagues, projects) -> use work
  • Business/consulting -> use business
  • Personal/default -> use personal

Google Docs, Drive & Calendar

These use a separate script with its own authentication.

python3 ~/.claude/skills/gmail/scripts/google_cli.py --account ACCOUNT [--json] COMMAND [OPTIONS]

Read a Google Doc

Fetch meeting notes or any Google Doc by URL or ID:

# By URL
python3 ~/.claude/skills/gmail/scripts/google_cli.py --account work doc "https://docs.google.com/document/d/DOC_ID/edit"

# By ID only
python3 ~/.claude/skills/gmail/scripts/google_cli.py --account work doc DOC_ID

Google Drive

# List recent files
python3 ~/.claude/skills/gmail/scripts/google_cli.py --account work drive-list --limit 10

# List only docs
python3 ~/.claude/skills/gmail/scripts/google_cli.py --account work drive-list --type docs

# Search files
python3 ~/.claude/skills/gmail/scripts/google_cli.py --account work drive-search "project proposal"

Google Calendar

# Today's events
python3 ~/.claude/skills/gmail/scripts/google_cli.py --account work today

# Upcoming events (next 7 days)
python3 ~/.claude/skills/gmail/scripts/google_cli.py --account work calendar --days 7

# Next 5 events
python3 ~/.claude/skills/gmail/scripts/google_cli.py --account work calendar --limit 5

Google Services Account Status

python3 ~/.claude/skills/gmail/scripts/google_cli.py accounts

Setup

Gmail accounts:

python3 ~/.claude/skills/gmail/scripts/gmail_cli.py accounts

Google Docs/Drive/Calendar:

python3 ~/.claude/skills/gmail/scripts/google_cli.py accounts

If an account shows "NOT SET UP", run:

python3 ~/.claude/skills/gmail/scripts/gmail_cli.py setup

Troubleshooting

If auth fails or tokens expire:

# Gmail tokens
rm ~/.claude/skills/gmail/config/token_*.json

# Google services tokens (Docs/Drive/Calendar)
rm ~/.claude/skills/gmail/config/google_token_*.json

# Then re-run any command to re-authenticate

Token location: ~/.claude/skills/gmail/config/

Revoke access: https://myaccount.google.com/permissions

Important: Publish the OAuth app (move out of "Testing" mode) or refresh tokens expire after 7 days!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment