This skill helps users write professional emails through a guided multi-step process (L3 SimpleSequentialChain). It analyzes user intent, collects necessary information dynamically, and generates well-formatted HTML emails with proper structure and styling.
This skill uses an interactive state machine. Execute commands in order:
# 1. Start new session
python scripts/email_writer.py --start --input "帮我写封感谢信"
# 2. After getting analysis instruction, run LLM analysis, then:
python scripts/email_writer.py --session <id> --analyze-result '{"intent":"thankyou",...}'
# 3. This will output questions. Use appropriate tool to collect answers, then:
python scripts/email_writer.py --continue --session <id> --answers '{"recipient":"...",...}'
# 4. After getting outline instruction, run LLM, then:
python scripts/email_writer.py --session <id> --outline-result '{"outline":{...}}'
# 5. After getting draft instruction, run LLM, then:
python scripts/email_writer.py --session <id> --draft-result '邮件正文...'
# 6. After getting Step 5a (plain text) instruction, run LLM, then:
python scripts/email_writer.py --session <id> --plain-result '{"subject":"...","plainText":"..."}'
# 7. After getting Step 5b (HTML) instruction, run LLM, then:
python scripts/email_writer.py --session <id> --html-result '{"html":"..."}'
Each session has a state file in state/{session_id}.json. The script manages:
Important: Always use the script to manage state. Do not manually edit state files.
Analyze the user's request to determine:
Output format:
{
"analysis": {
"intent": "resignation|meeting|thankyou|apology|inquiry|custom",
"tone": "formal|business|friendly|urgent",
"requiredFields": ["fieldName"],
"optionalFields": ["fieldName"]
},
"collection": {
"strategy": "tool_call|text",
"reasoning": "why this strategy was chosen"
}
}
CRITICAL: You MUST collect missing information before proceeding.
Based on Step 1 analysis, identify missing required fields and collect them:
Collection Strategy (MUST choose one):
ask_followup_question 等多选/单选/文本输入工具⚠️ IMPORTANT: You MUST stop after requesting information. Do not generate example content or proceed to the next step until the user provides the actual information.
Common fields by email type:
Generate email outline based on collected information:
{
"outline": {
"subject": "email subject line",
"sections": [
{"type": "greeting", "content": "..."},
{"type": "opening", "content": "..."},
{"type": "body", "content": "..."},
{"type": "closing", "content": "..."},
{"type": "signature", "content": "..."}
]
}
}
Generate the complete email content following format specifications from references/email-formats.md.
Generate final output in TWO separate substeps:
Step 5a: Generate Plain Text Version
Step 5b: Generate HTML Version
Output Format:
{
"subject": "email subject",
"plainText": "Clean plain text version without any HTML",
"html": "Full HTML with inline CSS styling",
"metadata": {
"type": "email type",
"tone": "tone used",
"generatedAt": "timestamp"
}
}
Important: The plainText field must contain NO HTML tags. The html field must contain the complete HTML document with styling.
Always provide both formats:
Include a copy button or clear separation for easy use.
Email format specifications and templates. Load this file when generating emails to ensure proper structure and styling.
Python script that executes the L3 multi-step chain. Use this for deterministic email generation when needed.
HTML email template with professional CSS styling.
共 1 个版本