ワンクリックで
gmail
CLI for Gmail via Google's REST API — list, search, read, send, draft, label, delete. Use for all Gmail email operations.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
CLI for Gmail via Google's REST API — list, search, read, send, draft, label, delete. Use for all Gmail email operations.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
GitHub CLI (gh) — the official command-line interface to GitHub. Use when the user needs to create or manage pull requests, issues, repositories, GitHub Actions, gists, API calls, authentication, or any other GitHub workflow from the terminal. Also use for scripting GitHub automation, querying the GraphQL/REST API, managing forks/clones, and viewing workflow run logs. Prefer gh over web browsing or the raw REST API.
Draft, post, and review Dan's LinkedIn posts (handle saattrupdan) via the `linkedin` CLI, which drives the real LinkedIn web UI with agent-browser. Use when the user wants to write/post a LinkedIn post, save or view a draft, or fetch their recent posts with engagement stats. Also use whenever drafting LinkedIn content, to match Dan's voice and formatting.
Edit Microsoft Excel .xlsx files in place while preserving all formatting — surgical raw-OOXML cell editing that keeps styles, charts, data validations, formulas and named ranges intact. Use when filling in or revising .xlsx workbooks (bid sheets, budgets, forms, trackers) rather than regenerating them.
Edit Microsoft Word .docx files in place while preserving all formatting — surgical raw-OOXML editing, Word comments, page breaks, character-limit fields. Use when filling in or revising .docx documents (grant applications, forms, reports) rather than regenerating them.
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.
Search Danish citizen / public-service portals via the `citizen` CLI — Q&A search across borger.dk (national), nyidanmark.dk (immigration) and frederiksberg.dk (municipal), plus factual pages for any of the 98 municipalities (kommune.dk). Merges borger-dk, frederiksberg-dk, kk-dk, kommune-dk and nyidanmark-dk. Use to find official Danish citizen-service info.
| name | gmail |
| description | CLI for Gmail via Google's REST API — list, search, read, send, draft, label, delete. Use for all Gmail email operations. |
| last-updated | "2026-07-04T00:00:00.000Z" |
Read and send email through the gmail CLI for Gmail via Google's REST API.
All interaction goes through the gmail CLI. Authentication is via OAuth 2.0,
stored securely in ~/.gmail/token.json.
The Gmail CLI uses the Google Gmail REST API directly — no browser automation, no IMAP/SMTP. This is more robust and reliable than browser-based approaches.
Config lives in ~/.gmail/. The OAuth token is refreshed automatically.
Verify the CLI is available:
which gmail
If missing, install it editable with uv:
cd /Users/dansmart/gitsky/dotfiles/agentic/skills/gmail
uv pip install -e .
Create a Google Cloud project:
Enable the Gmail API:
Configure OAuth consent screen:
Create OAuth credentials:
~/.gmail/credentials.jsonLogin:
gmail login
This opens a browser window for OAuth consent. Select your Google account,
grant permissions, and you'll be redirected to a success page. The token is
saved to ~/.gmail/token.json (chmod 600).
If you get a 403 error: Make sure you completed step 2 (enable Gmail API) and step 3 (OAuth consent screen). The consent screen must be saved before credentials work.
Optional — store refresh token in Keychain:
security add-generic-password -s 'gmail' -a 'your-email@gmail.com' -w '<refresh-token>'
The OAuth token is automatically refreshed. If it expires, re-run gmail login.
# List messages (newest first) — table format
gmail list
gmail list --limit 20
gmail list --unread
gmail list --starred
gmail list --label INBOX
gmail list --label SENT
# Search with Gmail query syntax
gmail list --query "from:boss@company.com"
gmail list --query "subject:invoice"
gmail list --query "has:attachment"
gmail list --query "after:2026-01-01 before:2026-07-04"
# Read a specific message (use ID from list)
gmail read <message-id>
gmail read --raw <message-id> # JSON output
Gmail query syntax:
from:name@example.com — senderto:name@example.com — recipientsubject:keyword — subject lineis:unread, is:starred, is:importanthas:attachment, has:driveafter:YYYY/MM/DD, before:YYYY/MM/DDlabel:label-name — custom labelsProcess unread emails one at a time:
# Fetch unread messages
gmail list --unread --limit 1
# Read the message
gmail read <message-id>
# Mark as read (if needed — reading doesn't auto-mark)
gmail label --remove UNREAD --message-id <id>
gmail send --to alice@example.com --subject "Hi" --body "Quick note"
gmail send --to a@x.com --subject "Report" --body-file ./report.txt --cc boss@x.com
echo "body from stdin" | gmail send --to a@x.com --subject Hi --body-file - --confirm
--to takes a single email (Gmail API limitation for simple send)--cc for carbon copy--body or --body-file (- reads stdin)y/N) unless --confirmAlways show the draft to the user and get explicit approval before sending.
# Create a draft
gmail draft --to alice@example.com --subject "Hi" --body "Draft message"
gmail draft --to a@x.com --subject "Report" --body-file ./draft.txt
# List drafts
gmail draft --list
gmail draft --list --limit 5
gmail draft --list --raw # JSON
# Show a specific draft
gmail draft --show <draft-id>
gmail draft --show <draft-id> --raw
# Delete a draft
gmail draft --delete <draft-id>
# Move to trash (can be recovered)
gmail delete <message-id> --trash
# Mark as spam
gmail delete <message-id> --spam
# Delete permanently (bypass trash)
gmail delete <message-id>
Gmail uses labels instead of folders. A message can have multiple labels.
# List all labels
gmail label --list
gmail label --list --raw
# Create a new label
gmail label --create "Projects/Client-X"
# Add label to message
gmail label --add LABEL_ID --message-id <id>
# Remove label from message
gmail label --remove LABEL_ID --message-id <id>
Built-in label IDs:
INBOX, SENT, DRAFT, SPAM, TRASHUNREAD, STARRED, IMPORTANTCustom labels get auto-generated IDs (use gmail label --list to find them).
Archive removes the INBOX label (message stays in "All Mail"):
# Archive is just removing INBOX label
gmail label --remove INBOX --message-id <id>
# Star a message
gmail label --add STARRED --message-id <id>
# Unstar a message
gmail label --remove STARRED --message-id <id>
Most commands support --raw for JSON output — useful for scripting:
gmail list --raw | jq '.[].id'
gmail read --raw <id> | jq '.payload.headers'
Not authenticated — run gmail logincredentials.json not found — download from Google Cloud ConsoleToken expired — automatic refresh; if that fails, re-run gmail loginGmail API error — network issue or API quota exceeded; retryIf gmail login shows a 403 error in the redirect URL, check these:
Gmail API not enabled: Go to APIs & Services → Library → search "Gmail API" → click Enable. Wait 1-2 minutes after enabling.
OAuth consent screen incomplete: Go to APIs & Services → OAuth consent screen. Make sure you clicked Save and Continue through all sections (App info, Scopes, Test users). The status will show as "Testing" — that's fine for personal use.
Add yourself as a test user (if consent screen is in "Testing" mode):
gmail login againWrong project selected: Make sure you're in the correct project when enabling
the API (check the project dropdown at the top matches gmail-cli-501412).
Billing not required: The Gmail API is free for reasonable usage — you do NOT need to enable billing for basic send/read operations.
~/.gmail/token.json is chmod 600 — never commit it.credentials.json (OAuth client secret) should also be kept private.Gmail uses labels, not folders:
| Concept | Folders (IMAP/OWA) | Gmail Labels |
|---|---|---|
| Organization | One folder per message | Multiple labels per message |
| "Move" | Copy then delete | Add/remove labels |
| Archive | Move to Archive folder | Remove INBOX label |
| Delete | Move to Trash | Remove all labels → auto-trash |
This means a message can be in "Inbox" AND "Projects" AND "Important" simultaneously.
--to (use BCC/CC workarounds or send multiple)threadId not exposed)These can be added in future versions if needed.