Interacts with Gmail API via Python CLI to search/read messages, manage labels, create/update drafts, send mail, and manage filter rules. Includes safety confirmations for destructive actions.
Ships in dcjanus. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
通过本 skill 调用 Gmail API。读取邮件时注意只取当前任务需要的范围,不要把无关邮件正文或附件带入上下文。
--json,且全局参数必须放在子命令前。./scripts/google_mail_cli.py <command> --help。先运行:
./scripts/google_mail_cli.py --json auth doctor
CLI 可以直接复用现有 Google Sheets Desktop OAuth Client,但会把 Gmail token 单独保存在 ~/.config/google-mail-cli/token.json。缺少 client secret、Gmail API 未启用、scope 未配置或 Workspace 策略阻止时,读取 google-workspace-oauth.md。
--confirm-send。--confirm-update。优先原地改名以保留标签 ID、历史邮件关联和过滤器引用。criteria 和 action,确认后添加 --confirm-create;删除规则同理使用 --confirm-delete。https://mail.google.com/,本 CLI 不提供绕过垃圾箱永久删除邮件的能力。命令族:
auth login|doctor|logout|pathsmessages search|get|modifythreads get|modifylabels list|create|updatedrafts list|get|create|updateattachments downloadsend message|draftfilters list|get|create|delete搜索并读取一封邮件:
./scripts/google_mail_cli.py --json messages search \
--query 'from:[email protected] newer_than:30d' \
--max-results 10
./scripts/google_mail_cli.py --json messages get --message-id <message-id>
归档并标为已读:
./scripts/google_mail_cli.py --json messages modify \
--message-id <message-id> \
--remove-label-id INBOX \
--remove-label-id UNREAD
创建草稿;复杂或多行正文优先使用临时文件:
./scripts/google_mail_cli.py --json drafts create \
--to [email protected] \
--subject '主题' \
--body-file /tmp/gmail-body.txt \
--attachment /tmp/report.pdf
更新草稿会完整替换原内容。执行前先 drafts get,并传回全部收件人、主题、正文、附件和回复头,不能只传局部变化。已有附件需先按草稿 message ID 和 attachment ID 下载,再作为 --attachment 传回:
./scripts/google_mail_cli.py --json attachments download \
--message-id <message-id> \
--attachment-id <attachment-id> \
--output /tmp/original-attachment.pdf
下载默认拒绝覆盖本地同名文件;只有核对目标文件后才可添加 --overwrite。
回复到原线程时,先读取原邮件,随后同时传入 Gmail threadId、原邮件的 Message-ID 及 References:
./scripts/google_mail_cli.py --json drafts create \
--to [email protected] \
--subject 'Re: 原主题' \
--body-file /tmp/gmail-reply.txt \
--thread-id <thread-id> \
--in-reply-to '<[email protected]>' \
--references '<[email protected]>'
得到明确授权后发送已有草稿:
./scripts/google_mail_cli.py --json send draft \
--draft-id <draft-id> \
--confirm-send
直接发送使用临时正文文件时,把成功后的清理放在同一次 shell 调用中:
./scripts/google_mail_cli.py --json send message \
--to [email protected] \
--subject '主题' \
--body-file /tmp/gmail-body.txt \
--html-body-file /tmp/gmail-body.html \
--confirm-send \
&& rm -- /tmp/gmail-body.txt /tmp/gmail-body.html
过滤规则使用 Gmail API 原生 JSON。自定义标签要先用 labels list 查 label ID:
./scripts/google_mail_cli.py --json filters create \
--filter-json '{"criteria":{"from":"[email protected]"},"action":{"addLabelIds":["Label_1"],"removeLabelIds":["INBOX"]}}' \
--confirm-create
复杂 JSON 可用 @path 读取。如果正文、附件或 JSON 文件由 Agent 为当前单次操作临时创建,且成功后不再需要验证、回滚或复用,应在同一次 shell 调用中把实际写入命令与 rm -- <明确路径> 用 && 串行执行。写入失败时保留文件;不要使用 ; 无条件删除,也不要用变量、通配符或目录作为清理目标。用户提供的正文、附件、仓库文件和写前备份不得自动删除。
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
gmail-api, email-automation, cli-tool, draft-management, filter-rules
27 skills in this plugin
/codex-thread-close-check检查当前 Codex thread(会话)是否还有遗留事项,适用于用户准备关闭、归档当前对话,或询问当前 thread 是否可以收尾时。/codex-thread-namer为当前 Codex thread 设置名称;仅当用户手动调用或明确要求命名、重命名、整理当前 Codex 会话标题时使用,永远不要自动调用。/confluence-cli查询、检索与阅读 Confluence 文档/页面。/dcjanus-merge-policy将 GitHub 或 GitLab 仓库配置为 DCjanus 偏好的合并策略,包括 squash、组织仓库的 merge queue、提交消息模板和源分支删除设置。适用于明确要求采用 DCjanus 个人合并策略的场景,不用于一般 PR/MR 合并操作。/dcjanus-preferences适用于创建、修改或评审 Skill,配置或复刻 GitHub 个人仓库与长期自用 fork 的维护、CI、发布、合并策略和 Dependabot 更新,设计或评审 CLI 的命名、输入手感、输出与补全,设计或评审前端界面的布局、信息层级和文案,或在前端技术栈与无障碍组件、Connect/Protobuf API、well-known types、FieldMask/PATCH、AIP-127 HTTP 映射与 Protovalidate 校验、项目开发工具(含 mbx/Cargo)及版本管理、用户级程序的 XDG 数据目录、跨语言的数据存储、分析、压缩、归档、哈希、Telegram Bot 消息呈现及 Python/Rust/Go 第三方库之间做技术选择的场景。/dcjanus-tasklog查询或管理 DCjanus 的 Linear 事项、提醒、长期文档、模板(含周期事项)、视图或团队配置,以及按个人任务模型整理目标、进展和关联时使用。/dcjanus-dcjanus-plugins-dcjanus:google-mail-clifrom dcjanus
Generated from the plugin's indexed repository (dcjanus/prompts) — no native marketplace selected
npx claudepluginhub p/dcjanus-dcjanus-plugins-dcjanusOther plugins' skills for the same job