### Install Skill Repository (Bash) Source: https://context7.com/xiaohui-zhangxh/skills/llms.txt This section provides three methods for installing the skills repository: user-level symbolic linking (recommended for multi-project use), project-level usage, and direct copying into the project. It ensures skills are accessible by Cursor IDE. ```bash # Method 1: User-level symbolic link (recommended, shared across projects) git clone https://github.com/your-username/xiaohui-skills.git ~/xiaohui-skills mkdir -p ~/.cursor/skills ln -sfn ~/xiaohui-skills/skills/wechat-bot-notification ~/.cursor/skills/wechat-bot-notification # Update skills cd ~/xiaohui-skills && git pull # Method 2: Project-level usage (current project only) git clone https://github.com/your-username/xiaohui-skills.git .cursor/skills-repo ln -sfn .cursor/skills-repo/skills/wechat-bot-notification .cursor/skills/wechat-bot-notification # Method 3: Direct copy to project cp -r .cursor/skills-repo/skills/wechat-bot-notification .cursor/skills/ ``` -------------------------------- ### Create New Skill Structure (Bash) Source: https://context7.com/xiaohui-zhangxh/skills/llms.txt This snippet demonstrates how to create the necessary directory structure and the mandatory SKILL.md file for a new AI agent skill. The SKILL.md file defines the skill's metadata, rules, and usage scenarios. ```bash # Create skill directory structure mkdir -p skills/my-new-skill # Create SKILL.md file (required) cat > skills/my-new-skill/SKILL.md << 'EOF' --- name: my-new-skill description: A brief description of the skill's purpose and trigger scenarios, for Agent auto-selection license: MIT compatibility: macOS, Linux disable-model-invocation: false --- # Skill Name ## Rule Description A detailed description of the skill's execution rules and limitations. ## Applicable Scenarios - Scenario 1: Describe when to use this skill - Scenario 2: Describe another usage scenario ## Execution Steps 1. Step one 2. Step two 3. Step three EOF # Optional: Create scripts, resource directories mkdir -p skills/my-new-skill/scripts mkdir -p skills/my-new-skill/references mkdir -p skills/my-new-skill/assets ``` -------------------------------- ### Configure Environment Variables (Bash) Source: https://context7.com/xiaohui-zhangxh/skills/llms.txt This code illustrates how to configure environment variables required by skills, specifically the WECHAT_BOT_TOKEN for enterprise WeChat notifications. It shows methods for project-level, user-level, and direct environment variable export. ```bash # Create configuration directory mkdir -p .config/skills/envs # Configure enterprise WeChat bot Token (project-level) echo "your_webhook_token_here" > .config/skills/envs/WECHAT_BOT_TOKEN # Or configure user-level Token (system-wide) mkdir -p ~/.config/skills/envs echo "your_webhook_token_here" > ~/.config/skills/envs/WECHAT_BOT_TOKEN # Or use environment variable export WECHAT_BOT_TOKEN="your_webhook_token_here" ``` -------------------------------- ### 配置企业微信机器人Token Source: https://github.com/xiaohui-zhangxh/skills/blob/main/skills/wechat-bot-notification/SKILL.md 提供了通过环境变量、项目配置文件或用户配置文件设置Token的命令行方法。 ```bash export WECHAT_BOT_TOKEN="your_webhook_token_here" ``` ```bash mkdir -p .config/skills/envs && echo "your_webhook_token_here" > .config/skills/envs/WECHAT_BOT_TOKEN ``` ```bash mkdir -p ~/.config/skills/envs && echo "your_webhook_token_here" > ~/.config/skills/envs/WECHAT_BOT_TOKEN ``` -------------------------------- ### Read Token Configuration with Priority (Bash) Source: https://context7.com/xiaohui-zhangxh/skills/llms.txt This bash script defines a function `get_wechat_token` that reads the WECHAT_BOT_TOKEN with a specific priority: environment variable first, then project configuration file, and finally user configuration file. It returns the token or an empty string if not found. ```bash #!/bin/bash # Read WECHAT_BOT_TOKEN with priority get_wechat_token() { # Priority 1: Environment variable if [ -n "$WECHAT_BOT_TOKEN" ]; then echo "$WECHAT_BOT_TOKEN" return 0 fi # Priority 2: Project configuration file local project_config=".config/skills/envs/WECHAT_BOT_TOKEN" if [ -f "$project_config" ]; then token=$(head -n 1 "$project_config" | xargs) if [ -n "$token" ]; then echo "$token" return 0 fi fi # Priority 3: User configuration file local user_config="$HOME/.config/skills/envs/WECHAT_BOT_TOKEN" if [ -f "$user_config" ]; then token=$(head -n 1 "$user_config" | xargs) if [ -n "$token" ]; then echo "$token" return 0 fi fi # Token not found echo "" return 1 } # Usage example TOKEN=$(get_wechat_token) if [ -n "$TOKEN" ]; then WEBHOOK_URL="https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=${TOKEN}" echo "Webhook URL: $WEBHOOK_URL" else echo "Warning: WECHAT_BOT_TOKEN not configured, skipping send" fi ``` -------------------------------- ### 企业微信机器人消息请求数据格式 Source: https://github.com/xiaohui-zhangxh/skills/blob/main/skills/wechat-bot-notification/SKILL.md 展示了发送给企业微信机器人Webhook的JSON请求体结构,支持Markdown和文本两种格式。 ```json { "msgtype": "markdown", "markdown": { "content": "# 今日工作日报\n\n**日期**:2025-11-28\n\n..." } } ``` ```json { "msgtype": "text", "text": { "content": "今日工作日报\n\n日期:2025-11-28\n\n...", "mentioned_list": ["@all"] } } ``` -------------------------------- ### POST /cgi-bin/webhook/send Source: https://context7.com/xiaohui-zhangxh/skills/llms.txt Sends a Markdown-formatted message to an Enterprise WeChat group using a webhook key. ```APIDOC ## POST /cgi-bin/webhook/send ### Description Sends a message to an Enterprise WeChat group. The message can be formatted in Markdown or plain text. The webhook URL requires a valid key parameter. ### Method POST ### Endpoint https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key={WECHAT_BOT_TOKEN} ### Parameters #### Query Parameters - **key** (string) - Required - The unique webhook token for the group bot. #### Request Body - **msgtype** (string) - Required - The type of message, either 'markdown' or 'text'. - **markdown** (object) - Optional - Required if msgtype is 'markdown'. Contains the 'content' field with markdown text. - **text** (object) - Optional - Required if msgtype is 'text'. Contains 'content' and optional 'mentioned_list'. ### Request Example { "msgtype": "markdown", "markdown": { "content": "# Daily Report\n\n**Date**: 2025-11-28\n\n## Highlights\n- Completed Task A" } } ### Response #### Success Response (200) - **errcode** (integer) - 0 indicates success. - **errmsg** (string) - 'ok' indicates success. #### Response Example { "errcode": 0, "errmsg": "ok" } ``` -------------------------------- ### Send Enterprise WeChat Notification (Bash) Source: https://context7.com/xiaohui-zhangxh/skills/llms.txt This snippet shows how to send a Markdown-formatted daily report to an enterprise WeChat group using the Webhook API. It constructs the webhook URL using the WECHAT_BOT_TOKEN and sends a POST request with the message content. ```bash # Send Markdown formatted daily report to enterprise WeChat group # Token priority: Environment variable -> Project config -> User config WEBHOOK_URL="https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=${WECHAT_BOT_TOKEN}" curl -X POST "${WEBHOOK_URL}" \ -H "Content-Type: application/json" \ -d '{ "msgtype": "markdown", "markdown": { "content": "# Today's Daily Report\n\n**Date**: 2025-11-28\n\n## Work Review\n- Completed Feature A development\n- Fixed Bug B\n- Code Review PR #123\n\n## Tomorrow's Plan\n- Continue developing Feature C\n- Write unit tests" } }' # Expected response (success) # {"errcode":0,"errmsg":"ok"} # Send text message (alternative, supports @all) curl -X POST "${WEBHOOK_URL}" \ -H "Content-Type: application/json" \ -d '{ "msgtype": "text", "text": { "content": "Today's Daily Report\n\nDate: 2025-11-28\n\nCompleted: Feature A development", "mentioned_list": ["@all"] } }' ``` -------------------------------- ### POST /cgi-bin/webhook/send Source: https://github.com/xiaohui-zhangxh/skills/blob/main/skills/wechat-bot-notification/SKILL.md Sends messages to an Enterprise WeChat group using a webhook. Supports Markdown and text message formats. ```APIDOC ## POST /cgi-bin/webhook/send ### Description Sends messages to an Enterprise WeChat group via a webhook. This endpoint supports both Markdown and plain text message formats. ### Method POST ### Endpoint https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=YOUR_KEY ### Parameters #### Path Parameters - **key** (string) - Required - The unique key for your webhook. #### Request Body - **msgtype** (string) - Required - Specifies the message type. Can be 'markdown' or 'text'. - **markdown** (object) - Required if msgtype is 'markdown' - Contains the Markdown message content. - **content** (string) - Required - The Markdown formatted message content. - **text** (object) - Required if msgtype is 'text' - Contains the text message content. - **content** (string) - Required - The plain text message content. - **mentioned_list** (array) - Optional - A list of user IDs to mention (e.g., ["@all"]). - **mentioned_mobile_list** (array) - Optional - A list of mobile numbers to mention. ### Request Example ```json { "msgtype": "markdown", "markdown": { "content": "# Daily Report\n\n**Status:** All systems operational.\n\n- Task 1 completed.\n- Task 2 in progress." } } ``` ### Response #### Success Response (200) - **errcode** (integer) - 0 for success. - **errmsg** (string) - "ok" for success. #### Response Example ```json { "errcode": 0, "errmsg": "ok" } ``` ### Message Length Limits - **Markdown messages**: Maximum 4096 characters. - **Text messages**: Maximum 2048 characters. If content exceeds limits, truncate or send in multiple messages. ### Sending Frequency Limits - Each robot can send a maximum of 20 messages per minute. - Exceeding the limit requires waiting or batch sending. ``` -------------------------------- ### WeChat Bot Notification API Source: https://github.com/xiaohui-zhangxh/skills/blob/main/skills/wechat-bot-notification/SKILL.md This section details the process of sending notifications via the WeChat Bot, including token retrieval, message formatting, and the strict user-initiated sending protocol. ```APIDOC ## WeChat Bot Daily Notification Rules ### ⚠️ Strict Limitations - **No Proactive Sending**: The WeChat Bot cannot proactively send notifications. It can only remind users that the notification feature is available. - **User-Initiated**: Notifications are only sent when the user explicitly commands it (e.g., "Send daily report to WeChat"). - **Avoid Message Chaos**: Strict adherence to these rules prevents message clutter in WeChat groups. ### Token Configuration and Priority The bot token is read with the following priority: 1. **Environment Variable**: `WECHAT_BOT_TOKEN` 2. **Project Configuration**: `.config/skills/envs/WECHAT_BOT_TOKEN` (in the workspace root) 3. **User Configuration**: `~/.config/skills/envs/WECHAT_BOT_TOKEN` ### Token Configuration Methods **Method 1: Environment Variable** ```bash export WECHAT_BOT_TOKEN="your_webhook_token_here" ``` **Method 2: Project Configuration File** (Not committed to Git) - Path: `.config/skills/envs/WECHAT_BOT_TOKEN` - Content: Plain text, first line is the token (trimmed). ```bash mkdir -p .config/skills/envs && echo "your_webhook_token_here" > .config/skills/envs/WECHAT_BOT_TOKEN ``` **Method 3: User Configuration File** (System-wide) - Path: `~/.config/skills/envs/WECHAT_BOT_TOKEN` - Content: Same as project configuration. ```bash mkdir -p ~/.config/skills/envs && echo "your_webhook_token_here" > ~/.config/skills/envs/WECHAT_BOT_TOKEN ``` ### Execution Flow **Step 1: Get Token** - The system attempts to retrieve the token based on the priority order (Environment Variable > Project Config > User Config). - If a token is found, a Webhook URL is constructed: `https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key={token}`. - If no token is found, the sending step is skipped. **Step 2: Format Daily Report Content** - Extract today's report content. - Format the content using Markdown (recommended) or plain text. **Step 3: Remind User (Do Not Send Actively)** - After generating and committing the report, remind the user: "You can use the WeChat notification feature to send the daily report." - **Crucially, do not ask**: "Do you want to send today's report to WeChat?" - **Wait for explicit user command**. **Step 4: Send Message to WeChat Group (Only Upon User Command)** - **This step is executed ONLY after the user explicitly commands it.** - **Request Body Example (Markdown)**: ```json { "msgtype": "markdown", "markdown": { "content": "# Today's Daily Report\n\n**Date**: 2025-11-28\n\n..." } } ``` - **Request Body Example (Text)**: ```json { "msgtype": "text", "text": { "content": "Today's Daily Report\n\nDate: 2025-11-28\n\n...", "mentioned_list": ["@all"] // Optional: @everyone } } ``` - Send an HTTP POST request to the Webhook URL with `Content-Type: application/json`. **Step 5: Error Handling** - Configuration file not found: Skip sending, optionally log a warning. - Incomplete configuration: Log a warning, skip sending. - Network request failure: Log an error, do not interrupt the main report generation process. ### Key Rules Summary - **Strictly No Proactive Sending**. - **Remind users, do not ask**. - **Wait for explicit user commands**. - **Avoid message chaos**. - **Optional feature**: Does not interrupt core functionality if unavailable or fails. - **Error Handling**: All errors should be caught gracefully. - **Message Format**: Fixed to Markdown. - **Message Length**: Max 4096 characters; truncate or paginate if necessary. - **Send Frequency**: Adhere to WeChat's rate limits (max 20 messages/min). - **Token Priority**: Env Var > Project Config > User Config. ``` -------------------------------- ### Define WeChat Work Markdown Message Payload Source: https://github.com/xiaohui-zhangxh/skills/blob/main/skills/wechat-bot-notification/SKILL.md JSON structure for sending formatted Markdown messages to a WeChat Work bot. It supports headers, bold text, and lists within the content field. ```json { "msgtype": "markdown", "markdown": { "content": "# 标题\n\n**加粗**\n\n- 列表项1\n- 列表项2" } } ``` -------------------------------- ### Define WeChat Work Text Message Payload Source: https://github.com/xiaohui-zhangxh/skills/blob/main/skills/wechat-bot-notification/SKILL.md JSON structure for sending plain text messages to a WeChat Work bot, including support for mentions. ```json { "msgtype": "text", "text": { "content": "消息内容", "mentioned_list": ["@all"], "mentioned_mobile_list": [] } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.