A Claude Code skill for intelligent Gmail inbox management with multi-account support.
- Multi-Account Support: Manage multiple Gmail accounts from a single interface
- Intelligent Classification: Auto-trash spam, categorize emails, prioritize important items
- Rule-Based Learning: Evolving rules based on user feedback
- Attachment Management: Download and organize attachments in bulk
- Send & Reply: Compose and reply to emails directly
- Gmail Filters: Create and manage Gmail filters programmatically
This skill requires Python 3.11+. Install dependencies using uv:
cd .claude/skills/email-copilot
uv syncOr install globally:
uv pip install -e .claude/skills/email-copilot- Go to Google Cloud Console
- Create a new project (or select existing)
- Enable the Gmail API:
- Go to "APIs & Services" > "Library"
- Search for "Gmail API" and enable it
- Configure OAuth Consent Screen:
- Go to "APIs & Services" > "OAuth consent screen"
- Enterprise (Google Workspace): Choose "Internal"
- Personal Gmail: Choose "External", then:
- Fill in app name, support email
- Add your email to "Test users"
- Add scopes:
gmail.modify,gmail.settings.basic
- Create OAuth Client ID:
- Go to "APIs & Services" > "Credentials"
- Click "Create Credentials" > "OAuth client ID"
- Choose "Desktop app"
- Download the JSON file
- Save the downloaded file as
credentials.jsonin this skill directory:.claude/skills/email-copilot/credentials.json
Copy the example config and customize:
cp .claude/skills/email-copilot/config.toml.example .claude/skills/email-copilot/config.tomlEdit config.toml to add your accounts (email will be auto-filled after authentication).
Run the authentication flow for your first account:
uv run --project .claude/skills/email-copilot python .claude/skills/email-copilot/gmail_client.py --auth defaultThis will:
- Open a browser window for Google OAuth
- After authorization, save the token to
tokens/default.json - Update
config.tomlwith your email address
Add more accounts:
uv run --project .claude/skills/email-copilot python .claude/skills/email-copilot/gmail_client.py --auth work
uv run --project .claude/skills/email-copilot python .claude/skills/email-copilot/gmail_client.py --auth personalCopy the example rules and customize:
cp .claude/skills/email-copilot/rules.md.example .claude/skills/email-copilot/rules.mdEdit rules.md to define:
- Your persona and current projects
- Auto-trash senders and subjects
- Email categories and actions
All commands use uv run to ensure correct dependencies:
# Shorthand for all commands below
UV="uv run --project .claude/skills/email-copilot python"uv run --project .claude/skills/email-copilot python .claude/skills/email-copilot/gmail_client.py --check# List all accounts
uv run --project .claude/skills/email-copilot python .claude/skills/email-copilot/gmail_client.py
# Set default account
uv run --project .claude/skills/email-copilot python .claude/skills/email-copilot/gmail_client.py --set-default work
# Remove an account
uv run --project .claude/skills/email-copilot python .claude/skills/email-copilot/gmail_client.py --remove old-account# List emails
uv run --project .claude/skills/email-copilot python .claude/skills/email-copilot/scripts/email_cli.py list -n 100
# List from specific account
uv run --project .claude/skills/email-copilot python .claude/skills/email-copilot/scripts/email_cli.py -a work list -n 100
# Search emails
uv run --project .claude/skills/email-copilot python .claude/skills/email-copilot/scripts/email_cli.py list -q "from:github.com is:unread"
# Read email
uv run --project .claude/skills/email-copilot python .claude/skills/email-copilot/scripts/email_cli.py read <msg_id>
# Trash emails
uv run --project .claude/skills/email-copilot python .claude/skills/email-copilot/scripts/email_cli.py trash '["id1","id2"]'
# Move emails to label
uv run --project .claude/skills/email-copilot python .claude/skills/email-copilot/scripts/email_cli.py move "Archive" '["id1"]' -r# Send email
uv run --project .claude/skills/email-copilot python .claude/skills/email-copilot/scripts/email_cli.py send \
--to "user@example.com" \
--subject "Hello" \
--body "Message body"
# Reply to email
uv run --project .claude/skills/email-copilot python .claude/skills/email-copilot/scripts/email_cli.py reply <msg_id> --body "Reply text"# List attachments
uv run --project .claude/skills/email-copilot python .claude/skills/email-copilot/scripts/email_cli.py attachments <msg_id>
# Download attachments
uv run --project .claude/skills/email-copilot python .claude/skills/email-copilot/scripts/email_cli.py download <msg_id> -o ./downloads
# Bulk download from search
uv run --project .claude/skills/email-copilot python .claude/skills/email-copilot/scripts/email_cli.py search-download -q "from:anthropic invoice" -o ./invoices# List filters
uv run --project .claude/skills/email-copilot python .claude/skills/email-copilot/scripts/email_cli.py filters list
# Add filter
uv run --project .claude/skills/email-copilot python .claude/skills/email-copilot/scripts/email_cli.py filters add \
--from "newsletter@example.com" \
--add-label "Newsletters" \
--archive --mark-read
# Delete filter
uv run --project .claude/skills/email-copilot python .claude/skills/email-copilot/scripts/email_cli.py filters delete <filter_id>.claude/skills/email-copilot/
├── SKILL.md # Skill instructions for Claude
├── README.md # This file
├── pyproject.toml # Python dependencies (for uv)
├── gmail_client.py # Gmail client & account manager
├── config.toml # Your configuration (gitignored)
├── config.toml.example # Configuration template
├── credentials.json # Google OAuth credentials (gitignored)
├── rules.md # Your email rules (gitignored)
├── rules.md.example # Rules template
├── tokens/ # OAuth tokens (gitignored)
│ └── *.json
└── scripts/
└── email_cli.py # CLI tool
Make sure credentials.json is in the skill directory (.claude/skills/email-copilot/).
Run authentication first:
uv run --project .claude/skills/email-copilot python .claude/skills/email-copilot/gmail_client.py --auth <account_name>Delete the token file and re-authenticate:
rm .claude/skills/email-copilot/tokens/<account>.json
uv run --project .claude/skills/email-copilot python .claude/skills/email-copilot/gmail_client.py --auth <account>For personal Gmail accounts, make sure:
- Your email is added as a "Test user" in Google Cloud Console
- The OAuth consent screen is configured correctly
MIT