Communitygithub.com

SamuelChien/mega-skills-collection

為 AI 代理提供電子郵件基礎設施。透過 AgentMail API 建立帳戶、收發電子郵件、管理 Webhook 以及檢查 Karma 餘額。

mega-skills-collection 是什麼?

AgentMail 技能為 AI 代理提供完整的電子郵件基礎設施,賦予它們真實的電子郵件地址(@theagentmail.net)以及一個 REST API。代理可以透過此技能收發電子郵件、註冊各項服務(如 GitHub、AWS、Slack)並接收驗證碼,使其在自動化流程中能像人類一樣進行電子郵件通訊。此技能尤為適合需要真實收件匣與寄件匣來完成註冊、驗證流程或交易通訊的情境。它能與 Claude Code、Cursor 以及 Codex 等代理平台順利整合。此技能也包含一個獨特的 Karma 系統,用於管理用量、防止垃圾郵件,並保護共享網域的信譽。其運作方式是透過一系列 REST API 端點來管理帳戶、電子郵件、Webhook 以及 Karma 餘額,並提供一個 TypeScript SDK 以簡化整合。Karma 系統會對每項行動(如發送郵件或建立帳戶)賦予成本與獎勵,若不監控餘額,則在 Karma 耗盡時可能導致 HTTP 402 錯誤。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/SamuelChien/mega-skills-collection/tree/HEAD/agentmail

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

AgentMail — 為 AI 代理打造的電子郵件服務

AgentMail 為 AI 代理提供真實的電子郵件地址(@theagentmail.net)以及一個 REST API。代理可以收發電子郵件、註冊服務(GitHub、AWS、Slack 等),並取得驗證碼。Karma 系統可以防止垃圾郵件,並維護共享網域的良好信譽。

基礎 URL:https://api.theagentmail.net

使用時機

  • AI 代理需要一個真實的收件匣/寄件匣來進行註冊、驗證流程或交易通訊。
  • 您需要配置 AgentMail 帳戶、發送訊息、讀取收件匣內容,或註冊入站 Webhook。
  • 您需要監控 Karma 使用情況,或將電子郵件事件整合到代理自動化流程中。

快速入門

所有請求都需要在標頭中包含 Authorization: Bearer am_...(從儀表板取得的 API 金鑰)。

建立電子郵件帳戶(-10 Karma)

curl -X POST https://api.theagentmail.net/v1/accounts \
  -H "Authorization: Bearer am_..." \
  -H "Content-Type: application/json" \
  -d '{"address": "[email protected]"}'

回應:{"data": {"id": "...", "address": "[email protected]", "displayName": null, "createdAt": 123}}

發送電子郵件(-1 Karma)

curl -X POST https://api.theagentmail.net/v1/accounts/{accountId}/messages \
  -H "Authorization: Bearer am_..." \
  -H "Content-Type: application/json" \
  -d '{
    "to": ["[email protected]"],
    "subject": "Hello from my agent",
    "text": "Plain text body",
    "html": "<p>Optional HTML body</p>"
  }'

可選欄位:cc、bcc(字串陣列)、inReplyTo、references(用於回覆線索的字串)、attachments({filename, contentType, content} 的陣列,其中 content 為 base64 編碼)。

讀取收件匣

# 列出訊息
curl https://api.theagentmail.net/v1/accounts/{accountId}/messages \
  -H "Authorization: Bearer am_..."

# 取得完整訊息(包含正文和附件)
curl https://api.theagentmail.net/v1/accounts/{accountId}/messages/{messageId} \
  -H "Authorization: Bearer am_..."

檢查 Karma

curl https://api.theagentmail.net/v1/karma \
  -H "Authorization: Bearer am_..."

回應:{"data": {"balance": 90, "events": [...]}}

註冊 Webhook(即時入站通知)

curl -X POST https://api.theagentmail.net/v1/accounts/{accountId}/webhooks \
  -H "Authorization: Bearer am_..." \
  -H "Content-Type: application/json" \
  -d '{"url": "https://my-agent.example.com/inbox"}'

Webhook 傳遞包含兩個安全標頭:

  • X-AgentMail-Signature -- 以 Webhook 密鑰簽署的請求主體 HMAC-SHA256 十六進位摘要
  • X-AgentMail-Timestamp -- 傳遞送出的毫秒時間戳

驗證簽名,並拒絕時間戳超過 5 分鐘的請求,以防止重放攻擊:

import { createHmac } from "crypto";

const verifyWebhook = (body: string, signature: string, timestamp: string, secret: string) => {
  if (Date.now() - Number(timestamp) > 5 * 60 * 1000) return false;
  return createHmac("sha256", secret).update(body).digest("hex") === signature;
};

下載附件

curl https://api.theagentmail.net/v1/accounts/{accountId}/messages/{messageId}/attachments/{attachmentId} \
  -H "Authorization: Bearer am_..."

回應:{"data": {"url": "https://signed-download-url..."}}

完整 API 參考

方法路徑描述Karma
POST/v1/accounts建立電子郵件帳戶-10
GET/v1/accounts列出所有帳戶
GET/v1/accounts/:id取得帳戶詳細資訊
DELETE/v1/accounts/:id刪除帳戶+10
POST/v1/accounts/:id/messages發送電子郵件-1
GET/v1/accounts/:id/messages列出訊息
GET/v1/accounts/:id/messages/:msgId取得完整訊息
GET/v1/accounts/:id/messages/:msgId/attachments/:attId取得附件 URL
POST/v1/accounts/:id/webhooks註冊 Webhook
GET/v1/accounts/:id/webhooks列出 Webhook
DELETE/v1/accounts/:id/webhooks/:whId刪除 Webhook
GET/v1/karma取得餘額 + 事件

Karma 系統

每個動作都有對應的 Karma 成本或獎勵:

事件Karma原因
money_paid+100購買額度
email_received+2有人從受信任的網域回覆
account_deleted+10刪除地址時退還 Karma
email_sent-1發送郵件消耗 Karma
account_created-10建立地址消耗 Karma

重要規則:

  • 僅有來自受信任提供者(Gmail、Outlook、Yahoo、iCloud、ProtonMail、Fastmail、Hey 等)的入站電子郵件才能獲得 Karma。來自未知/一次性網域的郵件不會獲得 Karma。
  • 在代理回覆之前,您每個寄件者只能獲得一次 Karma。如果寄件者 X 在沒有回覆的情況下給您發了 5 封郵件,只有第一封能獲得 Karma。回覆 X 後,來自 X 的下一封郵件才能再次獲得 Karma。
  • 刪除帳戶會退還建立時花費的 10 點 Karma。

當 Karma 達到 0 時,發送郵件和建立帳戶的操作會返回 HTTP 402。在執行消耗 Karma 的操作前,請務必檢查餘額。

TypeScript SDK

import { createClient } from "@agentmail/sdk";

const mail = createClient({ apiKey: "am_..." });

// 建立帳戶
const account = await mail.accounts.create({
  address: "[email protected]",
});

// 發送電子郵件
await mail.messages.send(account.id, {
  to: ["[email protected]"],
  subject: "Hello",
  text: "Sent by an AI agent.",
});

// 讀取收件匣
const messages = await mail.messages.list(account.id);
const detail = await mail.messages.get(account.id, messages[0].id);

// 附件
const att = await mail.attachments.getUrl(accountId, messageId, attachmentId);
// att.url 是一個簽署過的下載 URL

// Webhook
await mail.webhooks.create(account.id, {
  url: "https://my-agent.example.com/inbox",
});

// Karma
const karma = await mail.karma.getBalance();
console.log(karma.balance);

錯誤處理

import { AgentMailError } from "@agentmail/sdk";

try {
  await mail.messages.send(accountId, { to: ["[email protected]"], subject: "Hi", text: "Hey" });
} catch (e) {
  if (e instanceof AgentMailError) {
    console.log(e.status);   // 402, 404, 401, 等
    console.log(e.code);     // "INSUFFICIENT_KARMA", "NOT_FOUND", 等
    console.log(e.message);
  }
}

常見模式

註冊服務並讀取驗證郵件

const account = await mail.accounts.create({
  address: "[email protected]",
});

// 使用該地址註冊(瀏覽器自動化、API 等)

// 輪詢驗證郵件
for (let i = 0; i < 30; i++) {
  const messages = await mail.messages.list(account.id);
  const verification = messages.find(m =>
    m.subject.toLowerCase().includes("verify") ||
    m.subject.toLowerCase().includes("confirm")
  );
  if (verification) {
    const detail = await mail.messages.get(account.id, verification.id);
    // 從 detail.bodyText 或 detail.bodyHtml 解析驗證連結/驗證碼
    break;
  }
  await new Promise(r => setTimeout(r, 2000));
}

發送郵件並等待回覆

const sent = await mail.messages.send(account.id, {
  to: ["[email protected]"],
  subject: "Question about order #12345",
  text: "Can you check the status?",
});

for (let i = 0; i < 60; i++) {
  const messages = await mail.messages.list(account.id);
  const reply = messages.find(m =>
    m.direction === "inbound" && m.timestamp > sent.timestamp
  );
  if (reply) {
    const detail = await mail.messages.get(account.id, reply.id);
    // 處理回覆
    break;
  }
  await new Promise(r => setTimeout(r, 5000));
}

型別

type Account = { id: string; address: string; displayName: string | null; createdAt: number };
type Message = { id: string; from: string; to: string[]; subject: string; direction: "inbound" | "outbound"; status: string; timestamp: number };
type MessageDetail = Message & { cc: string[] | null; bcc: string[] | null; bodyText: string | null; bodyHtml: string | null; inReplyTo: string | null; references: string | null; attachments: AttachmentMeta[] };
type AttachmentMeta = { id: string; filename: string; contentType: string; size: number };
type KarmaBalance = { balance: number; events: KarmaEvent[] };
type KarmaEvent = { id: string; type: string; amount: number; timestamp: number; metadata?: Record<string, unknown> };

限制

  • 僅在任務明確符合上述描述範圍時使用此技能。
  • 請勿將輸出視為環境特定驗證、測試或專家審查的替代品。
  • 如果缺少必要的輸入、權限、安全邊界或成功條件,請停止並要求澄清。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

SamuelChien/mega-skills-collection

Security audit, hardening, threat modeling (STRIDE/PASTA), Red/Blue Team, OWASP checks, code review, incident response, and infrastructure security for any project.

SamuelChien/mega-skills-collection

Arquitecto de Soluciones Principal y Consultor Tecnológico de Andru.ia. Diagnostica y traza la hoja de ruta óptima para proyectos de IA en español.

SamuelChien/mega-skills-collection

Ingeniero de Sistemas de Andru.ia. Diseña, redacta y despliega nuevas habilidades (skills) dentro del repositorio siguiendo el Estándar de Diamante.

SamuelChien/mega-skills-collection

Estratega de Inteligencia de Dominio de Andru.ia. Analiza el nicho específico de un proyecto para inyectar conocimientos, regulaciones y estándares únicos del sector. Actívalo tras definir el nicho.

SamuelChien/mega-skills-collection

2D game development principles. Sprites, tilemaps, physics, camera.

SamuelChien/mega-skills-collection

3D game development principles. Rendering, shaders, physics, cameras.

SamuelChien/mega-skills-collection

Expert in building 3D experiences for the web - Three.js, React Three Fiber, Spline, WebGL, and interactive 3D scenes. Covers product configurators, 3D portfolios, immersive websites, and bringing depth to web experiences.

SamuelChien/mega-skills-collection

Accessibility audit skill for scanning, fixing, and verifying WCAG 2.2 Level A and AA compliance across React, Next.js, Vue, Angular, Svelte, and plain HTML codebases. Use when auditing accessibility, fixing a11y violations, checking color contrast, generating compliance reports, or integrating accessibility checks into CI/CD pipelines.

SamuelChien/mega-skills-collection

Ab Test Analyzer - Auto-activating skill for Data Analytics. Triggers on: ab test analyzer, ab test analyzer Part of the Data Analytics skill category.

SamuelChien/mega-skills-collection

A B Test Config Creator - Auto-activating skill for ML Deployment. Triggers on: a b test config creator, a b test config creator Part of the ML Deployment skill category.

SamuelChien/mega-skills-collection

When the user wants to plan, design, or implement an A/B test or experiment. Also use when the user mentions "A/B test," "split test," "experiment," "test this change," "variant copy," "multivariate test," "hypothesis," "conversion experiment," "statistical significance," or "test this." For tracking implementation, see analytics-tracking.

SamuelChien/mega-skills-collection

Acceptance Criteria Creator - Auto-activating skill for Enterprise Workflows. Triggers on: acceptance criteria creator, acceptance criteria creator Part of the Enterprise Workflows skill category.

SamuelChien/mega-skills-collection

Use when a coding task should be driven end-to-end from issue intake through implementation, review, deployment, and acceptance verification with minimal human re-intervention.

SamuelChien/mega-skills-collection

Accessibility Audit Runner - Auto-activating skill for Frontend Development. Triggers on: accessibility audit runner, accessibility audit runner Part of the Frontend Development skill category.

SamuelChien/mega-skills-collection

You are an accessibility expert specializing in WCAG compliance, inclusive design, and assistive technology compatibility. Conduct audits, identify barriers, and provide remediation guidance.

SamuelChien/mega-skills-collection

Web accessibility patterns for WCAG 2.2 compliance including ARIA, keyboard navigation, screen readers, and testing

SamuelChien/mega-skills-collection

Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed, or change policy for the Discord channel.

SamuelChien/mega-skills-collection

Create unified specification packages across Business, Development, and Design teams. Staged elaboration (L0 Vision → L1 Requirements → L2 Team Detail → L3 Acceptance Criteria) to build shared understanding. Does not write code.

SamuelChien/mega-skills-collection

Research a company or person and get actionable sales intel. Works standalone with web search, supercharged when you connect enrichment tools or your CRM. Trigger with "research [company]", "look up [person]", "intel on [prospect]", "who is [name] at [company]", or "tell me about [company]".

SamuelChien/mega-skills-collection

Validate messaging consistency across website, GitHub repos, and local documentation generating read-only discrepancy reports. Use when checking content alignment or finding mixed messaging. Trigger with phrases like "check consistency", "validate documentation", or "audit messaging".

相關技能