mcpField
G
google

google

github.com/ckorhonen生产力2244 次安装5 周前更新
代码仓库

关于 google

Google Personal Assistant 是基于 gog CLI 管理 Google Workspace 的技能,面向个人助理和幕僚长工作流。它覆盖邮件、日历、云端硬盘、任务、联系人和表格,并提供搜索筛选与流程示例。

主要功能

  1. 01搜索、整理和发送 Gmail 邮件
  2. 02管理日历、会议及可用时间
  3. 03搜索和下载 Google Drive 文件
  4. 04管理任务和联系人
  5. 05读取、更新 Sheets 并导出文件

适用场景

  1. 01筛选未读邮件并处理收件箱
  2. 02查找与会者空闲时间并安排会议
  3. 03按内容或属性查找云端硬盘文档
  4. 04维护任务清单并更新 Sheets

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/ckorhonen/claude-skills --skill google

安装后在 Claude Code 中输入/google确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

references/
calendar-scheduling.md
common-workflows.md
drive-search-syntax.md
gmail-search-syntax.md

详细介绍

Google 个人助理

通过 gog CLI 管理 Google Workspace 服务的综合技能。专为个人助理和幕僚长工作流设计,注重高效搜索、筛选和查询。

何时使用此技能

  • 分类并处理电子邮件收件箱
  • 安排会议并管理日历活动
  • 查找多个日历的空闲时间
  • 搜索并整理 Google Drive 文档
  • 管理任务列表和待办事项
  • 查找并管理联系人
  • 在 Google Sheets 中读取和写入数据
  • 导出 Docs、Slides 或 Sheets
  • 设置专注时间或外出状态

先决条件

确保已安装并完成身份验证的 gog:

# Check installation
gog version

# Check authentication status
gog auth status

# Verify account access
gog people me

# Add a new account if needed
gog auth add [email protected] --services=all

快速入门

Gmail
# Search unread emails
gog gmail search "is:unread" --max=20

# Search from specific sender
gog gmail search "from:[email protected] newer_than:7d"

# Send an email
gog gmail send --to="[email protected]" --subject="Subject" --body="Message body"

# Reply to a thread
gog gmail send --reply-to-message-id=MESSAGE_ID --body="Reply text"

# Get message details
gog gmail get MESSAGE_ID
Calendar
# View today's events
gog calendar events --today

# View this week
gog calendar events --week

# Create an event with Google Meet
gog calendar create primary \
  --summary="Team Sync" \
  --from="2026-01-15T14:00:00-08:00" \
  --to="2026-01-15T15:00:00-08:00" \
  --attendees="[email protected],[email protected]" \
  --with-meet

# Check availability
gog calendar freebusy "[email protected],[email protected]" \
  --from="2026-01-15T09:00:00Z" --to="2026-01-15T17:00:00Z"

# Find scheduling conflicts
gog calendar conflicts --week
Drive
# List files in root
gog drive ls

# Search for documents
gog drive search "quarterly report"

# Download a file
gog drive download FILE_ID

# Upload a file
gog drive upload /path/to/file.pdf --parent=FOLDER_ID

# Get shareable URL
gog drive url FILE_ID
Tasks
# List task lists
gog tasks lists list

# View tasks in default list
gog tasks list @default

# Add a task
gog tasks add @default --title="Review report" --due="2026-01-15"

# Mark task complete
gog tasks done @default TASK_ID
Sheets
# Read a range
gog sheets get SPREADSHEET_ID "Sheet1!A1:D10"

# Update values
gog sheets update SPREADSHEET_ID "Sheet1!A1" "Value1" "Value2"

# Append a row
gog sheets append SPREADSHEET_ID "Sheet1!A:D" "Col1" "Col2" "Col3" "Col4"

Gmail 搜索语法

Gmail 搜索功能强大。以下是常用运算符:

发件人和收件人
运算符示例描述
from:from:[email protected]来自发件人的邮件
to:to:[email protected]发送给收件人的邮件
cc:cc:[email protected]抄送的收件人
bcc:bcc:[email protected]密送的收件人
状态和标签
运算符示例描述
is:unreadis:unread未读邮件
is:readis:read已读邮件
is:starredis:starred已加星标的邮件
is:importantis:important标记为重要的邮件
is:snoozedis:snoozed已延后处理的邮件
label:label:work带有指定标签
in:inboxin:inbox位于收件箱
in:sentin:sent位于已发送邮件
in:draftsin:drafts位于草稿
in:trashin:trash位于垃圾箱
in:spamin:spam位于垃圾邮件
in:anywherein:anywhere所有邮件,包括垃圾邮件和垃圾箱中的邮件
内容和主题
运算符示例描述
subject:subject:urgent主题包含指定词语
"exact phrase""quarterly report"精确短语匹配
has:attachmenthas:attachment带有附件
filename:filename:pdf附件文件名/类型
filename:filename:report.xlsx指定文件名
日期和时间
运算符示例描述
newer_than:newer_than:7d最近 N 天内
older_than:older_than:1y早于 N 年
after:after:2026/01/01指定日期之后
before:before:2026/12/31指定日期之前

newer_than/older_than 的单位:d(天)、m(月)、y(年)

大小
运算符示例描述
larger:larger:5M大于指定大小
smaller:smaller:100K小于指定大小

单位:K(KB)、M(MB)

类别
运算符示例描述
category:primarycategory:primary主要收件箱
category:socialcategory:social社交类别
category:promotionscategory:promotions推广邮件
category:updatescategory:updates更新
category:forumscategory:forums论坛
布尔运算符
运算符示例描述
AND(或空格)from:alice subject:report同时满足两个条件
ORfrom:alice OR from:bob满足任一条件
-(NOT)-category:promotions排除指定条件
()(from:alice OR from:bob) is:unread分组
{}{from:alice from:bob}OR 简写
查询示例
# Unread from VIPs this week
gog gmail search "is:unread from:([email protected] OR [email protected]) newer_than:7d"

# Large attachments
gog gmail search "has:attachment larger:10M"

# Urgent subjects excluding promotions
gog gmail search "subject:(urgent OR asap OR EOD) -category:promotions is:unread"

# Contracts from legal team
gog gmail search "from:[email protected] subject:contract has:attachment filename:pdf"

# All messages in a thread (use thread ID from search results)
gog gmail thread get THREAD_ID

完整的运算符参考请参阅 references/gmail-search-syntax.md。

Drive 搜索语法

Drive 搜索使用查询语言来精确查找文件:

基本运算符
运算符示例描述
name containsname contains 'report'文件名包含
fullText containsfullText contains 'budget'搜索内容
mimeType =mimeType = 'application/pdf'文件类型
日期筛选条件
运算符示例描述
modifiedTime >modifiedTime > '2026-01-01'修改时间晚于
modifiedTime <modifiedTime < '2026-01-01'修改时间早于
createdTime >createdTime > '2026-01-01'创建时间晚于
viewedByMeTime >viewedByMeTime > '2026-01-01'查看时间晚于
所有权与共享
运算符示例描述
'email' in owners'me' in owners由用户拥有
'email' in writers'[email protected]' in writers用户可以编辑
'email' in readers'[email protected]' in readers用户可以查看
sharedWithMesharedWithMe与你共享
属性
运算符示例描述
starredstarred已加星标的文件
trashed = falsetrashed = false不在回收站中
'folderId' in parents'FOLDER_ID' in parents位于指定文件夹中
常见 MIME 类型
类型MIME 类型
Google 文档application/vnd.google-apps.document
Google 表格application/vnd.google-apps.spreadsheet
Google 幻灯片application/vnd.google-apps.presentation
Google 表单application/vnd.google-apps.form
文件夹application/vnd.google-apps.folder
PDFapplication/pdf
Wordapplication/vnd.openxmlformats-officedocument.wordprocessingml.document
Excelapplication/vnd.openxmlformats-officedocument.spreadsheetml.sheet
布尔运算符
  • and - 两个条件都必须匹配
  • or - 任一条件匹配
  • not - 否定条件
查询示例
# Recent docs mentioning Q4
gog drive search "fullText contains 'Q4' and modifiedTime > '2026-01-01'"

# All spreadsheets shared with me
gog drive search "sharedWithMe and mimeType = 'application/vnd.google-apps.spreadsheet'"

# PDFs I own
gog drive search "'me' in owners and mimeType = 'application/pdf'"

# Files modified this week
gog drive search "modifiedTime > '2026-01-03'"

# Documents in specific folder
gog drive ls --parent=FOLDER_ID

# Starred presentations
gog drive search "starred and mimeType = 'application/vnd.google-apps.presentation'"

完整的查询参考请参阅 references/drive-search-syntax.md。

PA/CoS 工作流

每日早间收件箱筛选
# 1. Check unread counts by label
gog gmail labels list --json | jq '.[] | select(.messagesUnread > 0) | {name, unread: .messagesUnread}'

# 2. Review unread from priority senders
gog gmail search "is:unread from:([email protected] OR [email protected])" --max=20

# 3. Check for urgent subjects
gog gmail search "is:unread subject:(urgent OR asap OR EOD OR \"action required\")" --max=10

# 4. Review threads needing response (excludes noise)
gog gmail search "is:unread in:inbox -category:updates -category:promotions -category:social" --max=30

# 5. Check for emails with attachments requiring action
gog gmail search "is:unread has:attachment newer_than:2d" --max=15
安排会议
# 1. Find availability for attendees
gog calendar freebusy "[email protected],[email protected]" \
  --from="2026-01-15T09:00:00-08:00" \
  --to="2026-01-15T17:00:00-08:00"

# 2. Check your own conflicts
gog calendar conflicts --days=7

# 3. Create the meeting
gog calendar create primary \
  --summary="Project Kickoff" \
  --from="2026-01-15T14:00:00-08:00" \
  --to="2026-01-15T15:00:00-08:00" \
  --attendees="[email protected],[email protected]" \
  --description="Agenda:\n1. Project overview\n2. Timeline review\n3. Action items" \
  --location="Conference Room A" \
  --with-meet \
  --reminder="popup:15m"

# 4. Send follow-up email with details
gog gmail send \
  --to="[email protected],[email protected]" \
  --subject="Meeting Scheduled: Project Kickoff - Jan 15 at 2pm" \
  --body="Hi team,

I've scheduled our project kickoff meeting for Wednesday, January 15th at 2:00 PM.

Location: Conference Room A (Google Meet link in calendar invite)

Agenda:
1. Project overview
2. Timeline review
3. Action items

Please let me know if you have any conflicts.

Best regards"
每周日历准备
# 1. View the week ahead
gog calendar events --week

# 2. Check all calendars for the week
gog calendar events --week --all

# 3. Find and resolve conflicts
gog calendar conflicts --week

# 4. Check team availability (for group)
gog calendar team [email protected] --week

# 5. Block focus time
gog calendar focus-time \
  --from="2026-01-16T09:00:00-08:00" \
  --to="2026-01-16T12:00:00-08:00"

# 6. Set out of office (if needed)
gog calendar out-of-office \
  --from="2026-01-20" \
  --to="2026-01-21" \
  --summary="Out of office - personal day"

# 7. Set working location
gog calendar working-location \
  --from="2026-01-17" \
  --to="2026-01-17" \
  --type="home"
文档搜索与整理
# Find all docs from a project
gog drive search "fullText contains 'Project Alpha'"

# List recent docs you created
gog drive search "'me' in owners and modifiedTime > '2026-01-01'" --max=50

# Find docs shared by specific person
gog drive search "'[email protected]' in writers"

# Find presentation decks
gog drive search "mimeType = 'application/vnd.google-apps.presentation' and modifiedTime > '2025-10-01'"

# Download a doc as PDF
gog docs export DOC_ID --format=pdf --output="./report.pdf"

# Read doc contents (plain text for quick review)
gog docs cat DOC_ID

# Export spreadsheet as Excel
gog sheets export SPREADSHEET_ID --format=xlsx --output="./data.xlsx"

# Get shareable link
gog drive url FILE_ID
gog drive share FILE_ID --role=reader --type=anyone
每日任务管理
# 1. List all task lists
gog tasks lists list

# 2. View all tasks in default list
gog tasks list @default

# 3. View tasks due today
gog tasks list @default --due-max="$(date -u +%Y-%m-%dT23:59:59Z)"

# 4. Add a new task with due date
gog tasks add @default \
  --title="Review Q4 financials" \
  --due="2026-01-15" \
  --notes="Check revenue projections and expense reports"

# 5. Complete a task
gog tasks done @default TASK_ID

# 6. Reopen a completed task
gog tasks undo @default TASK_ID

# 7. Delete a task
gog tasks delete @default TASK_ID

# 8. Clear all completed tasks
gog tasks clear @default
联系人查询
# Search for a contact
gog contacts search "John Smith"

# List all contacts
gog contacts list --max=100

# Get contact details
gog contacts get RESOURCE_NAME

# Create a new contact
gog contacts create \
  --given="Jane" \
  --family="Doe" \
  --email="[email protected]" \
  --phone="+1-555-123-4567"

# Search directory (Workspace)
gog contacts directory search "engineering"

更多工作流示例请参阅 references/common-workflows.md。

命令参考

Gmail 命令
命令描述主要标志
gmail search <query>搜索会话--max、--oldest、--page
gmail get <messageId>获取邮件内容--format=full|metadata|raw
gmail send发送邮件--to、--cc、--bcc、--subject、--body、--attach
gmail thread get <id>获取完整会话-
gmail thread modify <id>修改会话标签--add-labels、--remove-labels
gmail labels list列出所有标签-
gmail labels get <name>获取标签详情-
gmail labels modify <ids>批量修改标签--add、--remove
gmail attachment <msgId> <attId>下载附件-
gmail url <threadId>获取 Gmail 网页 URL-
gmail batch delete <ids>批量删除-
gmail drafts list列出草稿-
gmail drafts create创建草稿与 send 使用相同的标志
日历命令
命令描述关键标志
calendar calendars列出日历-
calendar events [calId]列出活动--from、--to、--today、--week、--all
calendar event <calId> <eventId>获取活动详情-
calendar create <calId>创建活动--summary、--from、--to、--attendees、--with-meet
calendar update <calId> <eventId>更新活动同创建活动
calendar delete <calId> <eventId>删除活动-
calendar freebusy <calendars>检查空闲情况--from、--to
calendar conflicts查找冲突--week、--days
calendar search <query>搜索活动-
calendar respond <calId> <eventId>回复邀请--status=accepted|declined|tentative
calendar focus-time创建专注时段--from、--to
calendar out-of-office设置不在办公室--from、--to
calendar working-location设置工作地点--from、--to、--type
calendar team <groupEmail>查看团队日历-
Drive 命令
命令描述关键标志
drive ls列出文件--parent
drive search <query>全文搜索--max
drive get <fileId>获取文件元数据-
drive download <fileId>下载文件--output
drive upload <path>上传文件--name、--parent
drive mkdir <name>创建文件夹--parent
drive delete <fileId>删除(移至回收站)-
drive move <fileId>移动文件--parent
drive rename <fileId> <name>重命名文件-
drive share <fileId>分享文件--role、--type、--email
drive unshare <fileId> <permId>移除权限-
drive permissions <fileId>列出权限-
drive url <fileId>获取网页 URL-
drive copy <fileId> <name>复制文件-
Sheets 命令
命令描述关键标志
sheets get <id> <range>读取值-
sheets update <id> <range> [vals]更新值--input=RAW|USER_ENTERED
sheets append <id> <range> [vals]追加行--input
sheets clear <id> <range>清除值-
sheets metadata <id>获取电子表格信息-
sheets create <title>创建电子表格-
sheets copy <id> <title>复制电子表格-
sheets export <id>导出--format=pdf|xlsx|csv
Docs 命令
命令描述关键标志
docs cat <docId>以纯文本形式输出-
docs export <docId>导出文档--format=pdf|docx|txt
docs info <docId>获取元数据-
docs create <title>创建文档-
docs copy <docId> <title>复制文档-
Slides 命令
命令描述关键标志
slides export <id>导出演示文稿--format=pdf|pptx
slides info <id>获取元数据-
slides create <title>创建演示文稿-
slides copy <id> <title>复制演示文稿-
Tasks 命令
命令描述关键标志
tasks lists list列出任务列表-
tasks list <listId>列出任务--due-min、--due-max、--show-completed
tasks add <listId>添加任务--title、--due、--notes
tasks update <listId> <taskId>更新任务同添加任务
tasks done <listId> <taskId>标记为已完成-
tasks undo <listId> <taskId>标记为未完成-
tasks delete <listId> <taskId>删除任务-
tasks clear <listId>清除已完成任务-
联系人命令
命令说明主要标志
contacts search <query>搜索联系人-
contacts list列出所有联系人--max
contacts get <resourceName>获取联系人-
contacts create创建联系人--given、--family、--email、--phone
contacts update <resourceName>更新联系人与创建相同
contacts delete <resourceName>删除联系人-
contacts directory search搜索目录-
群组命令
命令说明主要标志
groups list列出你的群组-
groups members <groupEmail>列出群组成员-
人员命令
命令说明主要标志
people me显示你的个人资料-

全局标志

所有 gog 命令均支持以下标志:

标志说明
--json输出 JSON(最适合脚本处理或通过管道传递给 jq)
--plain输出 TSV,不使用颜色(适用于脚本和解析)
--account=EMAIL使用指定账户(支持多个账户)
--force跳过确认提示
--no-input从不显示提示,直接失败(适用于 CI/自动化)
--verbose输出详细日志以便调试
--color=<auto|always|never>控制颜色输出
多账户用法
# Use specific account for a command
gog gmail search "is:unread" [email protected]

# List available accounts
gog auth list
用于脚本的 JSON 输出
# Get unread count for inbox
gog gmail labels get INBOX --json | jq '.messagesUnread'

# Extract event IDs from today
gog calendar events --today --json | jq '.[].id'

# List file IDs from search
gog drive search "budget" --json | jq '.[].id'

# Process email subjects
gog gmail search "is:unread" --json | jq '.[].snippet'

最佳实践

高效搜索
  1. 先缩小范围,再逐步扩大 - 从具体查询开始,结果过多时再添加筛选条件
  2. 使用日期筛选条件 - newer_than: 可大幅减少无关结果
  3. 组合运算符 - is:unread from:boss newer_than:7d 比浏览更高效
  4. 使用 --max - 探索时限制结果数量:--max=10
日历管理
  1. 与他人安排会议前,务必检查 freebusy
  2. 远程会议使用 --with-meet,以自动创建视频链接
  3. 设置提醒 - 重要会议可使用 --reminder="popup:15m"
  4. 主动安排专注时间,保障深度工作
云端硬盘整理
  1. 使用文件夹 ID - 保存常用文件夹 ID,以便快速访问
  2. 按内容搜索 - fullText contains 即使文件名不明确,也能找到文档
  3. 按 MIME 类型筛选 - 缩小到特定文档类型
  4. 尽早导出 - 将重要文档下载为 PDF,以便离线访问
自动化提示
  1. 使用 --json 编写脚本 - 使用 jq 解析
  2. 简单脚本使用 --plain - 以制表符分隔,不使用颜色
  3. 在 CI 中使用 --no-input - 防止因提示而卡住
  4. 保存 ID - 以便重复使用日历、文件夹和任务列表 ID

参考文件

评论

支持 Markdown