ข้อกำหนดรูปแบบ Skills
รูปแบบ skills.md กำหนดวิธีที่ Skills ถูกจัดโครงสร้าง กำหนดค่า และดำเนินการ ข้อกำหนดนี้รับประกันพฤติกรรมที่สม่ำเสมอใน Tajo Skills ทั้งหมด
โครงสร้างไฟล์
Skill ถูกกำหนดในไฟล์ markdown ไฟล์เดียวที่มี YAML frontmatter:
---name: customer-syncversion: 2.1.0description: Sync customer data to Brevo contactscategory: data-syncstatus: stable
triggers: - event: customer_created - event: customer_updated - event: customer_deleted
actions: - brevo/create-contact - brevo/update-contact - brevo/delete-contact
brevoEndpoints: - POST /v3/contacts - PUT /v3/contacts/{identifier} - DELETE /v3/contacts/{identifier}
permissions: - contacts:write - contacts:read---
# Customer Sync
Automatically synchronize customer data from your platform to Brevo contacts.
## Overview
This skill listens for customer lifecycle events and mirrors changes to Brevo...ฟิลด์ Frontmatter
ฟิลด์ที่จำเป็น
| ฟิลด์ | ประเภท | คำอธิบาย |
|---|---|---|
name | string | ตัวระบุเฉพาะ (kebab-case) |
version | string | เวอร์ชัน Semantic (เช่น “2.1.0”) |
description | string | คำอธิบายสั้น (สูงสุด 160 ตัวอักษร) |
category | enum | หนึ่งใน: data-sync, email-marketing, sms-whatsapp, loyalty, analytics, integrations |
triggers | array | เหตุการณ์ที่เปิดใช้งาน Skill นี้ |
actions | array | การดำเนินการที่ Skill นี้สามารถทำได้ |
ฟิลด์ที่ไม่บังคับ
| ฟิลด์ | ประเภท | ค่าเริ่มต้น | คำอธิบาย |
|---|---|---|---|
status | enum | stable | หนึ่งใน: stable, beta, experimental |
brevoEndpoints | array | [] | Brevo API endpoints ที่ใช้ |
permissions | array | [] | สิทธิ์ Brevo API ที่จำเป็น |
relatedSkills | array | [] | ID ของ Skills ที่เกี่ยวข้อง |
featured | boolean | false | เน้นในแคตตาล็อก Skill |
Triggers
Triggers กำหนดว่าเหตุการณ์ใดเปิดใช้งาน Skill
Trigger เหตุการณ์
triggers: - event: cart_abandoned conditions: - cart_value: "> 50" # มูลค่าตะกร้าขั้นต่ำ - items_count: ">= 1" # อย่างน้อยหนึ่งรายการ - time_since_activity: "> 30m" # ไม่มีกิจกรรม 30 นาที debounce: 5m # รอ 5 นาทีก่อนทริกเกอร์ใหม่Trigger กำหนดเวลา
triggers: - schedule: "0 9 * * *" # Cron expression (ทุกวันเวลา 9 โมงเช้า) timezone: "America/New_York" - schedule: every_hour - schedule: every_dayTrigger Webhook
triggers: - webhook: /skills/customer-sync/trigger method: POST authentication: api_keyตัวดำเนินการเงื่อนไข
| ตัวดำเนินการ | คำอธิบาย | ตัวอย่าง |
|---|---|---|
= | เท่ากับ | status: "active" |
!= | ไม่เท่ากับ | status: "!= deleted" |
> | มากกว่า | cart_value: "> 50" |
>= | มากกว่าหรือเท่ากับ | items: ">= 1" |
< | น้อยกว่า | age: "< 30" |
<= | น้อยกว่าหรือเท่ากับ | quantity: "<= 10" |
contains | สตริงประกอบด้วย | email: "contains @gmail.com" |
starts_with | คำนำหน้าสตริง | name: "starts_with Dr." |
in | ค่าอยู่ในรายการ | country: "in US,CA,UK" |
Actions
Actions กำหนดว่า Skill ดำเนินการอะไร
การกำหนด Action
actions: - id: send_reminder_email type: brevo/send-email parameters: template_id: 12345 to: "{{ contact.email }}" params: first_name: "{{ contact.firstName }}" cart_items: "{{ cart.items }}" retry: attempts: 3 backoff: exponential on_error: continue # หรือ 'stop'ประเภท Action
| ประเภท | คำอธิบาย |
|---|---|
brevo/send-email | ส่งอีเมลธุรกรรม |
brevo/send-sms | ส่งข้อความ SMS |
brevo/send-whatsapp | ส่งข้อความ WhatsApp |
brevo/create-contact | สร้างผู้ติดต่อใหม่ |
brevo/update-contact | อัปเดตคุณลักษณะผู้ติดต่อ |
brevo/delete-contact | ลบผู้ติดต่อ |
brevo/add-to-list | เพิ่มผู้ติดต่อในรายการ |
brevo/remove-from-list | ลบผู้ติดต่อออกจากรายการ |
brevo/track-event | ติดตามเหตุการณ์ที่กำหนดเอง |
http/request | สร้างคำขอ HTTP |
transform/map | แปลงข้อมูล |
control/delay | รอก่อนดำเนินการต่อ |
control/condition | แยกตามเงื่อนไข |
ตัวแปรเทมเพลต
ใช้ไวยากรณ์ {{ }} เพื่ออ้างอิงข้อมูล:
parameters: to: "{{ contact.email }}" subject: "Your order #{{ order.number }} has shipped" params: name: "{{ contact.firstName | default: 'Customer' }}" items: "{{ cart.items | map: 'name' | join: ', ' }}" total: "{{ cart.total | currency: 'USD' }}"ตัวกรองที่ใช้ได้
| ตัวกรอง | คำอธิบาย | ตัวอย่าง |
|---|---|---|
default | ค่าเริ่มต้น | {{ name | default: 'Guest' }} |
uppercase | ตัวอักษรพิมพ์ใหญ่ | {{ name | uppercase }} |
lowercase | ตัวอักษรพิมพ์เล็ก | {{ email | lowercase }} |
capitalize | ตัวอักษรแรกพิมพ์ใหญ่ | {{ name | capitalize }} |
truncate | ตัดสตริง | {{ desc | truncate: 100 }} |
date | จัดรูปแบบวันที่ | {{ date | date: 'YYYY-MM-DD' }} |
currency | จัดรูปแบบสกุลเงิน | {{ price | currency: 'EUR' }} |
map | Map คุณสมบัติ array | {{ items | map: 'name' }} |
join | รวม array | {{ tags | join: ', ' }} |
first | รายการแรกใน array | {{ items | first }} |
last | รายการสุดท้ายใน array | {{ items | last }} |
size | ความยาว array/สตริง | {{ items | size }} |
สิทธิ์
กำหนดสิทธิ์ Brevo API ที่จำเป็น:
permissions: - contacts:read # อ่านข้อมูลผู้ติดต่อ - contacts:write # สร้าง/อัปเดตผู้ติดต่อ - email:send # ส่งอีเมลธุรกรรม - sms:send # ส่งข้อความ SMS - lists:write # จัดการรายชื่อผู้ติดต่อ - events:write # ติดตามเหตุการณ์ตัวอย่างสมบูรณ์
---name: abandoned-cart-recoveryversion: 3.0.0description: Recover abandoned shopping carts with a multi-step email sequencecategory: email-marketingstatus: stable
triggers: - event: cart_abandoned conditions: - cart_value: "> 25" - customer_email: "exists" - items_count: ">= 1" debounce: 30m
actions: - id: wait_1h type: control/delay parameters: duration: 1h
- id: check_purchase type: control/condition parameters: condition: "{{ cart.converted }} = false" then: send_first_email else: stop
- id: send_first_email type: brevo/send-email parameters: template_id: {{ env.ABANDONED_CART_TEMPLATE_1 }} to: "{{ contact.email }}" params: first_name: "{{ contact.firstName }}" cart_url: "{{ cart.recovery_url }}" items: "{{ cart.items }}" total: "{{ cart.total | currency }}"
- id: wait_24h type: control/delay parameters: duration: 24h
- id: check_purchase_2 type: control/condition parameters: condition: "{{ cart.converted }} = false" then: send_second_email else: stop
- id: send_second_email type: brevo/send-email parameters: template_id: {{ env.ABANDONED_CART_TEMPLATE_2 }} to: "{{ contact.email }}" params: first_name: "{{ contact.firstName }}" cart_url: "{{ cart.recovery_url }}" discount_code: "{{ generate_discount(10, 'percent') }}"
brevoEndpoints: - POST /v3/smtp/email - GET /v3/contacts/{identifier}
permissions: - contacts:read - email:send
relatedSkills: - customer-sync - order-events - browse-abandonment---
# Abandoned Cart Recovery
Recover lost sales with a proven multi-step email sequence...การเปิดเผย MCP Tool
Skills สามารถเปิดเผยเป็น MCP tools ทำให้ AI agents เรียกใช้ได้ เพิ่มฟิลด์ mcp ใน frontmatter ของคุณ:
---name: abandoned-cart-recoveryversion: 3.0.0description: Recover abandoned shopping carts with a multi-step email sequencecategory: email-marketing
# การกำหนดค่า MCPmcp: tool_name: tajo/recover-abandoned-cart description: Execute abandoned cart recovery sequence for a specific cart inputSchema: type: object properties: cart_id: type: string description: The abandoned cart identifier customer_email: type: string description: Customer email address min_cart_value: type: number description: Minimum cart value to trigger recovery default: 25 required: [cart_id, customer_email] brevo_servers: - brevo_contacts - brevo_email_campaign_management - brevo_templates---วิธีการทำงานของการเปิดเผย MCP
เมื่อ Skill มีฟิลด์ mcp มันจะกลายเป็น tool ที่ AI agents สามารถค้นพบและเรียกใช้ได้:
Agent: "Recover abandoned cart #4521 for [email protected]" ↓MCP Tool Discovery: finds tajo/recover-abandoned-cart ↓Tool Execution: runs the skill's action chain ↓Brevo MCP Servers: contacts + email modules called ↓Result: recovery sequence initiatedฟิลด์ MCP
| ฟิลด์ | ประเภท | คำอธิบาย |
|---|---|---|
mcp.tool_name | string | ชื่อ MCP tool (รูปแบบ: tajo/skill-name) |
mcp.description | string | คำอธิบายที่แสดงต่อ AI agents ระหว่างการค้นพบ tool |
mcp.inputSchema | object | JSON Schema ที่กำหนดพารามิเตอร์อินพุตของ tool |
mcp.brevo_servers | array | โมดูล Brevo MCP server ที่ Skill นี้ต้องการ |
Skills เทียบกับ Direct MCP Tools
| ด้าน | Skill เป็น MCP Tool | Direct Brevo MCP |
|---|---|---|
| การแยกชั้น | สูง agent พูดว่า “กู้คืนตะกร้านี้” | ต่ำ agent ต้องเรียก Brevo endpoints แต่ละตัว |
| ความซับซ้อน | บรรจุตรรกะหลายขั้นตอน | Agent ต้องจัดการแต่ละขั้นตอน |
| การป้องกัน | ฝังอยู่ใน Skill (เงื่อนไข debounce) | Agent ต้องนำไปใช้เอง |
| เหมาะสำหรับ | เวิร์กโฟลว์ที่ทำซ้ำได้ | การดำเนินการแบบครั้งเดียว |
Tip
ใช้ Skills เป็น MCP tools สำหรับเวิร์กโฟลว์ที่ซับซ้อนและหลายขั้นตอนที่ agents ไม่ควรสร้างใหม่ทุกครั้ง ใช้ direct Brevo MCP tools สำหรับการดำเนินการที่ง่ายและครั้งเดียว เช่น การค้นหาผู้ติดต่อหรือส่งอีเมลเดียว
การประกอบ Skills และ Agents
Agent สามารถใช้ทั้ง Skills (เป็น MCP tools) และ Brevo MCP modules โดยตรง:
# Agent spec---name: retention-agenttools: # Tajo Skills เป็น MCP tools - tajo/recover-abandoned-cart - tajo/customer-sync - tajo/win-back-sequence # Direct Brevo MCP modules - brevo_contacts - brevo_campaign_analytics - brevo_segments---ทำให้ agents มีการทำงานอัตโนมัติระดับสูง (Skills) สำหรับรูปแบบทั่วไป พร้อมยังคงการเข้าถึงระดับต่ำ (Brevo MCP) สำหรับตรรกะที่กำหนดเอง
ดู รูปแบบข้อกำหนด Agent และ การสร้าง Agents สำหรับรายละเอียดเต็ม
แนวทางปฏิบัติที่ดีที่สุด
Tip
ตั้งเวอร์ชัน Skills ของคุณ โดยใช้การกำหนดเวอร์ชันแบบ Semantic การเปลี่ยนแปลงที่ทำลายความเข้ากันได้ต้องการการเพิ่มเวอร์ชันหลัก
- ทำให้ Skills มีความเฉพาะเจาะจง - Skill หนึ่งควรทำสิ่งเดียวได้ดี
- ใช้ชื่อที่สื่อความหมาย -
abandoned-cart-recoveryไม่ใช่acr - บันทึกเงื่อนไข - อธิบายว่าทำไมแต่ละเงื่อนไขจึงมีอยู่
- จัดการข้อผิดพลาดอย่างเหมาะสม - ใช้
on_error: continueสำหรับ actions ที่ไม่สำคัญ - ทดสอบกับกลุ่มเล็ก - ใช้
status: experimentalระหว่างการพัฒนา - เพิ่มการเปิดเผย MCP สำหรับ Skills ที่ agents ควรเรียกใช้โดยตรงได้
ขั้นตอนถัดไป
- ภาพรวม MCP & Agents - วิธีที่ Skills เข้ากับสถาปัตยกรรม agentic
- รูปแบบข้อกำหนด Agent - กำหนด agents ที่ใช้ Skills เป็น tools
- การสร้าง Agents - สร้าง marketing agent ตัวแรกของคุณ
- Data Sync Skills - สำรวจ Skills การซิงก์ข้อมูล