Communitygithub.com

V4TIME/V4SKILL

透過 macOS 的 Messages.app,使用 imsg CLI 讀取與傳送 iMessage/SMS 訊息。

V4SKILL 是什麼?

這個技能讓 AI 代理(例如 Claude Code、Cursor 或 Codex)能夠直接透過 macOS 上的 Messages.app 讀取和傳送 iMessage 與 SMS 簡訊。它使用 Homebrew 安裝的 `imsg` 命令列工具來管理聊天記錄、檢視歷史訊息、傳送包含附件的文字訊息,以及監控新訊息。對開發者而言,這項技能提供了在終端機中管理原生 Apple 訊息功能的強大自動化能力,無需離開開發環境即可與聯絡人互動。此技能支援 macOS 平台,並要求使用者授予終端機完整的磁碟存取權限,以及 Messages.app 的自動化權限。它包含內建的安全防護措施,例如在傳送訊息前要求確認收件人與內容、驗證附件檔案路徑,並避免大量傳送。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/V4TIME/V4SKILL/tree/HEAD/apple/imessage

在你喜歡的 AI 中提問

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

說明文件

iMessage

使用 imsg 透過 macOS 的 Messages.app 讀取與傳送 iMessage/SMS 訊息。

先決條件

  • macOS,並已登入 Messages.app
  • 安裝:brew install steipete/tap/imsg
  • 為終端機授予完整磁碟存取權限(系統設定 → 隱私權 → 完整磁碟存取權限)
  • 於提示時授予 Messages.app 自動化權限

使用時機

  • 使用者要求傳送 iMessage 或簡訊
  • 讀取 iMessage 對話記錄
  • 查看最近的 Messages.app 聊天
  • 傳送訊息至電話號碼或 Apple ID

不應使用時機

  • Telegram/Discord/Slack/WhatsApp 訊息 → 請使用對應的閘道頻道
  • 群組聊天管理(新增/移除成員)→ 不支援
  • 大量/群發訊息 → 務必先徵求使用者同意

快速參考

列出聊天記錄

imsg chats --limit 10 --json

查看歷史記錄

# 依聊天 ID
imsg history --chat-id 1 --limit 20 --json

# 包含附件資訊
imsg history --chat-id 1 --limit 20 --attachments --json

傳送訊息

# 僅文字
imsg send --to "+14155551212" --text "您好!"

# 含附件
imsg send --to "+14155551212" --text "看看這個" --file /path/to/image.jpg

# 強制使用 iMessage 或 SMS
imsg send --to "+14155551212" --text "嗨" --service imessage
imsg send --to "+14155551212" --text "嗨" --service sms

監控新訊息

imsg watch --chat-id 1 --attachments

服務選項

  • --service imessage — 強制使用 iMessage(需要收件人啟用 iMessage)
  • --service sms — 強制使用 SMS(綠色氣泡)
  • --service auto — 讓 Messages.app 自動決定(預設)

規則

  1. 在傳送前,務必確認收件人與訊息內容
  2. 未經使用者明確同意,切勿傳送給未知號碼
  3. 附加檔案前,請確認檔案路徑存在
  4. 請勿濫發訊息——請自行限制頻率

範例工作流程

使用者:「傳訊息給老媽說我會晚點到」

# 1. 找到老媽的聊天
imsg chats --limit 20 --json | jq '.[] | select(.displayName | contains("老媽"))'

# 2. 向使用者確認:「找到老媽,號碼為 +1555123456。透過 iMessage 傳送『我會晚點到』?」

# 3. 確認後傳送
imsg send --to "+1555123456" --text "我會晚點到"

Individual skills in this repo

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

相關技能