home / skills / yangliu2060 / smith--skills / email-assistant

email-assistant skill

/email-assistant

This skill analyzes emails, summarizes content, determines whether a reply is needed, and drafts professional responses using contextual knowledge.

npx playbooks add skill yangliu2060/smith--skills --skill email-assistant

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
12.2 KB
---
name: email-assistant
description: AI智能邮件助手,分析邮件内容生成摘要,判断是否需要回复,并基于上下文生成专业回复草稿。
---

# 智能邮件助手

分析邮件内容,生成摘要,判断优先级和是否需要回复,并生成专业的回复草稿。

## 触发条件

当用户说以下内容时启动此技能:
- "帮我回这封邮件"
- "分析这封邮件"
- "邮件摘要"
- "email reply"
- "帮我写邮件回复"
- "这封邮件怎么回"
- "初始化邮件知识库"
- "添加文档到知识库"

## 知识库功能

此技能支持 RAG(检索增强生成)知识库,提升回复质量:

| 功能 | 说明 |
|------|------|
| 知识库初始化 | 创建结构化的知识库目录 |
| 文档管理 | 添加/更新/删除知识库文档 |
| 智能检索 | 根据邮件内容检索相关信息 |
| 上下文注入 | 将检索结果融入回复生成 |

## 工作流程

```
┌─────────────────────┐
│   输入邮件内容       │
│   (粘贴/文件)        │
└──────────┬──────────┘
           │
           ▼
┌─────────────────────┐
│   邮件内容解析       │
│   提取关键信息       │
└──────────┬──────────┘
           │
           ▼
┌─────────────────────┐
│   生成邮件摘要       │
│   (一句话概括)       │
└──────────┬──────────┘
           │
           ▼
┌─────────────────────┐
│   邮件分类判断       │
│   优先级/是否需回复   │
└──────────┬──────────┘
           │
     ┌─────┴─────┐
     │           │
     ▼           ▼
┌─────────┐  ┌─────────┐
│ 需要回复 │  │ 无需回复 │
└────┬────┘  │ 标记完成 │
     │       └─────────┘
     ▼
┌─────────────────────┐
│   RAG 知识库检索     │
│   (获取相关上下文)   │
└──────────┬──────────┘
     │
     ▼
┌─────────────────────┐
│   生成回复草稿       │
│   (结合知识库)       │
└──────────┬──────────┘
     │
     ▼
┌─────────────────────┐
│   回复质量审核       │
│   优化后输出         │
└─────────────────────┘
```

## 执行步骤

### 步骤 1:获取邮件内容

**方式 A - 直接粘贴**:
```
用户: 帮我回这封邮件:
---
From: [email protected]
Subject: 关于Q1项目进度
...邮件内容...
```

**方式 B - 文件读取**:
```
用户: 帮我分析这封邮件 /path/to/email.txt
```

### 步骤 2:邮件内容解析

提取以下信息:
```json
{
  "from": "发件人邮箱",
  "from_name": "发件人姓名",
  "to": "收件人",
  "subject": "邮件主题",
  "date": "发送时间",
  "body": "邮件正文",
  "attachments": ["附件列表"],
  "thread_context": "是否是回复/转发"
}
```

### 步骤 3:生成邮件摘要

**摘要提示词**:

```
请用一句话概括这封邮件的核心内容:

【邮件主题】{subject}
【发件人】{from}
【邮件正文】
{body}

要求:
1. 不超过50字
2. 突出关键信息(时间、金额、请求等)
3. 使用陈述句

示例:
- "客户询问Q1项目进度并要求本周五前提交报告"
- "供应商通知下月起涨价15%,需确认是否续约"
- "HR提醒年假剩余5天,12月31日前需用完"
```

### 步骤 4:邮件分类

**分类维度**:

| 维度 | 选项 |
|------|------|
| 类型 | 询问/通知/请求/投诉/商务/个人/垃圾 |
| 优先级 | 🔴紧急/🟡重要/🟢普通/⚪可忽略 |
| 是否需回复 | 是/否 |
| 建议回复时间 | 立即/今天内/本周内/不急 |
| 情绪 | 积极/中性/消极/紧迫 |

**分类提示词**:

```
分析这封邮件并分类:

【邮件摘要】{summary}
【邮件正文】{body}

输出 JSON 格式:
{
  "type": "询问|通知|请求|投诉|商务|个人|垃圾",
  "priority": "urgent|important|normal|low",
  "needs_reply": true|false,
  "reply_deadline": "立即|今天|本周|不急",
  "sender_emotion": "positive|neutral|negative|urgent",
  "key_asks": ["具体请求1", "具体请求2"],
  "reasoning": "分类理由"
}
```

### 步骤 5:RAG 知识库检索(可选)

如果配置了知识库,在生成回复前检索相关信息:

**知识库配置**:

```
知识库目录: ~/.claude/cache/email-assistant/knowledge-base/
```

**支持的文档格式**:
- `.md` - Markdown 文档
- `.txt` - 纯文本文档
- `.pdf` - PDF 文档(需 pdf-document 技能支持)
- `.docx` - Word 文档

**知识库初始化**:

首次使用时,用户可添加以下类型文档到知识库:
1. **公司信息**: 公司简介、产品说明、服务条款
2. **FAQ 文档**: 常见问题和标准回复
3. **历史邮件**: 优秀回复案例
4. **政策文档**: 退款政策、隐私政策等

**检索流程**:

```
1. 解析邮件关键词和主题
2. 在知识库中搜索相关文档
3. 提取最相关的 3-5 个片段
4. 将相关信息注入回复生成提示词
```

**检索提示词**:

```
根据邮件内容,请从以下知识库片段中找出与回复相关的信息:

【邮件主题】{subject}
【关键请求】{key_asks}

【知识库片段】
{knowledge_snippets}

请提取:
1. 直接相关的信息点
2. 可引用的标准回复语
3. 相关政策或流程
```

### 步骤 6:生成回复草稿

如果 `needs_reply = true`,结合知识库生成回复:

**回复生成提示词**:

```
请根据以下邮件生成专业的回复:

【原邮件】
发件人: {from}
主题: {subject}
正文: {body}

【邮件分析】
类型: {type}
关键请求: {key_asks}
发件人情绪: {sender_emotion}

【知识库参考】(如有)
{relevant_knowledge}

【回复要求】
1. 专业但不冷冰冰
2. 直接回应每个请求
3. 如无法满足,给出替代方案
4. 结尾有明确下一步
5. 长度适中(100-200字)
6. 如有知识库信息,准确引用

【我的角色】
{user_context} (如:产品经理、销售、客服等)

请生成回复,不需要写主题行。
```

### 步骤 7:回复质量审核

生成后进行自我审核:

```
请审核这封回复邮件:

【原邮件关键请求】
{key_asks}

【回复草稿】
{draft_reply}

审核维度:
1. 是否回应了所有请求?
2. 语气是否合适?
3. 是否有明确的下一步?
4. 是否有遗漏或歧义?

输出:
{
  "score": 8.5,
  "issues": ["未明确回复第二个问题"],
  "suggestions": ["加入对时间节点的确认"]
}
```

如果分数 < 8,优化后再输出。

### 步骤 8:输出结果

**完整输出格式**:

```markdown
# 邮件分析报告

## 📧 邮件概览

| 项目 | 内容 |
|------|------|
| 发件人 | {from_name} <{from}> |
| 主题 | {subject} |
| 时间 | {date} |
| 类型 | {type} |
| 优先级 | {priority_emoji} {priority} |

## 📝 一句话摘要

> {summary}

## 🏷️ 分类分析

- **是否需回复**: {needs_reply}
- **建议回复时间**: {reply_deadline}
- **发件人情绪**: {sender_emotion}
- **关键请求**:
  1. {key_ask_1}
  2. {key_ask_2}

---

## ✉️ 建议回复

**主题**: Re: {subject}

---

{draft_reply}

---

## 💡 回复建议

- 质量评分: {score}/10
- 注意事项: {notes}

---

*由 Claude Code email-assistant 技能生成*
```

## 使用示例

### 示例 1:分析并回复客户邮件

```
用户: 帮我回这封邮件:
From: [email protected]
Subject: 关于下周演示的确认

王总您好,

我们计划下周三下午2点在贵司进行产品演示,
请问会议室和投影设备是否已经准备好?
另外,参会人员名单能否提前发给我们?

谢谢!
李明

Claude:
📝 摘要: 客户确认下周三演示安排,需确认会议室和参会名单

🏷️ 分类: 请求 | 🟡重要 | 需今天回复

✉️ 建议回复:

李明您好,

感谢确认!下周三下午2点的演示安排已就绪:

1. 会议室:已预定3楼大会议室
2. 设备:投影仪和视频会议系统均已测试
3. 参会名单:我方将有产品、技术、商务共5人参加,
   名单今天下班前发您

如有其他需要,请随时联系。

祝好
```

### 示例 2:批量处理邮件

```
用户: 帮我分析这5封邮件,告诉我哪些需要优先处理

Claude:
[分析5封邮件,输出优先级排序]
```

### 示例 3:特定角色回复

```
用户: 帮我以客服身份回复这封投诉邮件

Claude:
[生成客服风格的道歉+解决方案回复]
```

## 邮件回复模板库

### 模板 1:确认收到

```
{name}您好,

邮件已收到,感谢告知。

{具体回应}

如有问题,随时联系。

祝好
```

### 模板 2:需要时间处理

```
{name}您好,

感谢您的邮件。

关于{具体事项},我需要与{相关方}确认后回复您,
预计{时间}前给您答复。

如有紧急情况,可直接电话联系我。

祝好
```

### 模板 3:礼貌拒绝

```
{name}您好,

感谢您的{请求/邀请/提议}。

经过慎重考虑,{拒绝理由},因此这次无法{具体事项}。

{替代方案,如有}

感谢理解,期待未来有合作机会。

祝好
```

### 模板 4:跟进催促

```
{name}您好,

想跟进一下{具体事项}的进展。

上次沟通是在{日期},您提到{上次结论}。

请问目前进展如何?是否需要我这边配合什么?

期待您的回复。

祝好
```

## 数据存储

- 邮件分析结果:`~/.claude/cache/email-assistant/`
- 文件命名:`{YYYYMMDD}-{subject-slug}.md`
- 知识库目录:`~/.claude/cache/email-assistant/knowledge-base/`

## 知识库管理

### 初始化知识库

```
用户: 初始化邮件知识库

Claude:
1. 创建知识库目录
2. 添加示例文档结构
3. 提示用户添加自己的文档
```

### 添加文档到知识库

```
用户: 把这个FAQ文档加入知识库 /path/to/faq.md

Claude:
1. 读取文档内容
2. 复制到知识库目录
3. 索引文档关键信息
4. 确认添加成功
```

### 知识库目录结构

```
~/.claude/cache/email-assistant/knowledge-base/
├── company/           # 公司信息
│   ├── about.md
│   └── products.md
├── faq/               # 常见问题
│   ├── general.md
│   └── technical.md
├── policies/          # 政策文档
│   ├── refund.md
│   └── privacy.md
├── templates/         # 回复模板
│   └── common-replies.md
└── history/           # 历史优秀回复
    └── examples.md
```

### 知识库检索策略

1. **关键词匹配**: 从邮件提取关键词,匹配文档标题和内容
2. **语义搜索**: 理解邮件意图,找到语义相关的文档片段
3. **优先级排序**: FAQ > 政策 > 模板 > 历史回复

## 依赖工具

- **Read**: 读取邮件文件
- **Write**: 保存分析结果
- **Glob**: 搜索知识库文档
- **Grep**: 在知识库中检索关键词

## 最佳实践

### 提高回复效率
- 先看摘要和优先级,决定处理顺序
- 紧急邮件立即处理,普通邮件批量处理
- 使用模板减少重复劳动

### 邮件礼仪
- 24小时内回复商务邮件
- 无法立即解决也要先确认收到
- 避免全大写和过多感叹号
- 检查收件人和抄送是否正确

### 避免常见错误
- 不要回复时忘记附件
- 不要在情绪激动时发送邮件
- 不要使用模糊表述("尽快"改为"周五前")

## 限制说明

- 此技能分析邮件并生成回复,不负责实际发送
- 需要用户手动复制到邮件客户端发送
- 涉及敏感信息的邮件请谨慎使用
- 生成的回复建议人工审核后发送

## 原始来源

改编自 n8n 模板:
- 模板ID: 2852
- 原名: AI-Powered Email Automation for Business: Summarize & Respond with RAG
- 链接: https://n8n.io/workflows/2852

Overview

This skill is an email assistant that analyzes incoming messages, generates concise one-line summaries, assesses priority and reply needs, and drafts professional response templates. It supports an optional retrieval-augmented knowledge base (RAG) to inject company policies, FAQs, and past replies for higher-quality drafts. The output is designed for quick review and manual sending from your mail client.

How this skill works

The skill parses raw email content or files to extract sender, subject, date, body, attachments, and thread context. It produces a one-sentence summary, classifies type/priority/emotion and decides whether a reply is needed. If a knowledge base exists, it searches for relevant snippets and uses them to produce a 100–200 word draft reply, then runs a quality check and returns score and suggestions.

When to use it

  • You need a fast, clear summary of a long or complex email.
  • You want an initial professional draft to reply faster (sales, support, internal ops).
  • You must triage many emails and prioritize follow-ups.
  • You want replies consistent with company policies or standard templates.
  • You’re preparing role-specific responses (sales, product, support).

Best practices

  • Always review and personalize the generated draft before sending.
  • Keep a curated knowledge base: company facts, FAQs, policies, templates.
  • Use clear deadlines in replies instead of vague terms like “as soon as possible.”
  • Mark sensitive emails for manual handling; do not rely on automatic sending.
  • Regularly update templates and historical reply examples in the knowledge base.

Example use cases

  • Customer asks for project status — generate summary, mark priority, and draft confirmation with next steps.
  • Vendor notifies pricing change — extract action items, recommend reply or approval path, and draft negotiation points.
  • Support ticket escalation — summarize issue, classify urgency, and draft troubleshooting or escalation steps.
  • Internal meeting logistics — confirm room, AV setup and attendees, and send a concise confirmation email.
  • Batch triage: analyze multiple emails to create a prioritized action list and suggested replies.

FAQ

Does this skill send emails automatically?

No. It generates analysis and draft text. Users must copy the draft into their email client and send manually.

What document types does the knowledge base support?

Markdown and plain text are supported natively; PDFs and DOCX can be added if external document parsing is available.

How accurate are priority and reply suggestions?

Suggestions are based on content cues and heuristics; always verify critical or sensitive decisions manually.