Analyze email content, generate a summary, determine priority and whether a reply is needed, and generate a professional reply draft.
Trigger Conditions
Start this skill when the user says the following:
- "Help me reply to this email"
- "Analyze this email"
- "Email summary"
- "email reply"
- "Help me write an email reply"
- "How should I reply to this email"
- "Initialize the email knowledge base"
- "Add documents to the knowledge base"
Knowledge Base Features
This skill supports a RAG (Retrieval-Augmented Generation) knowledge base to improve reply quality:
| Feature | Description |
|---|---|
| Knowledge Base Initialization | Create a structured knowledge base directory |
| Document Management | Add/update/delete knowledge base documents |
| Intelligent Retrieval | Retrieve relevant information based on email content |
| Context Injection | Integrate retrieval results into reply generation |
Workflow
┌─────────────────────┐
│ 输入邮件内容 │
│ (粘贴/文件) │
└──────────┬──────────┘
│
▼
┌─────────────────────┐
│ 邮件内容解析 │
│ 提取关键信息 │
└──────────┬──────────┘
│
▼
┌─────────────────────┐
│ 生成邮件摘要 │
│ (一句话概括) │
└──────────┬──────────┘
│
▼
┌─────────────────────┐
│ 邮件分类判断 │
│ 优先级/是否需回复 │
└──────────┬──────────┘
│
┌─────┴─────┐
│ │
▼ ▼
┌─────────┐ ┌─────────┐
│ 需要回复 │ │ 无需回复 │
└────┬────┘ │ 标记完成 │
│ └─────────┘
▼
┌─────────────────────┐
│ RAG 知识库检索 │
│ (获取相关上下文) │
└──────────┬──────────┘
│
▼
┌─────────────────────┐
│ 生成回复草稿 │
│ (结合知识库) │
└──────────┬──────────┘
│
▼
┌─────────────────────┐
│ 回复质量审核 │
│ 优化后输出 │
└─────────────────────┘
Execution Steps
Step 1: Obtain Email Content
Method A - Direct Paste:
用户: 帮我回这封邮件:
---
From: client@company.com
Subject: 关于Q1项目进度
...邮件内容...
Method B - File Reading:
用户: 帮我分析这封邮件 /path/to/email.txt
Step 2: Email Content Parsing
Extract the following information:
{
"from": "发件人邮箱",
"from_name": "发件人姓名",
"to": "收件人",
"subject": "邮件主题",
"date": "发送时间",
"body": "邮件正文",
"attachments": ["附件列表"],
"thread_context": "是否是回复/转发"
}
Step 3: Generate Email Summary
Summary Prompt:
请用一句话概括这封邮件的核心内容:
【邮件主题】{subject}
【发件人】{from}
【邮件正文】
{body}
要求:
1. 不超过50字
2. 突出关键信息(时间、金额、请求等)
3. 使用陈述句
示例:
- "客户询问Q1项目进度并要求本周五前提交报告"
- "供应商通知下月起涨价15%,需确认是否续约"
- "HR提醒年假剩余5天,12月31日前需用完"
Step 4: Email Classification
Classification Dimensions:
| Dimension | Options |
|---|---|
| Type | Inquiry/Notification/Request/Complaint/Business/Personal/Spam |
| Priority | 🔴Urgent/🟡Important/🟢Normal/⚪Ignorable |
| Whether a Reply Is Needed | Yes/No |
| Suggested Reply Time | Immediately/Within today/Within this week/Not urgent |
| Emotion | Positive/Neutral/Negative/Urgent |
Classification Prompt:
分析这封邮件并分类:
【邮件摘要】{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": "分类理由"
}
Step 5: RAG Knowledge Base Retrieval (Optional)
If a knowledge base is configured, retrieve relevant information before generating a reply:
Knowledge Base Configuration:
知识库目录: ~/.claude/cache/email-assistant/knowledge-base/
Supported Document Formats:
.md- Markdown documents.txt- Plain text documents.pdf- PDF documents (requires pdf-document skill support).docx- Word documents
Knowledge Base Initialization:
On first use, the user can add the following types of documents to the knowledge base:
- Company Information: Company profile, product descriptions, terms of service
- FAQ Documents: Common questions and standard replies
- Historical Emails: Examples of excellent replies
- Policy Documents: Refund policy, privacy policy, etc.
Retrieval Process:
1. 解析邮件关键词和主题
2. 在知识库中搜索相关文档
3. 提取最相关的 3-5 个片段
4. 将相关信息注入回复生成提示词
Retrieval Prompt:
根据邮件内容,请从以下知识库片段中找出与回复相关的信息:
【邮件主题】{subject}
【关键请求】{key_asks}
【知识库片段】
{knowledge_snippets}
请提取:
1. 直接相关的信息点
2. 可引用的标准回复语
3. 相关政策或流程
Step 6: Generate Reply Draft
If needs_reply = true, generate a reply with the knowledge base:
Reply Generation Prompt:
请根据以下邮件生成专业的回复:
【原邮件】
发件人: {from}
主题: {subject}
正文: {body}
【邮件分析】
类型: {type}
关键请求: {key_asks}
发件人情绪: {sender_emotion}
【知识库参考】(如有)
{relevant_knowledge}
【回复要求】
1. 专业但不冷冰冰
2. 直接回应每个请求
3. 如无法满足,给出替代方案
4. 结尾有明确下一步
5. 长度适中(100-200字)
6. 如有知识库信息,准确引用
【我的角色】
{user_context} (如:产品经理、销售、客服等)
请生成回复,不需要写主题行。
Step 7: Reply Quality Review
After generation, perform a self-review:
请审核这封回复邮件:
【原邮件关键请求】
{key_asks}
【回复草稿】
{draft_reply}
审核维度:
1. 是否回应了所有请求?
2. 语气是否合适?
3. 是否有明确的下一步?
4. 是否有遗漏或歧义?
输出:
{
"score": 8.5,
"issues": ["未明确回复第二个问题"],
"suggestions": ["加入对时间节点的确认"]
}
If the score < 8, optimize before outputting.
Step 8: Output Results
Complete Output Format:
# 邮件分析报告
## 📧 邮件概览
| 项目 | 内容 |
|------|------|
| 发件人 | {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 技能生成*
Usage Examples
Example 1: Analyze and Reply to Customer Emails
用户: 帮我回这封邮件:
From: li.ming@client.com
Subject: 关于下周演示的确认
王总您好,
我们计划下周三下午2点在贵司进行产品演示,
请问会议室和投影设备是否已经准备好?
另外,参会人员名单能否提前发给我们?
谢谢!
李明
Claude:
📝 摘要: 客户确认下周三演示安排,需确认会议室和参会名单
🏷️ 分类: 请求 | 🟡重要 | 需今天回复
✉️ 建议回复:
李明您好,
感谢确认!下周三下午2点的演示安排已就绪:
1. 会议室:已预定3楼大会议室
2. 设备:投影仪和视频会议系统均已测试
3. 参会名单:我方将有产品、技术、商务共5人参加,
名单今天下班前发您
如有其他需要,请随时联系。
祝好
Example 2: Batch Process Emails
用户: 帮我分析这5封邮件,告诉我哪些需要优先处理
Claude:
[分析5封邮件,输出优先级排序]
Example 3: Role-Specific Replies
用户: 帮我以客服身份回复这封投诉邮件
Claude:
[生成客服风格的道歉+解决方案回复]
Email Reply Template Library
Template 1: Acknowledge Receipt
{name}您好,
邮件已收到,感谢告知。
{具体回应}
如有问题,随时联系。
祝好
Template 2: Need Time to Process
{name}您好,
感谢您的邮件。
关于{具体事项},我需要与{相关方}确认后回复您,
预计{时间}前给您答复。
如有紧急情况,可直接电话联系我。
祝好
Template 3: Polite Refusal
{name}您好,
感谢您的{请求/邀请/提议}。
经过慎重考虑,{拒绝理由},因此这次无法{具体事项}。
{替代方案,如有}
感谢理解,期待未来有合作机会。
祝好
Template 4: Follow-Up Reminder
{name}您好,
想跟进一下{具体事项}的进展。
上次沟通是在{日期},您提到{上次结论}。
请问目前进展如何?是否需要我这边配合什么?
期待您的回复。
祝好
Data Storage
- Email Analysis Results:
~/.claude/cache/email-assistant/ - File Naming:
{YYYYMMDD}-{subject-slug}.md - Knowledge Base Directory:
~/.claude/cache/email-assistant/knowledge-base/
Knowledge Base Management
Initialize Knowledge Base
用户: 初始化邮件知识库
Claude:
1. 创建知识库目录
2. 添加示例文档结构
3. 提示用户添加自己的文档
Add Documents to Knowledge Base
用户: 把这个FAQ文档加入知识库 /path/to/faq.md
Claude:
1. 读取文档内容
2. 复制到知识库目录
3. 索引文档关键信息
4. 确认添加成功
Knowledge Base Directory Structure
~/.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
Knowledge Base Retrieval Strategy
- Keyword Matching: Extract keywords from emails, match document titles and content
- Semantic Search: Understand email intent, find semantically related document fragments
- Priority Ranking: FAQ > Policy > Template > Historical Replies
Dependencies and Tools
- Read: Read email files
- Write: Save analysis results
- Glob: Search knowledge base documents
- Grep: Retrieve keywords in the knowledge base
Best Practices
Improve Reply Efficiency
- First look at the summary and priority to decide the processing order
- Handle urgent emails immediately, process ordinary emails in batches
- Use templates to reduce repetitive work
Email Etiquette
- Reply to business emails within 24 hours
- If you cannot resolve it immediately, still acknowledge receipt first
- Avoid all caps and excessive exclamation marks
- Check whether the recipients and CC are correct
Avoid Common Mistakes
- Do not forget attachments when replying
- Do not send emails when emotionally agitated
- Do not use vague expressions (change "as soon as possible" to "before Friday")
Limitations
- This skill analyzes emails and generates replies, but is not responsible for actually sending them
- Users need to manually copy them into an email client to send
- Use caution with emails involving sensitive information
- Generated replies are recommended to be sent after manual review