com um clique
python
Python 代码开发、审查和优化,遵循 Pythonic 风格和最佳实践
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Menu
Python 代码开发、审查和优化,遵循 Pythonic 风格和最佳实践
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Baseado na classificação ocupacional SOC
自动化浏览器交互,用于网页测试、表单填写、截图和数据提取。当用户需要浏览网站、与网页交互、填写表单、截取屏幕截图、测试 Web 应用程序或从网页提取信息时使用。
为后端代码(Express 路由、MongoDB 模型、Node 服务)生成测试时使用 - 分析文件类型,从 package.json 检测测试框架,生成包含设置/拆卸和边缘情况覆盖的全面测试
创建生产级 ChatKit 聊天机器人的指南,该机器人将 OpenAI Agents SDK 与 MCP 工具和自定义后端集成。在为任何应用程序构建具有专门功能、实时任务执行和用户隔离的 AI 驱动聊天机器人时使用。
当你发现当前可用的技能都不够合适(或用户明确要求你寻找技能)时使用。本技能会基于任务目标和约束,给出一份精简的候选技能清单,帮助你选出最适配当前任务的技能。
Translates English documents to Chinese with accurate semantics and grammar. Invoke when user asks to translate any English documentation or content to Chinese.
使用 OpenAI 和 Google API 进行 AI 图像生成。支持文生图、参考图片、宽高比和并行生成(推荐 4 个并发子代理)。当用户要求生成、创建或绘制图像时使用。
| name | Python 开发专家 |
| description | Python 代码开发、审查和优化,遵循 Pythonic 风格和最佳实践 |
my_module.py(小写+下划线)MyClass(大驼峰)my_function(小写+下划线)MAX_SIZE(全大写)_private_method(单下划线前缀)def greet(name: str, age: int) -> str:
return f"Hello {name}, you are {age} years old"
from typing import List, Dict, Optional
def process_items(items: List[str]) -> Dict[str, int]:
return {item: len(item) for item in items}
# 推荐
with open('file.txt', 'r') as f:
content = f.read()
# 推荐
squares = [x**2 for x in range(10)]
# 推荐(f-string)
message = f"Hello {name}, you are {age} years old"
try:
result = risky_operation()
except ValueError as e:
logger.error(f"Value error: {e}")
raise
except Exception as e:
logger.error(f"Unexpected error: {e}")
raise
# 推荐(内存高效)
def read_large_file(file_path):
with open(file_path, 'r') as f:
for line in f:
yield line.strip()
import functools
import time
def timer(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
start = time.time()
result = func(*args, **kwargs)
print(f"{func.__name__} took {time.time() - start:.2f}s")
return result
return wrapper
@timer
def slow_function():
time.sleep(1)
from dataclasses import dataclass
@dataclass
class User:
name: str
age: int
email: str = None
active: bool = True
# 推荐
total = sum(numbers)
maximum = max(numbers)
# 推荐
valid_ids = {1, 2, 3, 4, 5}
if user_id in valid_ids:
pass
# 推荐
result = ' '.join(['Hello', 'World', 'Python'])
# 错误
def add_item(item, items=[]):
items.append(item)
return items
# 正确
def add_item(item, items=None):
if items is None:
items = []
items.append(item)
return items
import copy
original = [[1, 2], [3, 4]]
shallow = original.copy() # 浅拷贝
deep = copy.deepcopy(original) # 深拷贝
## Python 代码报告
### 代码质量
- 规范性:[PEP 8 符合度]
- 类型注解:[是否使用]
### 发现的问题
1. **[问题类型]** - 第 X 行
- 问题:[描述]
- 建议:[修复方案]
### 优化后代码
[完整的 Python 代码]