Best use case
!/usr/bin/env python is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
# -*- coding: utf-8 -*-
Teams using !/usr/bin/env python should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/wechat-auto-send/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How !/usr/bin/env python Compares
| Feature / Agent | !/usr/bin/env python | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
# -*- coding: utf-8 -*-
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
Cursor vs Codex for AI Workflows
Compare Cursor and Codex for AI coding workflows, repository assistance, debugging, refactoring, and reusable developer skills.
AI Agents for Marketing
Discover AI agents for marketing workflows, from SEO and content production to campaign research, outreach, and analytics.
SKILL.md Source
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
微信自动发送消息 - 命令行参数版
技能版本:v1.0
创建时间:2026-03-18
"""
import pyautogui
import pygetwindow
import pyperclip
import time
import sys
import argparse
def setup_encoding():
"""尝试设置控制台编码"""
try:
import io
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
except:
pass
def check_dependencies():
"""检查依赖"""
try:
import pyautogui
import pygetwindow
import pyperclip
return True
except ImportError as e:
print(f"[错误] 缺少依赖: {e}")
print("请安装: pip install pyautogui pygetwindow pyperclip")
return False
def focus_wechat():
"""聚焦微信窗口"""
try:
wechat_windows = pygetwindow.getWindowsWithTitle('微信')
if wechat_windows:
window = wechat_windows[0]
if window.isMinimized:
window.restore()
window.activate()
time.sleep(1.5)
return True
else:
print("[错误] 未找到微信窗口,请确保微信已打开并可见")
return False
except Exception as e:
print(f"[警告] 聚焦窗口失败: {e}")
return True # 继续尝试
def send_to_contact(contact_name, message, wait_time=1.5):
"""发送消息给指定联系人"""
print(f"准备发送给: {contact_name}")
print(f"消息内容: {message}")
# 1. 复制联系人
pyperclip.copy(contact_name)
print(" [1] 已复制联系人")
time.sleep(0.5)
# 2. 打开搜索框
pyautogui.hotkey('ctrl', 'f')
print(" [2] 按 Ctrl+F 打开搜索框")
time.sleep(1.0)
# 3. 粘贴联系人
pyautogui.hotkey('ctrl', 'v')
print(" [3] 按 Ctrl+V 粘贴联系人")
time.sleep(0.8)
# 4. 按 Enter 选择
pyautogui.press('enter')
print(" [4] 按 Enter 进入聊天")
time.sleep(wait_time)
# 5. 复制消息
pyperclip.copy(message)
print(" [5] 已复制消息")
time.sleep(0.5)
# 6. 粘贴消息
pyautogui.hotkey('ctrl', 'v')
print(" [6] 按 Ctrl+V 粘贴消息")
time.sleep(0.5)
# 7. 发送消息
pyautogui.press('enter')
print(" [7] 按 Enter 发送")
time.sleep(1.0)
return True
def main():
# 设置编码
setup_encoding()
# 解析命令行参数
parser = argparse.ArgumentParser(
description='微信自动发送消息工具',
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog="""
示例:
%(prog)s "文件传输助手" "这是一条测试消息"
%(prog)s "张三" "会议改到下午3点" --wait 2 --countdown 3
"""
)
parser.add_argument('contact', help='联系人名称(备注或昵称)')
parser.add_argument('message', help='要发送的消息内容')
parser.add_argument('--wait', type=float, default=1.5,
help='操作等待时间(秒,默认1.5)')
parser.add_argument('--countdown', type=int, default=5,
help='开始前倒计时秒数(默认5)')
parser.add_argument('--verbose', action='store_true',
help='显示详细执行信息')
args = parser.parse_args()
print("=" * 60)
print("微信自动发送消息工具")
print("=" * 60)
# 检查依赖
if not check_dependencies():
return 1
if args.verbose:
print(f"\n配置信息:")
print(f" 联系人: {args.contact}")
print(f" 消息: {args.message}")
print(f" 等待时间: {args.wait}秒")
print(f" 倒计时: {args.countdown}秒")
print("\n[准备提示]")
print("1. 请确保微信已经打开并处于前台")
print("2. 确保可以看到微信主界面")
print("3. 脚本将在倒计时后开始执行")
print("4. 执行过程中请不要操作鼠标键盘")
print("5. 中断方法: 快速移动鼠标到屏幕左上角")
# 倒计时
print(f"\n倒计时 {args.countdown} 秒开始...")
for i in range(args.countdown, 0, -1):
print(f" {i}...")
time.sleep(1)
print("\n开始执行...")
try:
# 聚焦微信
if not focus_wechat():
print("[错误] 无法聚焦微信窗口")
return 1
# 发送消息
success = send_to_contact(args.contact, args.message, args.wait)
if success:
print("\n" + "=" * 60)
print("[成功] 消息发送完成!")
print("=" * 60)
return 0
else:
print("\n[失败] 消息发送失败")
return 1
except KeyboardInterrupt:
print("\n[用户中断] 脚本被中断")
return 1
except Exception as e:
print(f"\n[错误] 执行出错: {e}")
return 1
finally:
pyautogui.FAILSAFE = True
if __name__ == "__main__":
# 安全设置
pyautogui.FAILSAFE = True # 鼠标移到左上角可中断
pyautogui.PAUSE = 0.1 # 每个动作后暂停0.1秒
sys.exit(main())Related Skills
micropython-skills/sensor
MicroPython sensor reading — DHT11/22, BME280, MPU6050, ADC, ultrasonic HC-SR04, photoresistor, generic I2C sensors.
micropython-skills/network
MicroPython networking — WiFi STA/AP, HTTP requests, MQTT pub/sub, BLE, NTP time sync, WebSocket.
micropython-skills/diagnostic
MicroPython device diagnostics — system info, I2C/SPI bus scan, pin state, filesystem, memory, performance benchmarks.
micropython-skills/algorithm
MicroPython on-device algorithms — PID controller, moving average, Kalman filter, state machine, task scheduler, data logger.
micropython-skills/actuator
MicroPython actuator control — GPIO output, PWM (LED/servo/motor), stepper motor, WS2812 NeoPixel, buzzer.
micropython-skills
Program and interact with embedded development boards (ESP32, ESP32-S3, ESP32-C3, ESP8266, NodeMCU, Raspberry Pi Pico, RP2040, STM32) through real-time REPL. This skill turns microcontroller hardware into an AI-programmable co-processor — read sensors, control actuators, flash firmware, diagnose devices, and deploy algorithms. Trigger when the user mentions any dev board or hardware interaction: ESP32, ESP8266, NodeMCU, Pico, 开发板, 板子, 单片机, 嵌入式, microcontroller, development board, sensor reading, GPIO, LED, motor, relay, I2C, SPI, UART, ADC, PWM, servo, DHT, BME280, temperature sensor, 传感器, 读传感器, 控制电机, 继电器, flash firmware, 烧录, 刷固件, 刷机, mpremote, MicroPython, IoT, MQTT, WiFi on board, 设备没反应, device not responding, or any task involving programming or controlling a physical microcontroller board.
Telegram Shop Bot Developer - Python
I develop fully-featured Telegram shop bots using Python. My bots manage products, orders, and customers professionally.
python-code-review
Reviews Python code for type safety, async patterns, error handling, and common mistakes. Use when reviewing .py files, checking type hints, async/await usage, or exception handling.
pythongo
answer questions about pythongo code, docs, callbacks, errors, modules, functions, marketcenter, paramsmap, instrument_id, exchange, kline data, and strategy examples. use when the user asks about pythongo implementation, behavior, interfaces, usage, installation, faq, or wants pythongo code examples based on the bundled codebase, docs_indexed, docs_normalized, examples.md, and pyi reference markdown files.
bocha-search-python
博查搜索 (Bocha Search) 的 Python 实现技能,提供增强的网页搜索能力。当用户需要通过博查 AI 搜索 API 进行网页搜索、获取联网信息、查找最新资讯或中文内容时使用此技能。与现有的 JavaScript 版本相比,本技能提供更稳定的连接、更灵活的输出格式(原始 JSON/Brave 兼容格式/Markdown)、更好的错误处理和重试机制。适用于 AI Agent 需要联网搜索、RAG 应用获取网页摘要、中文内容检索等场景。
python
Python coding guidelines and best practices. Use when writing, reviewing, or refactoring Python code. Enforces PEP 8 style, syntax validation via py_compile, unit test execution, modern Python versions only (no EOL), uv for dependency management when available, and idiomatic Pythonic patterns.
strava-python
Query Strava activities, stats, and workout data using Python/stravalib with interactive setup