From 88ddfd4ba7d217828a2eaf49bc324f4e94f3ddf4 Mon Sep 17 00:00:00 2001 From: ywkj Date: Fri, 20 Mar 2026 07:27:49 +0800 Subject: [PATCH] feat: add structured compose guidelines with sender profile, i18n, and review analysis Enhance email composition with sender identity (sender-profile.json), auto language selection by country, review pain-point analysis workflow, structured email template, and personalization tracking. Co-Authored-By: Claude Opus 4.6 --- SKILL.md | 49 ++++++++++++++++++++++++++++++++++++++++++--- agents/openai.yaml | 2 +- sender-profile.json | 11 ++++++++++ 3 files changed, 58 insertions(+), 4 deletions(-) create mode 100644 sender-profile.json diff --git a/SKILL.md b/SKILL.md index e48beca..dfc7734 100644 --- a/SKILL.md +++ b/SKILL.md @@ -28,10 +28,53 @@ Save drafts as a JSON array file. Each draft must have: - `subject` (string, under 60 chars) - `body_html` (string, professional HTML with inline styles) - `body_text` (string, plain text fallback) +- `personalization_context` (object, see below) -#### Email Composition Rules -- Reference the business name and specific review insights -- Mention pain points or strengths identified from reviews +#### a) Sender Profile +Before composing, read `sender-profile.json` in this skill directory. Use it to populate sender identity, product info, and signature in every email. + +#### b) Language Selection +Auto-select email language based on the `country` field from fetch output: +- us/gb/au/ca → English +- cn → 中文 +- jp → 日本語 +- kr → 한국어 +- de → Deutsch +- fr → Français +- es/mx → Español +- pt/br → Português +- Unlisted countries → default to English + +Write the **entire** email (subject, body, signature) in the selected language. + +#### c) Review Pain-Point Analysis +When `reviews_data` is non-empty for a business: +1. Parse JSON into a review array +2. Filter for negative reviews / complaints related to the sender's `product_category` +3. Extract 1–2 pain points that the sender's products can solve +4. Analyze at most 10 reviews, prioritizing low-score ones +5. If `reviews_data` is empty or null, fall back to the business's general info (category, rating) to craft the email + +#### d) Email Template Structure +1. **Subject** — Under 60 chars, in the target language, referencing a specific pain point or business need +2. **Opening** — Address the business by name; demonstrate familiarity with their operations +3. **Pain Point Bridge** — Reference pain-point patterns from reviews (do NOT quote reviews verbatim); connect them to problems the sender's product solves +4. **Value Proposition** — Introduce sender company and products using `product_highlights` from sender-profile.json +5. **CTA** — Low-friction call-to-action: free samples, catalog, or a brief call +6. **Signature** — Use contact info from sender-profile.json (name, title, email, phone, website) + +#### e) Personalization Tracking +Populate the `personalization_context` field on each draft: +```json +{ + "language": "selected language", + "pain_points_used": ["pain point 1", "pain point 2"], + "reviews_analyzed": true, + "sender_product_match": "brief note on how sender product connects to this business" +} +``` + +#### General Rules - Tone: professional, consultative, not salesy - Save the drafts array to a temp JSON file, e.g. `/tmp/drafts-.json` diff --git a/agents/openai.yaml b/agents/openai.yaml index 77cfd65..aff2f4c 100644 --- a/agents/openai.yaml +++ b/agents/openai.yaml @@ -6,7 +6,7 @@ interface: This skill uses Bun+TypeScript CLI scripts. Do NOT create Python scripts or custom upload logic. Step 1: cd ~/clawd/skills/email-content-compose && bun run fetch -- --workflow-id= - Step 2: Read the fetch output. For each business with emails, compose a personalized EmailDraft (recipient_email, recipient_name, subject, body_html, body_text). Save all drafts as a JSON array to /tmp/drafts-.json + Step 2: Read sender-profile.json from the skill directory. Then read the fetch output. For each business with emails, compose a personalized EmailDraft following SKILL.md Section 2 rules (language selection by country, review pain-point analysis, structured email template, personalization_context tracking). Save all drafts as a JSON array to /tmp/drafts-.json Step 3: bun run export -- --drafts=/tmp/drafts-.json --workflow-id= Return the export result JSON (file URLs + bundle URL). Read SKILL.md for composition rules. diff --git a/sender-profile.json b/sender-profile.json new file mode 100644 index 0000000..1a6383b --- /dev/null +++ b/sender-profile.json @@ -0,0 +1,11 @@ +{ + "company_name": "Your Company Name", + "website": "https://yourcompany.com", + "product_category": "e.g., industrial packaging supplies", + "product_highlights": ["Key benefit 1", "Key benefit 2"], + "value_proposition": "One sentence why businesses should use your products", + "contact_name": "Sales Rep Name", + "contact_title": "Business Development Manager", + "contact_email": "sales@yourcompany.com", + "contact_phone": "+1-555-0100" +}