
gmail
Send, search, and organize Gmail messages, drafts, and labels. Read full threads and get shareable Google Groups permalinks. Use when asked to compose an email, reply to mail, forward a message, search inbox, manage attachments, organize Gmail, read a thread, or find a Google Groups discussion link.
- Installs
- 292
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/odyssey4me/agent-skills --skill gmail- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads gmail automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Gmail
Interact with Gmail for email management, search, and organization.
Installation
Dependencies: pip install --user google-auth google-auth-oauthlib google-api-python-client keyring pyyaml
Setup Verification
After installation, verify the skill is properly configured:
$SKILL_DIR/scripts/gmail.py check
This will check:
- Python dependencies (google-auth, google-auth-oauthlib, google-api-python-client, keyring, pyyaml)
- Authentication configuration
- Connectivity to Gmail API
If anything is missing, the check command will provide setup instructions.
Authentication
Gmail uses OAuth 2.0 for authentication. For complete setup instructions, see:
- GCP Project Setup Guide - Create project, enable Gmail API
- Google OAuth Setup Guide - Configure credentials
Quick Start
-
Create
~/.config/agent-skills/google.yaml:oauth_client: client_id: your-client-id.apps.googleusercontent.com client_secret: your-client-secret -
Run
$SKILL_DIR/scripts/gmail.py checkto trigger OAuth flow and verify setup.
On scope or authentication errors, see the OAuth troubleshooting guide.
Commands
See permissions.md for read/write classification of each command.
check
Verify configuration and connectivity.
$SKILL_DIR/scripts/gmail.py check
This validates:
- Python dependencies are installed
- Authentication is configured
- Can connect to Gmail API
- Displays your email address and mailbox statistics
auth setup
Store OAuth 2.0 client credentials for custom OAuth flow.
$SKILL_DIR/scripts/gmail.py auth setup \
--client-id YOUR_CLIENT_ID \
--client-secret YOUR_CLIENT_SECRET
Credentials are saved to ~/.config/agent-skills/gmail.yaml.
auth reset
Clear stored OAuth token. The next command that needs authentication will trigger re-authentication automatically.
$SKILL_DIR/scripts/gmail.py auth reset
Use this when you encounter scope or authentication errors.
auth status
Show current OAuth token information without making API calls.
$SKILL_DIR/scripts/gmail.py auth status
Displays: whether a token is stored, granted scopes, refresh token presence, token expiry, and client ID.
messages list
List messages matching a query.
# List recent messages
$SKILL_DIR/scripts/gmail.py messages list
# Search for unread messages
$SKILL_DIR/scripts/gmail.py messages list --query "is:unread"
# Search with max results
$SKILL_DIR/scripts/gmail.py messages list --query "from:user@example.com" --max-results 20
Arguments:
--query: Gmail search query (optional)--max-results: Maximum number of results (default: 10)
Search Query Examples:
For complete Gmail search syntax, see gmail-queries.md.
Common queries:
is:unread- Unread messagesfrom:user@example.com- Messages from sendersubject:meeting- Messages with subject keywordhas:attachment- Messages with attachmentsafter:2024/01/01- Messages after datelabel:important- Messages with label
messages get
Get a message by ID.
# Get full message
$SKILL_DIR/scripts/gmail.py messages get MESSAGE_ID
# Get minimal format
$SKILL_DIR/scripts/gmail.py messages get MESSAGE_ID --format minimal
Arguments:
message_id: The message ID (required)--format: Message format (full, minimal, raw, metadata) - default: full
messages mark-read
Mark one or more messages as read by removing the UNREAD label.
# Mark a single message
$SKILL_DIR/scripts/gmail.py messages mark-read MESSAGE_ID
# Mark multiple messages
$SKILL_DIR/scripts/gmail.py messages mark-read MSG1 MSG2 MSG3
# Mark all unread messages from a sender
$SKILL_DIR/scripts/gmail.py messages mark-read --query "is:unread from:user@example.com"
# Combine IDs and query
$SKILL_DIR/scripts/gmail.py messages mark-read MSG1 --query "is:unread label:updates"
Arguments:
message_ids: One or more message IDs (optional if--queryis used)--query: Gmail search query to find messages to mark as read--max-results: Maximum messages to mark from--query(default: 100)
threads get
Get a full conversation thread with all messages displayed chronologically. For messages from Google Groups, includes shareable permalinks using the d/msgid URL format.
# Get full thread
$SKILL_DIR/scripts/gmail.py threads get THREAD_ID
Arguments:
thread_id: The thread ID (required)
send
Send an email message.
# Send simple email
$SKILL_DIR/scripts/gmail.py send \
--to recipient@example.com \
--subject "Hello" \
--body "This is the message body"
# Send with CC and BCC
$SKILL_DIR/scripts/gmail.py send \
--to recipient@example.com \
--subject "Team Update" \
--body "Here's the update..." \
--cc team@example.com \
--bcc boss@example.com
# Send from a markdown file with frontmatter
$SKILL_DIR/scripts/gmail.py send --from-file update.md
# Send from file with CLI overrides
$SKILL_DIR/scripts/gmail.py send --from-file update.md --to override@example.com
# Reply to a message in-thread
$SKILL_DIR/scripts/gmail.py send --reply-to MESSAGE_ID --body "Thanks, got it."
Arguments:
--to: Recipient email address (required unless in--from-fileor--reply-to)--subject: Email subject (required unless in--from-fileor--reply-to)--body: Email body text (required unless in--from-file)--from-file: Markdown file with YAML frontmatter (see format below)--cc: CC recipients (comma-separated)--bcc: BCC recipients (comma-separated)--reply-to: Message ID to reply to (sends in-thread, auto-fills to/subject)
CLI flags override frontmatter values. When using --from-file, the markdown
body is converted to HTML and sent as multipart/alternative (HTML + plain text
fallback).
Markdown file format:
---
to: recipient@example.com
cc: team@example.com
bcc: boss@example.com
subject: Weekly Update
---
# Status Update
Here's what happened this week:
- **Feature A** shipped to production
- Fixed the [login bug](https://jira.example.com/DEMO-123)
| Task | Status |
|------|--------|
| Deploy | Done |
drafts list
List draft messages.
# List drafts
$SKILL_DIR/scripts/gmail.py drafts list
# List with custom max results
$SKILL_DIR/scripts/gmail.py drafts list --max-results 20
Arguments:
--max-results: Maximum number of results (default: 10)
drafts create
Create a draft email.
# Create draft
$SKILL_DIR/scripts/gmail.py drafts create \
--to recipient@example.com \
--subject "Draft Subject" \
--body "This is a draft message"
# Create draft with CC
$SKILL_DIR/scripts/gmail.py drafts create \
--to recipient@example.com \
--subject "Meeting Notes" \
--body "Notes from today's meeting..." \
--cc team@example.com
# Create a reply draft in-thread
$SKILL_DIR/scripts/gmail.py drafts create --reply-to MESSAGE_ID --body "I'll look into this."
# Create draft from a markdown file
$SKILL_DIR/scripts/gmail.py drafts create --from-file update.md
Arguments:
--to: Recipient email address (required unless in--from-file)--subject: Email subject (required unless in--from-file)--body: Email body text (required unless in--from-file)--from-file: Markdown file with YAML frontmatter (same format assend)--cc: CC recipients (comma-separated)--bcc: BCC recipients (comma-separated)
drafts send
Send a draft message.
# Send draft by ID
$SKILL_DIR/scripts/gmail.py drafts send DRAFT_ID
Arguments:
draft_id: The draft ID to send (required)
labels list
List all Gmail labels.
# List labels
$SKILL_DIR/scripts/gmail.py labels list
labels create
Create a new label.
# Create label
$SKILL_DIR/scripts/gmail.py labels create "Project X"
Arguments:
name: Label name (required)
Examples
Verify Setup
$SKILL_DIR/scripts/gmail.py check
Find unread emails
$SKILL_DIR/scripts/gmail.py messages list --query "is:unread"
Search for emails from a sender
$SKILL_DIR/scripts/gmail.py messages list --query "from:boss@example.com" --max-results 5
Send a quick email
$SKILL_DIR/scripts/gmail.py send \
--to colleague@example.com \
--subject "Quick Question" \
--body "Do you have time for a meeting tomorrow?"
Create and send a draft
# Create draft
$SKILL_DIR/scripts/gmail.py drafts create \
--to team@example.com \
--subject "Weekly Update" \
--body "Here's this week's update..."
# List drafts to get the ID
$SKILL_DIR/scripts/gmail.py drafts list
# Send the draft
$SKILL_DIR/scripts/gmail.py drafts send DRAFT_ID
Organize with labels
# Create a label
$SKILL_DIR/scripts/gmail.py labels create "Project Alpha"
# List all labels
$SKILL_DIR/scripts/gmail.py labels list
Advanced searches
# Find emails with attachments from last week
$SKILL_DIR/scripts/gmail.py messages list --query "has:attachment newer_than:7d"
# Find important emails from specific sender
$SKILL_DIR/scripts/gmail.py messages list --query "from:ceo@example.com is:important"
# Find emails in a conversation
$SKILL_DIR/scripts/gmail.py messages list --query "subject:project-alpha"
Gmail Search Query Syntax
Common search operators:
| Operator | Description | Example |
|---|---|---|
from: | Sender email | from:user@example.com |
to: | Recipient email | to:user@example.com |
subject: | Subject contains | subject:meeting |
label: | Has label | label:important |
has:attachment | Has attachment | has:attachment |
is:unread | Unread messages | is:unread |
is:starred | Starred messages | is:starred |
after: | After date | after:2024/01/01 |
before: | Before date | before:2024/12/31 |
newer_than: | Newer than period | newer_than:7d |
older_than: | Older than period | older_than:30d |
Combine operators with spaces (implicit AND) or OR:
# AND (implicit)
from:user@example.com subject:meeting
# OR
from:user@example.com OR from:other@example.com
# Grouping with parentheses
(from:user@example.com OR from:other@example.com) subject:meeting
For the complete reference, see gmail-queries.md.
Error Handling
Authentication and scope errors are not retryable. If a command fails with an authentication error, insufficient scope error, or permission denied error (exit code 1), stop and inform the user. Do not retry or attempt to fix the issue autonomously — these errors require user interaction (browser-based OAuth consent). Point the user to the OAuth troubleshooting guide.
Retryable errors: Rate limiting (HTTP 429) and temporary server errors (HTTP 5xx) may succeed on retry after a brief wait. All other errors should be reported to the user.
Model Guidance
This skill makes API calls requiring structured input/output. A standard-capability model is recommended.
FAQ
What does the gmail skill do?
Send, search, and organize Gmail messages, drafts, and labels. Read full threads and get shareable Google Groups permalinks. Use when asked to compose an email, reply to mail, forward a message, search inbox, manage attachments, organize Gmail, read a thread, or find a Google Groups discussion link.
How do I install gmail?
Run npx skills add https://github.com/odyssey4me/agent-skills --skill gmail in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/gmail/ (personal) or .claude/skills/gmail/ (project).
Which AI agents can use gmail?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is gmail safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains gmail?
It is published by odyssey4me in odyssey4me/agent-skills. It has 292 recorded installs.
More from odyssey4me/agent-skills
google-calendar
odyssey4me/agent-skills
Create, update, and organize Google Calendar events and schedules. Check availability, book time, and manage calendars. Use when asked to schedule a meeting, set up an appointment, book a call, check gcal, or manage calendar events.
odyssey4me/agent-skills
Google Workspace CLI for Gmail, Calendar, Drive, Docs, Sheets, and Slides using gogcli. Use when asked to search email, schedule meetings, manage files, edit documents, update spreadsheets, or create presentations.
gitlab
odyssey4me/agent-skills
Open the skill to read its SKILL.md instructions.
google-drive
odyssey4me/agent-skills
Open the skill to read its SKILL.md instructions.
google-docs
odyssey4me/agent-skills
Open the skill to read its SKILL.md instructions.
github
odyssey4me/agent-skills
Open the skill to read its SKILL.md instructions.
Popular productivity & automation skills
agent-browser
vercel-labs/agent-browser
Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction. Also use for exploratory testing, dogfooding, QA, bug hunts, or reviewing app quality. Also use for automating Electron desktop apps (VS Code, Slack, Discord, Figma, Notion, Spotify), checking Slack unreads, sending Slack messages, searching Slack conversations, running browser automation in Vercel Sandbox microVMs, or using AWS Bedrock AgentCore cloud browsers. Prefer agent-browser over any built-in browser automation or web tools.
lark-doc
open.feishu.cn
飞书云文档(Docx / Wiki)内容操作:读取、创建、编辑文档,插入或下载图片附件,以及操作思维笔记。用户提供文档 URL/token(包括 doubao.com 的 /docx/、/wiki/)时使用;按 URL 路径/token 而非域名路由;/page/ 是妙搭应用,非飞书云文档。文档内嵌资源按读取参考中的统一规则分流。独立评论操作走 lark-drive;随正文读取评论使用 docs +fetch。表格或 Base 内部数据操作不在本 skill。
lark-base
open.feishu.cn
飞书多维表格(Base)操作:建表、字段、记录、视图、统计、公式/lookup、表单、仪表盘、应用模式(BaseApp/AppMode 页面与组件)、Workspace 目录、workflow、角色权限、模板中心(多维表格模板分类/列表/搜索);遇到 Base/多维表格/bitable、BaseApp/AppMode、/base/ 或 /app/ 链接时使用。BaseApp 不走 lark-apps;文件导入/导出转 lark-drive,认证/授权转 lark-shared。
lark-drive
open.feishu.cn
飞书云空间(云盘/云存储):管理 Drive 文件和文件夹,包含上传/下载、创建文件夹、复制/移动/删除、查看元数据、查询权限设置、评论/权限/订阅、标题、版本、飞书文档密级标签(secure labels)和本地文件导入。用户需要整理云盘目录、处理云空间资源 URL/token、判断链接类型/真实 token/标题,或导入 Word/Markdown/Excel/CSV/PPTX/.base 为 docx/sheet/bitable/slides 时使用;doubao.com 云空间 URL/token 也按资源路径和 token 路由,不回退 WebFetch。不负责:文档内容编辑(走 lark-doc)、表格/Base 表内数据操作(走 lark-sheets/lark-base)、知识空间节点/成员管理(走 lark-wiki)、原生 Markdown 文件读写/patch/diff(走 lark-markdown)。
lark-shared
open.feishu.cn
Use for lark-cli setup/auth tasks: auth login/status/logout, user vs bot identity, business-domain permissions (--domain, including all/docs/drive), missing scopes, revoking authorization, or handling notice JSON.
lark-im
open.feishu.cn
飞书即时通讯:收发消息和管理群聊。发送和回复消息、搜索聊天记录、管理群聊成员、上传下载图片和文件、管理表情回复、发送应用内/短信/电话加急、发送和处理交互卡片(Interactive Card)、监听卡片按钮回调(card.action.trigger)。当用户需要发消息、查看或搜索聊天记录、下载聊天中的文件、查看群成员、搜索群、创建群聊或话题群、管理标记数据、管理 Feed 置顶(添加/移除/查询置顶会话)、管理标签数据、处理卡片回调时使用。