协作头脑风暴
brainstorming
在实现前澄清需求、探索设计选择,并形成清晰的开发方向。
setup-notifications-via-wecom【开发与工程】Set up and send technical status notifications through WeCom (Enterprise WeChat) webhooks. Use this skill whenever the user needs to send notifications, alerts, backup completion reports, or status updates via WeCom; when they mention 企业微信, 企微机器人, webhook, or alerting; or when a message needs to be clear, unambiguous, and technically precise rather t…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
This skill helps you send clear, unambiguous technical notifications through a WeCom group bot webhook. Use the setup and sending workflows below:
The bundled script scripts/send_wecom.py handles the actual HTTP call, using the host network configuration. Recipient identity is explicit configuration:
self may send automatically; others requires human confirmation; missing identity fails fast.
When integrating an existing Alibaba Cloud SLS notification pipeline or a recurring digest, read the SLS adapter guide. Reuse the project's sampler, scheduler and SLS sync owner; the bundled sender continues to own ordinary plain-text sends.
Trigger this skill when the user:
Check existing config:
cat ~/.config/setup-notifications-via-wecom/config.json
If it exists and contains webhook_url, skip to Send a Message.
Get the webhook URL from the WeCom group bot settings. It looks like:
https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=YOUR_KEY
Store it privately (outside the skill bundle, so it survives updates):
mkdir -p ~/.config/setup-notifications-via-wecom
echo '{"webhook_url": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=YOUR_KEY"}' \
> ~/.config/setup-notifications-via-wecom/config.json
chmod 600 ~/.config/setup-notifications-via-wecom/config.json
Classify the exact target and bind the canonical sender without exposing or rewriting the webhook value:
uv run --no-project python scripts/set_recipient.py \
--scope self --label "My private self channel"
Use self only when the configured webhook is visible only to the user. Use
others for every other person or group. Do not guess when the target is unknown.
The command also records this sender's absolute path and digest; after the sender
is upgraded, rerun the command before sending again.
Test connectivity by sending a test message (run from the skill directory):
uv run --no-project python scripts/send_wecom.py --message "WeCom webhook test ✅"
If you see the message in the WeCom group, setup is done.
These rules come from real corrections. Apply them to every notification.
The first line must say what happened. Do not bury the conclusion.
Claude Code 备份同步完成 ✅
Never say "synced 1075 sessions" if only 13 were new today.
Every count must be accompanied by what it counts. Prefer:
- 源目录主 session:1075 个
- 备份主 session:2328 个
Avoid undefined terms like "session" alone — it may include workflow journals, subagent files, or tool outputs.
Prefer:
Avoid:
Do not include commit hashes, file paths, internal documentation references, or verbose explanations unless the user explicitly asks for them.
Use correct technical terms and define them. Do not translate everything into "大白话" simplifications that hide precision.
When the user asked "does it miss anything?", answer directly:
- 验证:0 缺失,0 滞后
Tell the user whether they need to do anything:
- 下一步:无需操作,下次自动同步 03:00
Use when a backup/sync job finishes and you need to report completeness.
Claude Code 备份同步完成 ✅
- 自动同步:今日 03:00 正常执行
- 本次手动同步:补充 03:00 后的增量
- 主 session:13 个
- 子代理/工具输出/工作流:230 个
- 合计:243 个文件
- 验证:0 缺失,0 滞后
- 当前状态:
- 源目录主 session:1075 个
- 备份主 session:2328 个
- 下一步:无需操作,下次自动同步 03:00
Use when something requires immediate action. Do not use this template for routine "all good" updates.
🚨 [P?] [服务/任务名] [症状]
- 影响:[谁/什么受影响,程度如何]
- 严重程度:[P1–P5 等级]
- 开始时间:[YYYY-MM-DD HH:MM TZ]
- 已采取:[正在做的动作]
- 下一步:[建议动作或预计下次更新时间]
- 相关链接:[dashboard/runbook,可选]
Rules:
Use for routine "all good" updates.
[任务名] 状态正常 ✅
- 检查时间:2026-06-24 03:00 CST
- 关键指标:
- 源目录主 session:1075 个
- 备份主 session:2328 个
- 本次变更:无
- 下一步:无需操作
Read recipient_scope and recipient_label before sending. A self target is
the user's own delivery channel and needs no authorization. An others target
is an external send: show the exact label and message and wait for the active
human-confirmation gate. Missing/invalid metadata is a configuration error, not
permission to guess.
Matching webhook URLs proves the same endpoint, not the recipient scope. If new
observations conflict with the stored self label, pause only that send and verify
the exact group and audience. A displayed member name alone does not prove a
different person's identity. Preserve normal automatic delivery for a confirmed
self binding; do not relabel a group or rewrite shared metadata to bypass the
confirmation boundary. For recurring delivery to others, confirmation must cover
the exact group, report content and schedule, plus any separately required deployment
approval.
uv run --no-project python scripts/send_wecom.py \
--message "你的消息内容"
For multiline messages, use a file:
cat > /tmp/wecom_msg.txt <<'EOF'
Claude Code 备份同步完成 ✅
- 验证:0 缺失,0 滞后
EOF
uv run --no-project python scripts/send_wecom.py \
--file /tmp/wecom_msg.txt
If you prefer not to use the script:
curl -s -X POST 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=YOUR_KEY' \
-H 'Content-Type: application/json' \
-d '{
"msgtype": "text",
"text": {
"content": "YOUR_MESSAGE"
}
}'
Network: Inherit the host/project HTTP(S) proxy and no_proxy policy. A required proxy must remain in use; do not infer a direct-connect requirement from the Tencent domain. Configure an HTTP(S) proxy explicitly when the host requires one: Python urllib does not implement generic SOCKS ALL_PROXY routing. On macOS, an empty proxy environment can still select the system proxy. For proxy selection, exceptions and HTTP-bypass versus TUN diagnosis, load tunnel-doctor and its proxy-conflict reference (proxy_conflict_reference.md, NO_PROXY section); inspect the sender process rather than clearing all proxies.
After upgrading the sender, refresh its configured digest using the existing
set_recipient.py workflow, preserving the same scope and label. Do not relabel
a group as self merely to pass the guard.
When a user asks "let my backup script send WeCom notifications", do the following:
self.others, obtain human confirmation; then call scripts/send_wecom.py.Use the existing bound sender and target; keep event identity and delivery state in the owning worker. For one automatic event, call send_message(..., max_attempts=1) or the supported guard-owned outbox path. The general manual-send retry default is not the worker's delivery policy.
Classify the parsed response before deciding whether a later attempt is permitted:
| Evidence | Worker outcome |
|---|---|
JSON object with integer errcode=0 | API accepted; receiver confirmation is a separate observation |
JSON object with nonzero integer errcode | Explicit API rejection |
Missing/null errcode, boolean, string, non-integer, invalid JSON, timeout or lost connection | Unknown; keep the event identity and do not automatically replay it |
For Python, test type(code) is int; isinstance(False, int) is true and False == 0 must not become acceptance. If the generic sender raises before returning a valid response, the owning worker keeps the result unknown. A new test must exercise a genuinely distinct event with an explicit test label, not rename or resubmit an ambiguous old event. Verify the actual scheduler/worker → event → sender → receipt path; a standalone bot call does not validate the background chain.
set_recipient.py.--message / --file sends retry transient errors up to 3 times. Guard-owned
automatic --outbox delivery makes exactly one HTTP attempt and requires the
guard-approved payload digest; a later run never sends a pre-existing payload.Connection closed or timeoutInspect the configured route without printing proxy credentials. Follow the host's approved direct/proxy policy and diagnose the failing connection on that route. Do not silently clear proxies, try another endpoint, or replay an ambiguous send.
Check the response body: HTTP 200 with nonzero errcode is failure. errcode=0 means API acceptance, not recipient receipt. Verify the intended group and message where receipt matters. A direct bot test cannot validate an SLS/other scheduler: exercise and inspect that native path separately within the authorized test count.
Run the setup step again. The script expects ~/.config/setup-notifications-via-wecom/config.json with a webhook_url field.
references/message_best_practices.md — condensed checklist distilled from this session's corrections.references/sls-recurring-notifications.md — read for SLS-backed recurring reports: result-size limits, evaluation dates, existing-owner reuse and native delivery acceptance.scripts/send_wecom.py — the sender script.scripts/set_recipient.py — atomically records self versus others plus the canonical sender path/digest without printing the webhook.