claude-to-im by op7418/claude-to-im-skill
npx skills add https://github.com/op7418/claude-to-im-skill --skill claude-to-im你正在管理 Claude-to-IM 桥接。用户数据存储在 ~/.claude-to-im/。
技能目录 (SKILL_DIR) 位于 ~/.claude/skills/claude-to-im。在 Codex 安装中,它可能在 ~/.codex/skills/Claude-to-IM-skill。如果两个路径都不存在,则回退到使用 Glob 模式 **/skills/**/claude-to-im/SKILL.md 或 **/skills/**/Claude-to-IM-skill/SKILL.md 并从中推导出根目录。
从 $ARGUMENTS 解析用户意图,匹配以下子命令之一:
| 用户输入 (示例) | 子命令 |
|---|---|
setup, , , , , |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
configure配置我想在飞书上用 Claude帮我连接 Telegram帮我接微信| setup |
start, start bridge, 启动, 启动桥接 | start |
stop, stop bridge, 停止, 停止桥接 | stop |
status, bridge status, 状态, 运行状态, 怎么看桥接的运行状态 | status |
logs, logs 200, 查看日志, 查看日志 200 | logs |
reconfigure, 修改配置, 帮我改一下 token, 换个 bot | reconfigure |
doctor, diagnose, 诊断, 挂了, 没反应了, bot 没反应, 出问题了 | doctor |
歧义消除:status vs doctor — 当用户只想检查桥接是否在运行时(信息性),使用 status。当用户报告问题或怀疑某些东西坏了(诊断性)时,使用 doctor。当不确定且用户描述了症状(例如,"没反应了","挂了")时,优先使用 doctor。
为 logs 提取可选的数字参数(默认 50)。
在向用户索要任何平台凭据之前,请先在内部阅读 SKILL_DIR/references/setup-guides.md,以便知道在哪里找到每个凭据。不要一开始就向用户倾倒整个指南——只提及他们需要做的具体下一步(例如,"前往 https://open.feishu.cn → 你的应用 → 凭证 以找到 App ID")。如果用户说他们不知道怎么做,则显示指南的相关部分。
在执行任何子命令之前,检测你正在哪个环境中运行:
AskUserQuestion 工具可用。使用它进行交互式设置向导。AskUserQuestion 不可用。回退到非交互式指导:解释步骤,显示 SKILL_DIR/config.env.example,并要求用户手动创建 ~/.claude-to-im/config.env。你可以通过检查 AskUserQuestion 是否在你的可用工具列表中来测试这一点。
start, stop, status, logs, reconfigure, doctor)在运行除 setup 之外的任何子命令之前,检查 ~/.claude-to-im/config.env 是否存在:
setup 向导。~/.claude-to-im/config.env:",然后显示 SKILL_DIR/config.env.example 的内容并停止。不要尝试启动守护进程——没有 config.env,进程会在启动时崩溃,并留下一个陈旧的 PID 文件,阻塞未来的启动。setup运行交互式设置向导。此子命令需要 AskUserQuestion。如果它不可用(Codex 环境),则改为显示 SKILL_DIR/config.env.example 的内容,并逐字段解释,指导用户手动创建配置文件。
当 AskUserQuestion 可用时,一次收集一个字段的输入。在每次回答后,向用户确认值(仅显示秘密的最后 4 个字符),然后再移动到下一个问题。
步骤 1 — 选择通道
询问启用哪些通道 (telegram, discord, feishu, qq, weixin)。接受逗号分隔的输入。简要描述每个:
/perm ... 命令。/perm ... 命令或快速 1/2/3 回复。语音消息仅使用微信自带的语音转文字;桥接本身不转录原始语音音频。步骤 2 — 按通道收集令牌
对于每个启用的通道,一次收集一个凭据。用一句话告诉用户在哪里可以找到每个值。只有当用户请求帮助或说他们不知道怎么做时,才显示完整的指南部分(来自 SKILL_DIR/references/setup-guides.md):
/claude-to-im start,(E) 配置事件 (im.message.receive_v1) 和回调 (card.action.trigger) 并启用长连接模式,(F) 发布第二个版本 + 管理员批准。user_openid,不是 QQ 号码。如果用户还没有 openid,可以留空。cd SKILL_DIR && npm run weixin:login~/.claude-to-im/runtime/weixin-login.html 并尝试在本地浏览器中自动打开它。~/.claude-to-im/data/weixin-accounts.json。再次运行助手会替换之前关联的账户。CTI_WEIXIN_MEDIA_ENABLED 仅控制入站图片/文件/视频下载。对于语音消息,桥接只接受微信内置语音转文字返回的文本。如果微信不提供转录文本,桥接会回复错误,而不是下载/转录原始音频。步骤 3 — 通用设置
询问运行时、默认工作目录、模型和模式:
claude (默认), codex, auto
claude — 使用 Claude Code CLI + Claude Agent SDK(需要安装 claude CLI)codex — 使用 OpenAI Codex SDK(需要 codex CLI;通过 codex auth login 或 OPENAI_API_KEY 认证)auto — 先尝试 Claude,如果未找到 Claude CLI 则回退到 Codex$CWDcode (默认), plan, ask步骤 4 — 写入配置并验证
mkdir -p ~/.claude-to-im/{data,logs,runtime,data/messages}~/.claude-to-im/config.env,所有设置采用 KEY=VALUE 格式chmod 600 ~/.claude-to-im/config.envSKILL_DIR/references/token-validation.md 获取每个平台的确切命令和预期响应。这可以在用户尝试启动守护进程之前捕获拼写错误和错误的凭据。对于 Weixin,成功的二维码登录已经算作验证。/claude-to-im start 来启动桥接。"start预检查: 验证 ~/.claude-to-im/config.env 存在(参见上面的"配置检查")。没有它,守护进程将立即崩溃并留下一个陈旧的 PID 文件。
运行:bash "SKILL_DIR/scripts/daemon.sh" start
向用户显示输出。如果失败,告诉用户:
doctor 进行诊断:/claude-to-im doctor/claude-to-im logsstop运行:bash "SKILL_DIR/scripts/daemon.sh" stop
status运行:bash "SKILL_DIR/scripts/daemon.sh" status
logs从参数中提取可选的行数 N(默认 50)。运行:bash "SKILL_DIR/scripts/daemon.sh" logs N
reconfigure~/.claude-to-im/config.env 读取当前配置SKILL_DIR/references/setup-guides.md 中的完整指南/claude-to-im stop 然后 /claude-to-im start 以应用更改。"如果用户想在 reconfigure 期间切换微信账户,再次运行 cd SKILL_DIR && npm run weixin:login。每次成功扫描都会替换之前关联的本地账户。
doctor运行:bash "SKILL_DIR/scripts/doctor.sh"
显示结果,并为任何失败项建议修复方法。常见修复:
cd SKILL_DIR && npm installcd SKILL_DIR && npm run buildsetupcd SKILL_DIR && npm run weixin:login对于更复杂的问题(消息未接收、权限超时、高内存、陈旧的 PID 文件),请阅读 SKILL_DIR/references/troubleshooting.md 获取详细的诊断步骤。
飞书升级说明: 如果用户从该技能的旧版本升级,并且飞书返回权限错误(例如,流式卡片不工作、输入指示器失败、权限按钮无响应),根本原因几乎肯定是飞书后端缺少权限或回调。请用户参考 SKILL_DIR/references/setup-guides.md 中的"从先前版本升级"部分——他们需要添加新的权限范围 (cardkit:card:write, cardkit:card:read, im:message:update, im:message.reactions:read, im:message.reactions:write_only),添加 card.action.trigger 回调,并重新发布应用。升级需要两个发布周期,因为添加回调需要一个活跃的 WebSocket 连接(桥接必须正在运行)。
~/.claude-to-im/config.env 中——跨会话保留。每周安装数
2.8K
仓库
GitHub 星标
1.6K
首次出现
2026年3月5日
安全审计
安装于
codex2.7K
opencode2.7K
gemini-cli2.6K
github-copilot2.6K
amp2.6K
kimi-cli2.6K
You are managing the Claude-to-IM bridge. User data is stored at ~/.claude-to-im/.
The skill directory (SKILL_DIR) is at ~/.claude/skills/claude-to-im. In Codex installs it may instead be ~/.codex/skills/Claude-to-IM-skill. If neither path exists, fall back to Glob with pattern **/skills/**/claude-to-im/SKILL.md or **/skills/**/Claude-to-IM-skill/SKILL.md and derive the root from the result.
Parse the user's intent from $ARGUMENTS into one of these subcommands:
| User says (examples) | Subcommand |
|---|---|
setup, configure, 配置, 我想在飞书上用 Claude, 帮我连接 Telegram, 帮我接微信 | setup |
start, start bridge, 启动, 启动桥接 | start |
stop, stop bridge, 停止, 停止桥接 | stop |
status, bridge status, 状态, 运行状态, 怎么看桥接的运行状态 | status |
logs, logs 200, 查看日志, 查看日志 200 | logs |
reconfigure, 修改配置, 帮我改一下 token, 换个 bot | reconfigure |
doctor, diagnose, 诊断, 挂了, 没反应了, bot 没反应, 出问题了 | doctor |
Disambiguation:status vs doctor — Use status when the user just wants to check if the bridge is running (informational). Use doctor when the user reports a problem or suspects something is broken (diagnostic). When in doubt and the user describes a symptom (e.g., "没反应了", "挂了"), prefer doctor.
Extract optional numeric argument for logs (default 50).
Before asking users for any platform credentials, read SKILL_DIR/references/setup-guides.md internally so you know where to find each credential. Do NOT dump the full guide to the user upfront — only mention the specific next step they need to do (e.g., "Go to https://open.feishu.cn → your app → Credentials to find the App ID"). If the user says they don't know how, then show the relevant section of the guide.
Before executing any subcommand, detect which environment you are running in:
AskUserQuestion tool is available. Use it for interactive setup wizards.AskUserQuestion is NOT available. Fall back to non-interactive guidance: explain the steps, show SKILL_DIR/config.env.example, and ask the user to create ~/.claude-to-im/config.env manually.You can test this by checking if AskUserQuestion is in your available tools list.
start, stop, status, logs, reconfigure, doctor)Before running any subcommand other than setup, check if ~/.claude-to-im/config.env exists:
setup wizard using AskUserQuestion.~/.claude-to-im/config.env based on the example:" then show the contents of SKILL_DIR/config.env.example and stop. Don't attempt to start the daemon — without config.env the process will crash on startup and leave behind a stale PID file that blocks future starts.setupRun an interactive setup wizard. This subcommand requires AskUserQuestion. If it is not available (Codex environment), instead show the contents of SKILL_DIR/config.env.example with field-by-field explanations and instruct the user to create the config file manually.
When AskUserQuestion IS available, collect input one field at a time. After each answer, confirm the value back to the user (masking secrets to last 4 chars only) before moving to the next question.
Step 1 — Choose channels
Ask which channels to enable (telegram, discord, feishu, qq, weixin). Accept comma-separated input. Briefly describe each:
/perm ... commands./perm ... commands or quick 1/2/3 replies. Voice messages only use WeChat's own speech-to-text text; raw voice audio is not transcribed by the bridge.Step 2 — Collect tokens per channel
For each enabled channel, collect one credential at a time. Tell the user where to find each value in one sentence. Only show the full guide section (from SKILL_DIR/references/setup-guides.md) if the user asks for help or says they don't know how:
/claude-to-im start, (E) configure events (im.message.receive_v1) and callback (card.action.trigger) with long connection mode, (F) publish second version + admin approve.Step 3 — General settings
Ask for runtime, default working directory, model, and mode:
claude (default), codex, auto
claude — uses Claude Code CLI + Claude Agent SDK (requires claude CLI installed)codex — uses OpenAI Codex SDK (requires codex CLI; auth via codex auth login or OPENAI_API_KEY)auto — tries Claude first, falls back to Codex if Claude CLI not foundStep 4 — Write config and validate
mkdir -p ~/.claude-to-im/{data,logs,runtime,data/messages}~/.claude-to-im/config.env with all settings in KEY=VALUE formatchmod 600 ~/.claude-to-im/config.envSKILL_DIR/references/token-validation.md for the exact commands and expected responses for each platform. This catches typos and wrong credentials before the user tries to start the daemon. For Weixin, a successful QR login already counts as validation./claude-to-im start to start the bridge."startPre-check: Verify ~/.claude-to-im/config.env exists (see "Config check" above). Without it, the daemon will crash immediately and leave a stale PID file.
Run: bash "SKILL_DIR/scripts/daemon.sh" start
Show the output to the user. If it fails, tell the user:
doctor to diagnose: /claude-to-im doctor/claude-to-im logsstopRun: bash "SKILL_DIR/scripts/daemon.sh" stop
statusRun: bash "SKILL_DIR/scripts/daemon.sh" status
logsExtract optional line count N from arguments (default 50). Run: bash "SKILL_DIR/scripts/daemon.sh" logs N
reconfigure~/.claude-to-im/config.envSKILL_DIR/references/setup-guides.md if they ask for help/claude-to-im stop then /claude-to-im start to apply the changes."If the user wants to switch Weixin accounts during reconfigure, run cd SKILL_DIR && npm run weixin:login again. Each successful scan replaces the previously linked local account.
doctorRun: bash "SKILL_DIR/scripts/doctor.sh"
Show results and suggest fixes for any failures. Common fixes:
cd SKILL_DIR && npm installcd SKILL_DIR && npm run buildsetupcd SKILL_DIR && npm run weixin:loginFor more complex issues (messages not received, permission timeouts, high memory, stale PID files), read SKILL_DIR/references/troubleshooting.md for detailed diagnosis steps.
Feishu upgrade note: If the user upgraded from an older version of this skill and Feishu is returning permission errors (e.g. streaming cards not working, typing indicators failing, permission buttons unresponsive), the root cause is almost certainly missing permissions or callbacks in the Feishu backend. Refer the user to the "Upgrading from a previous version" section in SKILL_DIR/references/setup-guides.md — they need to add new scopes (cardkit:card:write, cardkit:card:read, im:message:update, im:message.reactions:read, im:message.reactions:write_only), add the card.action.trigger callback, and re-publish the app. The upgrade requires two publish cycles because adding the callback needs an active WebSocket connection (bridge must be running).
~/.claude-to-im/config.env — survives across sessions.Weekly Installs
2.8K
Repository
GitHub Stars
1.6K
First Seen
Mar 5, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykFail
Installed on
codex2.7K
opencode2.7K
gemini-cli2.6K
github-copilot2.6K
amp2.6K
kimi-cli2.6K
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
102,200 周安装
user_openid, NOT QQ number. If the user doesn't have openid yet, they can leave it empty.cd SKILL_DIR && npm run weixin:login~/.claude-to-im/runtime/weixin-login.html and tries to open it automatically in the local browser.~/.claude-to-im/data/weixin-accounts.json. Running the helper again replaces the previously linked account.CTI_WEIXIN_MEDIA_ENABLED only controls inbound image/file/video downloads. For voice messages, the bridge only accepts the text returned by WeChat's built-in speech-to-text. If WeChat does not provide a transcript, the bridge replies with an error instead of downloading/transcribing raw audio.$CWDcode (default), plan, ask