SkillsGrove
SkillsGrove/Productivity/jholhewres/devclaw-skills/gmail

gmail

Installation

$npx skills add https://github.com/jholhewres/devclaw-skills --skill gmail
$git clone --depth 1 https://github.com/jholhewres/devclaw-skills.git /tmp/devclaw-skills && mkdir -p ~/.claude/skills && cp -r /tmp/devclaw-skills/skills/gmail ~/.claude/skills/gmail
Please install this Agent Skill for me: https://github.com/jholhewres/devclaw-skills/tree/0177c36eb6dcdfe3f891fd332ef538a3d84cc693/skills/gmail — read its SKILL.md and scripts first, and only install it into my skills folder once you have confirmed it is safe.

Summary

Original description · MITGmail API — read, send, and manage emails via Gmail
The SKILL.md below is reproduced from jholhewres/devclaw-skills (commit 0177c36) under the MIT license. The text is unchanged; only the file header metadata is omitted, images are shown as links, and very long files are truncated. Copyright 2026 DevClaw. License: LICENSE. Only the instructions file is shown; see the original repository for any scripts.

Gmail

Interact with Gmail using the Gmail API.

Setup

  1. Check existing credentials:

    vault_get gmail_access_token
    
  2. If not configured:

    • Go to Google Cloud Console: https://console.cloud.google.com
    • Create project, enable Gmail API
    • Configure OAuth 2.0 consent screen
    • Create OAuth credentials (Desktop app)
    • Get access token via OAuth flow
    • Save to vault:
      vault_save gmail_access_token "ya29.a0..."
      

    The token is auto-injected as $GMAIL_ACCESS_TOKEN. Note: Access tokens expire after ~1 hour; refresh and re-save when needed.

List Messages

# List recent emails
curl -s "https://gmail.googleapis.com/gmail/v1/users/me/messages?maxResults=10" \
  -H "Authorization: Bearer $GMAIL_ACCESS_TOKEN" | jq '.messages'

# Search emails
curl -s "https://gmail.googleapis.com/gmail/v1/users/me/messages?q=is:unread+from:boss@company.com" \
  -H "Authorization: Bearer $GMAIL_ACCESS_TOKEN" | jq '.messages'

# Common search queries:
# is:unread, is:starred, has:attachment, larger:5M
# from:email@example.com, to:me, subject:urgent
# newer_than:7d, older_than:1m

Read Message

# Get message details
curl -s "https://gmail.googleapis.com/gmail/v1/users/me/messages/MESSAGE_ID?format=full" \
  -H "Authorization: Bearer $GMAIL_ACCESS_TOKEN" | jq '{
    id, snippet,
    from: (.payload.headers[] | select(.name == "From") | .value),
    subject: (.payload.headers[] | select(.name == "Subject") | .value),
    date: (.payload.headers[] | select(.name == "Date") | .value)
  }'

# Get raw message (including body)
curl -s "https://gmail.googleapis.com/gmail/v1/users/me/messages/MESSAGE_ID?format=raw" \
  -H "Authorization: Bearer $GMAIL_ACCESS_TOKEN" | jq -r '.raw' | base64 -d

Send Email

# Create raw email (RFC 2822 format)
RAW_EMAIL=$(cat <<EOF | base64 -w0
From: me@gmail.com
To: recipient@example.com
Subject: Test Email from DevClaw

This is the email body.
Can have multiple lines.
EOF
)

# Send
curl -s -X POST "https://gmail.googleapis.com/gmail/v1/users/me/messages/send" \
  -H "Authorization: Bearer $GMAIL_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d "{\"raw\": \"$RAW_EMAIL\"}"

Manage Labels

# List labels
curl -s "https://gmail.googleapis.com/gmail/v1/users/me/labels" \
  -H "Authorization: Bearer $GMAIL_ACCESS_TOKEN" | jq '.labels[]'

# Add label to message
curl -s -X POST "https://gmail.googleapis.com/gmail/v1/users/me/messages/MESSAGE_ID/modify" \
  -H "Authorization: Bearer $GMAIL_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"addLabelIds": ["Label_123"]}'

Mark as Read/Star

# Mark as read
curl -s -X POST "https://gmail.googleapis.com/gmail/v1/users/me/messages/MESSAGE_ID/modify" \
  -H "Authorization: Bearer $GMAIL_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"removeLabelIds": ["UNREAD"]}'

# Star email
curl -s -X POST "https://gmail.googleapis.com/gmail/v1/users/me/messages/MESSAGE_ID/modify" \
  -H "Authorization: Bearer $GMAIL_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"addLabelIds": ["STARRED"]}'

Tips

  • Access tokens expire after ~1 hour, refresh using refresh token
  • Use format=metadata for headers only (faster)
  • Max results per request: 500
  • Label IDs: INBOX, SENT, DRAFT, SPAM, TRASH, UNREAD, STARRED

Triggers

gmail, email, check email, send email, read gmail, inbox, gmail api

View full license text (MIT)
MIT License

Copyright (c) 2026 DevClaw

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.