---
title: "ข้อกำหนดรูปแบบ Skills | Tajo"
description: "เรียนรู้รูปแบบ skills.md สำหรับการกำหนด Skills การทำงานอัตโนมัติที่ขับเคลื่อนด้วย AI ซึ่งผสานรวมกับ Brevo"
url: https://tajo.io/th/docs/skills/overview/skills-format/
markdown: https://tajo.io/th/docs/skills/overview/skills-format.md
lang: th-TH
author: "Set Noa"
author_url: https://tajo.io/th/set-noa/
robots: noindex
---

ขอสิทธิ์ใช้งานล่วงหน้า

กรอกชื่อและที่อยู่อีเมลที่ทำงานของคุณ เราจะส่งลิงก์เพื่อยืนยันคำขอเข้าใช้งาน Tajo ทางอีเมล

# ข้อกำหนดรูปแบบ Skills

[Set Noa](https://tajo.io/th/set-noa/)

รูปแบบ **skills.md** กำหนดวิธีที่ Skills ถูกจัดโครงสร้าง กำหนดค่า และดำเนินการ ข้อกำหนดนี้รับประกันพฤติกรรมที่สม่ำเสมอใน Tajo Skills ทั้งหมด

## โครงสร้างไฟล์

Skill ถูกกำหนดในไฟล์ markdown ไฟล์เดียวที่มี YAML frontmatter:

```markdown
---
name: customer-sync
version: 2.1.0
description: Sync customer data to Brevo contacts
category: data-sync
status: 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 เหตุการณ์

```yaml
triggers:
  - event: cart_abandoned
    conditions:
      - cart_value: "> 50"        # มูลค่าตะกร้าขั้นต่ำ
      - items_count: ">= 1"       # อย่างน้อยหนึ่งรายการ
      - time_since_activity: "> 30m"  # ไม่มีกิจกรรม 30 นาที
    debounce: 5m                  # รอ 5 นาทีก่อนทริกเกอร์ใหม่
```

### Trigger กำหนดเวลา

```yaml
triggers:
  - schedule: "0 9 * * *"         # Cron expression (ทุกวันเวลา 9 โมงเช้า)
    timezone: "America/New_York"
  - schedule: every_hour
  - schedule: every_day
```

### Trigger Webhook

```yaml
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

```yaml
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` | แยกตามเงื่อนไข |

### ตัวแปรเทมเพลต

ใช้ไวยากรณ์ `{{ }}` เพื่ออ้างอิงข้อมูล:

```yaml
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 ที่จำเป็น:

```yaml
permissions:
  - contacts:read        # อ่านข้อมูลผู้ติดต่อ
  - contacts:write       # สร้าง/อัปเดตผู้ติดต่อ
  - email:send           # ส่งอีเมลธุรกรรม
  - sms:send             # ส่งข้อความ SMS
  - lists:write          # จัดการรายชื่อผู้ติดต่อ
  - events:write         # ติดตามเหตุการณ์
```

## ตัวอย่างสมบูรณ์

```yaml
---
name: abandoned-cart-recovery
version: 3.0.0
description: Recover abandoned shopping carts with a multi-step email sequence
category: email-marketing
status: 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 ของคุณ:

```yaml
---
name: abandoned-cart-recovery
version: 3.0.0
description: Recover abandoned shopping carts with a multi-step email sequence
category: email-marketing

# การกำหนดค่า MCP
mcp:
  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 user@example.com"
    ↓
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 โดยตรง:

```yaml
# Agent spec
---
name: retention-agent
tools:
  # 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](https://tajo.io/th/docs/mcp/agent-specification) และ [การสร้าง Agents](https://tajo.io/th/docs/mcp/building-agents) สำหรับรายละเอียดเต็ม

## แนวทางปฏิบัติที่ดีที่สุด

Tip

**ตั้งเวอร์ชัน Skills ของคุณ** โดยใช้การกำหนดเวอร์ชันแบบ Semantic การเปลี่ยนแปลงที่ทำลายความเข้ากันได้ต้องการการเพิ่มเวอร์ชันหลัก

1. **ทำให้ Skills มีความเฉพาะเจาะจง** - Skill หนึ่งควรทำสิ่งเดียวได้ดี
2. **ใช้ชื่อที่สื่อความหมาย** - `abandoned-cart-recovery` ไม่ใช่ `acr`
3. **บันทึกเงื่อนไข** - อธิบายว่าทำไมแต่ละเงื่อนไขจึงมีอยู่
4. **จัดการข้อผิดพลาดอย่างเหมาะสม** - ใช้ `on_error: continue` สำหรับ actions ที่ไม่สำคัญ
5. **ทดสอบกับกลุ่มเล็ก** - ใช้ `status: experimental` ระหว่างการพัฒนา
6. **เพิ่มการเปิดเผย MCP** สำหรับ Skills ที่ agents ควรเรียกใช้โดยตรงได้

## ขั้นตอนถัดไป

- [ภาพรวม MCP & Agents](https://tajo.io/th/docs/mcp) - วิธีที่ Skills เข้ากับสถาปัตยกรรม agentic
- [รูปแบบข้อกำหนด Agent](https://tajo.io/th/docs/mcp/agent-specification) - กำหนด agents ที่ใช้ Skills เป็น tools
- [การสร้าง Agents](https://tajo.io/th/docs/mcp/building-agents) - สร้าง marketing agent ตัวแรกของคุณ
- [Data Sync Skills](https://tajo.io/th/docs/skills/data-sync) - สำรวจ Skills การซิงก์ข้อมูล
