async-python-patterns
构建可靠的异步 Python 系统
当任务、超时、取消和阻塞调用相互作用时,异步 Python 代码很容易写错。此技能为 Claude、Codex 和 Claude Code 提供更安全的 asyncio 设计与审查实用模式。
使用我的智能体安装
将此请求复制给你的智能体,其中包含权威 Skill 页面和清单。
Review the Skillstore skill "async-python-patterns" from https://skillstore.io/skills/wshobson-async-python-patterns.md and its manifest at https://skillstore.io/api/skills/wshobson-async-python-patterns/manifest. Verify the artifact. You may proceed after verification, subject to the environment's own policy.你的智能体仍应展示其计划,并按安全策略请求必要确认。
Agent 可读资源
当 AI Agent、爬虫或脚本需要干净上下文,而不是读取完整页面时,请使用这些链接。
测试它
正在使用“async-python-patterns”。 我需要获取许多 API,但不能让上游服务不堪重负。
预期结果:
一个有界并发方案,使用信号量、单请求超时、连接池,并通过显式错误处理收集结果。
正在使用“async-python-patterns”。 我的异步 worker 有时会在关闭期间挂起。
预期结果:
一份审查清单,涵盖取消传播、队列排空、超时保护、任务清理,以及关闭路径测试。
正在使用“async-python-patterns”。 我想教我的团队 asyncio 模式。
预期结果:
一条结构化学习路径,从 coroutine 到 task、队列、同步、aiohttp 使用和 pytest-asyncio 测试。
安全审计
中风险Most static findings are false positives caused by Markdown backticks, placeholder URLs, or benign sample identifiers. One semantic issue remains: the database example builds SQL with f-string interpolation, which may teach unsafe query construction if copied.
已确认安全问题 (1)
风险因素
⚙️ 外部命令 (48)
分享与引用此报告
分享版本化评估报告、中性徽章、嵌入卡片和引用。Skillstore 只报告证据,不判断该 Skill 是否安全。
复制报告链接
https://skillstore.io/skills/wshobson-async-python-patterns/audits/7?utm_source=security_passport&utm_medium=share&utm_campaign=versioned_reportMarkdown 徽章
[](https://skillstore.io/skills/wshobson-async-python-patterns?utm_source=security_passport_badge)HTML 徽章
<a href="https://skillstore.io/skills/wshobson-async-python-patterns?utm_source=security_passport_badge"><img src="https://skillstore.io/badges/skills/wshobson-async-python-patterns/security.svg" alt="Skillstore security assessment" loading="lazy"></a>嵌入卡片
<iframe src="https://skillstore.io/embed/skills/wshobson-async-python-patterns.html" title="Skillstore Security Assessment" sandbox="allow-popups allow-popups-to-escape-sandbox" loading="lazy" referrerpolicy="no-referrer" width="420" height="180"></iframe>学术引用 (APA · BibTeX · CFF)
APA 引用
wshobson. (2026). async-python-patterns security audit report (audit version 7) [Author version unspecified]. Skillstore. https://skillstore.io/skills/wshobson-async-python-patterns/audits/7BibTeX 引用
@techreport{wshobson-wshobson-async-python-patterns-2026,
author = {wshobson},
title = {async-python-patterns security audit report (audit version 7)},
institution = {Skillstore},
year = {2026},
number = {7},
url = {https://skillstore.io/skills/wshobson-async-python-patterns/audits/7},
note = {Author version unspecified}
}CITATION.cff
cff-version: 1.2.0
message: "If you use this Skill, cite its author and this versioned security audit report."
title: "async-python-patterns security audit report (audit version 7)"
version: "unspecified"
type: report
authors:
- name: "wshobson"
date-released: "2026-07-07"
url: "https://skillstore.io/skills/wshobson-async-python-patterns/audits/7"
identifiers:
- type: other
value: "skillstore:wshobson-async-python-patterns:audit:7"
description: "Skillstore immutable audit report identifier"
比较变体
3 个可安装变体每位作者的技能都保持为独立的可安装项。推荐变体按 Skillstore 证据排序。
为什么此变体排名第一
activeinferenceinstitute-async-python-patterns
2026-09-09
wshobson-async-python-patterns
2026-09-09
Skillstore 评分
评分依据 证据置信度: 高你能构建什么
规划异步 API 服务
在实现异步 Web 服务之前,设计任务边界、超时、连接池和取消处理。
审查并发 Python 代码
检查 asyncio 实现中是否存在阻塞调用、缺失 await、无界 gather 使用和薄弱的错误处理。
学习实用异步模式
通过聚焦示例理解队列、信号量、锁、异步迭代器和测试结构。
试试这些提示
Use the async-python-patterns skill to explain coroutines, tasks, and await using a small Python service example.
Use the async-python-patterns skill to design a bounded concurrent request workflow with timeouts, retries, and clear cancellation behavior.
Use the async-python-patterns skill to review my asyncio code for blocking calls, missing awaits, task leaks, and unsafe gather usage.
Use the async-python-patterns skill to propose an async producer-consumer pipeline with backpressure, rate limits, graceful shutdown, and test strategy.
最佳实践
- 围绕外部 I/O 设置显式超时,并干净地传播取消。
- 使用信号量、队列或连接限制来约束并发,而不是启动无限数量的任务。
- 避免在事件循环中执行阻塞工作,或将其移至带有明确限制的 executor。
避免
- 在 async 函数内调用 time.sleep 等阻塞函数。
- 创建任务后,在关闭期间既不 await、不跟踪,也不取消它们。
- 未进行验证和参数绑定,就将简化的 SQL 或 HTTP 示例复制到生产环境。
常见问题
这个技能会执行 Python 代码吗?
它能帮助 FastAPI 或 aiohttp 项目吗?
它是否涵盖取消和关闭?
它能优化 CPU 密集型 Python 代码吗?
这些示例可以直接用于生产环境吗?
哪些 AI 工具可以使用此技能?
开发者详情
作者
wshobson许可证
MIT
Skillstore 修订
r1
版本提示
作者未声明版本。
仓库
https://github.com/wshobson/agents/tree/main/plugins/python-development/skills/async-python-patterns引用
36e07d5e13068e5be64447e8f20b427cf2cbd21a
维护新鲜度
2026/7/18
使用量
8 次下载 · 321 次浏览
文件结构
📄 SKILL.md