Skip to main content

python

Python programming language advanced patterns

跳到安装

来源信息

仓库
NeuralBlitz/Agent-Gateway
最近来源活动
2026年4月9日 10:58
检测到的 SKILL.md 语言
英语
星标
1
分支
0

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
python
description
Python programming language advanced patterns
license
MIT
compatibility
opencode
metadata
{"audience":"developers","category":"programming"}
## What I do - Write idiomatic Python - Use type hints effectively - Implement async patterns - Use decorators properly - Handle generators - Use context managers - Write Pythonic code - Optimize Python performance ## When to use me When writing Python code. ## Python Patterns ```python from typing import TypeVar, Generic, Protocol from contextlib import contextmanager import asyncio T = TypeVar('T') # Generators for memory efficiency def process_large_file(filepath: str): with open(filepath) as f: for line in f: yield line.strip() # Context managers @contextmanager def database_transaction(): try: yield commit() except Exception: rollback() raise # Async patterns async def fetch_all(urls: list[str]) -> list[dict]: async with aiohttp.ClientSession() as session: tasks = [fetch(session, url) for url in urls] return await asyncio.gather(*tasks) # Protocol for duck typing class Database(Protocol): async def connect(self): ... async def query(self, sql: str): ... # Type hints from dataclasses import dataclass @dataclass(frozen=True) class User: id: int name: str email: str ```
在 GitHub 查看