Interact with your Gmail account to manage threads, labels, and emails through automated scripts.

Install

mkdir -p .claude/skills/gmail-manager && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/79" && unzip -o skill.zip -d .claude/skills/gmail-manager && rm skill.zip

Installs to .claude/skills/gmail-manager

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Manage Gmail - send, read, search emails, manage labels and drafts. Use when user wants to interact with their Gmail account for email operations.
146 chars · catalog description✓ has a “when” trigger
Intermediate

Key capabilities

  • Send emails with HTML, CC, BCC, and custom headers
  • Search emails using Gmail query syntax
  • Read message content and thread details
  • Manage labels by listing, creating, adding, or removing them
  • Create, update, send, and delete email drafts

How it works

The skill provides a set of Node.js scripts that interact with the Gmail API and output results in JSON format. Users can chain these scripts using standard shell tools like jq to perform complex email workflows.

Inputs & outputs

You give it
CLI command with flags like --to, --subject, or --query
You get back
JSON object containing operation status and requested data

When to use gmail-manager

  • Search inbox for specific threads
  • Send automated email updates
  • List unread emails
  • Draft and manage email communication

About this skill

Gmail Skill - Detailed Usage Guide

Token-efficient Gmail management through CLI scripts for Claude Code.

Quick Start

All scripts are in the scripts/ directory and output JSON.

gmail-send.js - Send Emails

Send emails with support for HTML, CC/BCC, and custom headers.

Basic Usage

node gmail-send.js --to "[email protected]" --subject "Hello" --body "Message body"

Advanced Options

node gmail-send.js \
  --to "[email protected]" \
  --cc "[email protected]" \
  --bcc "[email protected]" \
  --subject "Project Update" \
  --body "The project is complete." \
  --reply-to "[email protected]"

HTML Email

node gmail-send.js \
  --to "[email protected]" \
  --subject "Newsletter" \
  --html "<h1>Welcome</h1><p>This is HTML content</p>"

Output

{
  "success": true,
  "messageId": "18d1234567890",
  "threadId": "18d1234567890",
  "to": "[email protected]",
  "subject": "Hello"
}

gmail-search.js - Search Emails

Search emails using Gmail's powerful query syntax.

Basic Search

node gmail-search.js --query "is:unread" --limit 10

Search Operators

# From specific sender
node gmail-search.js --query "from:[email protected]"

# Emails with attachments
node gmail-search.js --query "has:attachment"

# Date range
node gmail-search.js --query "after:2024/01/01 before:2024/12/31"

# Subject search
node gmail-search.js --query "subject:invoice"

# Combine operators
node gmail-search.js --query "from:[email protected] has:attachment is:unread"

# Complex search
node gmail-search.js --query "is:important OR is:starred" --limit 20

Output

{
  "success": true,
  "count": 3,
  "total": 150,
  "query": "is:unread",
  "messages": [
    {
      "id": "18d1234567890",
      "threadId": "18d1234567890",
      "from": "[email protected]",
      "to": "[email protected]",
      "subject": "Project Update",
      "date": "Mon, 15 Jan 2024 10:30:00 -0800",
      "snippet": "The project is progressing well...",
      "labels": ["INBOX", "UNREAD"]
    }
  ]
}

gmail-read.js - Read Messages

Read full message content and thread details.

Read Single Message

node gmail-read.js --id "18d1234567890"

Read Message with Thread Context

node gmail-read.js --id "18d1234567890" --thread

Output

{
  "success": true,
  "id": "18d1234567890",
  "threadId": "18d1234567890",
  "from": "[email protected]",
  "to": "[email protected]",
  "subject": "Project Update",
  "date": "Mon, 15 Jan 2024 10:30:00 -0800",
  "labels": ["INBOX", "UNREAD"],
  "snippet": "The project is progressing well...",
  "body": "Full email body content here..."
}

gmail-labels.js - Manage Labels

List, create, add, and remove labels.

List All Labels

node gmail-labels.js --action list

Create New Label

node gmail-labels.js --action create --name "Project Alpha"

Add Label to Message

# Using label name
node gmail-labels.js --action add --id "18d1234567890" --label "Important"

# Using label ID
node gmail-labels.js --action add --id "18d1234567890" --label "Label_123"

Remove Label from Message

node gmail-labels.js --action remove --id "18d1234567890" --label "Important"

Output (list)

{
  "success": true,
  "action": "list",
  "count": 15,
  "labels": [
    {
      "id": "INBOX",
      "name": "INBOX",
      "type": "system"
    },
    {
      "id": "Label_123",
      "name": "Project Alpha",
      "type": "user"
    }
  ]
}

gmail-drafts.js - Manage Drafts

Create, update, send, and delete draft emails.

List Drafts

node gmail-drafts.js --action list --limit 10

Create Draft

node gmail-drafts.js \
  --action create \
  --to "[email protected]" \
  --subject "Draft Subject" \
  --body "Draft body text"

Update Draft

node gmail-drafts.js \
  --action update \
  --id "r-1234567890" \
  --to "[email protected]" \
  --subject "Updated Subject" \
  --body "Updated body text"

Send Draft

node gmail-drafts.js --action send --id "r-1234567890"

Delete Draft

node gmail-drafts.js --action delete --id "r-1234567890"

Output (create)

{
  "success": true,
  "action": "create",
  "draftId": "r-1234567890",
  "to": "[email protected]",
  "subject": "Draft Subject"
}

Common Workflows

1. Find and Reply to Unread Emails

# Search for unread emails
node gmail-search.js --query "is:unread" --limit 5 > /tmp/unread.json

# Read first message
MESSAGE_ID=$(cat /tmp/unread.json | jq -r '.messages[0].id')
node gmail-read.js --id "$MESSAGE_ID" > /tmp/message.json

# Send reply
SENDER=$(cat /tmp/message.json | jq -r '.from')
SUBJECT=$(cat /tmp/message.json | jq -r '.subject')
node gmail-send.js --to "$SENDER" --subject "Re: $SUBJECT" --body "Thanks for your message!"

2. Organize Emails by Label

# Search for project-related emails
node gmail-search.js --query "subject:project alpha" > /tmp/results.json

# Create label
node gmail-labels.js --action create --name "Project Alpha"

# Add label to each message
cat /tmp/results.json | jq -r '.messages[].id' | while read id; do
  node gmail-labels.js --action add --id "$id" --label "Project Alpha"
done

3. Draft Review Workflow

# Create draft
node gmail-drafts.js --action create \
  --to "[email protected]" \
  --subject "Proposal" \
  --body "Initial draft text" > /tmp/draft.json

DRAFT_ID=$(cat /tmp/draft.json | jq -r '.draftId')

# Update after review
node gmail-drafts.js --action update \
  --id "$DRAFT_ID" \
  --to "[email protected]" \
  --subject "Proposal - Final" \
  --body "Revised draft text"

# Send when ready
node gmail-drafts.js --action send --id "$DRAFT_ID"

Gmail Search Operators Reference

OperatorExampleDescription
from:from:[email protected]Emails from sender
to:to:[email protected]Emails to recipient
subject:subject:invoiceSubject contains word
has:attachmenthas:attachmentHas any attachment
filename:filename:pdfAttachment filename
is:unreadis:unreadUnread emails
is:readis:readRead emails
is:starredis:starredStarred emails
is:importantis:importantImportant emails
label:label:workHas specific label
after:after:2024/01/01After date
before:before:2024/12/31Before date
older_than:older_than:7dOlder than (d/m/y)
newer_than:newer_than:2dNewer than (d/m/y)

Error Handling

All scripts return JSON error objects:

{
  "success": false,
  "error": "Token not found. Run: npm run setup"
}

Common errors:

  • Token not found: Run npm run setup to authenticate
  • Invalid credentials: Check scripts/auth/credentials.json
  • Permission denied: Ensure Gmail API scope is granted
  • Message not found: Invalid message/draft ID

Tips for Claude

  1. Parse JSON efficiently: Use jq for extracting specific fields
  2. Chain operations: Save intermediate results to /tmp/ files
  3. Validate IDs: Check that message/draft IDs exist before operations
  4. User-friendly output: Convert JSON to readable summaries for users
  5. Error handling: Check success field and handle errors gracefully

When not to use it

  • When the user has not authenticated via the setup script
  • When the required Gmail API scopes are not granted

Prerequisites

Run npm run setup for authenticationValid credentials in scripts/auth/credentials.json

Limitations

  • Requires manual parsing of JSON output for complex logic
  • Limited by Gmail API rate limits and permissions

How it compares

Unlike manual web interface usage, this skill enables programmatic email management and automation through CLI commands.

Compared to similar skills

gmail-manager side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
gmail-manager (this skill)273moReviewIntermediate
klaviyo14moReviewIntermediate
word269moReviewBeginner
clawhub252moReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry