skills/gmail/SKILL.md
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.
npx skillsauth add odyssey4me/agent-skills gmailInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Interact with Gmail for email management, search, and organization.
Dependencies: pip install --user google-auth google-auth-oauthlib google-api-python-client keyring pyyaml
After installation, verify the skill is properly configured:
$SKILL_DIR/scripts/gmail.py check
This will check:
If anything is missing, the check command will provide setup instructions.
Gmail uses OAuth 2.0 for authentication. For complete setup instructions, see:
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 check to trigger OAuth flow and verify setup.
On scope or authentication errors, see the OAuth troubleshooting guide.
See permissions.md for read/write classification of each command.
Verify configuration and connectivity.
$SKILL_DIR/scripts/gmail.py check
This validates:
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.
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.
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.
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:[email protected]" --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:[email protected] - Messages from sendersubject:meeting - Messages with subject keywordhas:attachment - Messages with attachmentsafter:2024/01/01 - Messages after datelabel:important - Messages with labelGet 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: fullMark 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:[email protected]"
# 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 --query is used)--query: Gmail search query to find messages to mark as read--max-results: Maximum messages to mark from --query (default: 100)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 an email message.
# Send simple email
$SKILL_DIR/scripts/gmail.py send \
--to [email protected] \
--subject "Hello" \
--body "This is the message body"
# Send with CC and BCC
$SKILL_DIR/scripts/gmail.py send \
--to [email protected] \
--subject "Team Update" \
--body "Here's the update..." \
--cc [email protected] \
--bcc [email protected]
# 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 [email protected]
# 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-file or --reply-to)--subject: Email subject (required unless in --from-file or --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: [email protected]
cc: [email protected]
bcc: [email protected]
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 |
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)Create a draft email.
# Create draft
$SKILL_DIR/scripts/gmail.py drafts create \
--to [email protected] \
--subject "Draft Subject" \
--body "This is a draft message"
# Create draft with CC
$SKILL_DIR/scripts/gmail.py drafts create \
--to [email protected] \
--subject "Meeting Notes" \
--body "Notes from today's meeting..." \
--cc [email protected]
# 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 as send)--cc: CC recipients (comma-separated)--bcc: BCC recipients (comma-separated)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)List all Gmail labels.
# List labels
$SKILL_DIR/scripts/gmail.py labels list
Create a new label.
# Create label
$SKILL_DIR/scripts/gmail.py labels create "Project X"
Arguments:
name: Label name (required)$SKILL_DIR/scripts/gmail.py check
$SKILL_DIR/scripts/gmail.py messages list --query "is:unread"
$SKILL_DIR/scripts/gmail.py messages list --query "from:[email protected]" --max-results 5
$SKILL_DIR/scripts/gmail.py send \
--to [email protected] \
--subject "Quick Question" \
--body "Do you have time for a meeting tomorrow?"
# Create draft
$SKILL_DIR/scripts/gmail.py drafts create \
--to [email protected] \
--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
# Create a label
$SKILL_DIR/scripts/gmail.py labels create "Project Alpha"
# List all labels
$SKILL_DIR/scripts/gmail.py labels list
# 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:[email protected] is:important"
# Find emails in a conversation
$SKILL_DIR/scripts/gmail.py messages list --query "subject:project-alpha"
Common search operators:
| Operator | Description | Example |
|----------|-------------|---------|
| from: | Sender email | from:[email protected] |
| to: | Recipient email | to:[email protected] |
| 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:[email protected] subject:meeting
# OR
from:[email protected] OR from:[email protected]
# Grouping with parentheses
(from:[email protected] OR from:[email protected]) subject:meeting
For the complete reference, see gmail-queries.md.
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.
This skill makes API calls requiring structured input/output. A standard-capability model is recommended.
development
Create and modify Google Docs documents. Read content, insert tables, apply heading styles, and manage formatting. Use when asked to edit a gdoc, write a Google document, update a doc, or format document content.
development
Upload, download, search, and share files on Google Drive. Create folders, manage permissions, and manage comments and replies. Use when asked to share a file, upload to gdrive, search cloud storage, manage a Drive folder, organize Google Drive files, comment on a file, or reply to comments.
testing
Search and manage Jira issues using JQL queries, create/update tickets, and manage workflows. Use when asked to find Jira tickets, check the backlog, manage sprints, track bugs, or work with Atlassian project management.
development
Create and edit Google Slides presentations. Add or delete slides, insert text, shapes, and images. Use when asked to build a deck, create a slideshow, update a Google presentation, or edit slides.