openclaw-skills/python-performance/SKILL.md
Use when profiling Python code, reducing memory usage, optimizing hot paths, choosing concurrency patterns, or reviewing performance regressions in Python services and scripts.
npx skillsauth add seaworld008/commonly-used-high-value-skills python-performanceInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Python is an incredibly productive language, but it can be slow if not handled correctly. This skill provides a systematic approach to identifying bottlenecks, optimizing memory usage, and choosing the right concurrency model.
在优化之前,必须先进行测量。
针对 I/O 密集型任务(网络请求、数据库操作、文件读写)。
当纯 Python 无法满足性能要求时。
dict 的哈希查找、set 的去重、deque 的高效双端队列。for 循环追加。python -m cProfile -s cumtime script.py
# 采样 30 秒并生成 svg 火焰图
py-spy record -o profile.svg --duration 30 --pid <PID>
import asyncio
import httpx
async def fetch_url(client, url):
response = await client.get(url)
return response.status_code
async def main(urls):
async with httpx.AsyncClient() as client:
tasks = [fetch_url(client, url) for url in urls]
results = await asyncio.gather(*tasks)
print(f"Finished {len(results)} requests")
if __name__ == "__main__":
urls = ["https://example.com" for _ in range(100)]
asyncio.run(main(urls))
from numba import jit
import numpy as np
@jit(nopython=True)
def sum_of_squares(arr):
res = 0
for i in range(len(arr)):
res += arr[i] ** 2
return res
data = np.random.rand(10_000_000)
# 第一次调用会有编译开销,后续飞快
print(sum_of_squares(data))
Generated by Skill Master - Professional Edition
tools
飞书审批:查询和处理审批待办/已办/实例,搜索可发起审批定义、查看定义详情并发起原生审批实例。当用户要处理审批任务、查看审批实例、搜索或发起审批时使用。审批待办不是飞书任务;非审批类待办走 lark-task。不负责创建审批定义;三方审批定义不走原生提单。
development
Use when a user needs reproducible repository sizing, language composition, file counts, or code-versus-comment ratios with pygount; record exclusions and verify measurement scope before interpreting results.
development
Route a development task to the official Hermes Agent skill, Graphify Codex artifact set, Open GSD Core bundle, or optional GSD Pi bundle without duplicating their installers or state machines.
development
飞书 / Lark 通讯录:按姓名 / 邮箱解析成 open_id,或按 open_id 反查姓名 / 部门 / 邮箱 / 联系方式 / 个人状态 / 签名,以及按关键词搜索当前用户可见的机器人 / 智能体(agent)。当用户提到一个名字要下一步发消息 / 排日程,或拿到 open_id 想查具体信息时使用。不负责部门树遍历、按部门列员工、组织架构图,这类需求走原生 OpenAPI。