重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
docstring by pipecat-ai/pipecat
npx skills add https://github.com/pipecat-ai/pipecat --skill docstring按照项目规范,使用 Google 风格文档字符串记录 Python 模块或类。参数可以是类名或模块路径。
如果提供了模块路径(例如 src/pipecat/audio/vad/vad_analyzer.py):
* 直接使用该文件
如果提供了类名(例如 VADAnalyzer):
* 在 `src/pipecat/` 中搜索 `class ClassName`
* 如果多个文件包含该类名,则列出所有匹配项及其文件路径,询问用户要记录哪一个,并等待确认
2. 一旦文件被识别,读取模块以了解其结构:
* 识别所有类、函数和重要的类型别名
* 理解每个组件的用途
3. 按此顺序应用文档:
* 模块文档字符串(顶部,导入之后)
* 类文档字符串
* `__init__` 方法(始终记录构造函数参数)
* 公共方法(不以 `_` 开头)
* 具有字段描述的数据类/配置类
4. 跳过以下内容的文档:
* 私有方法(以 `_` 开头)
* 简单的双下划线方法(`__str__`、`__repr__`、`__post_init__`)
* 非常简单的直通属性
* **已记录代码** - 如果一个类、方法或函数已经有一个遵循项目风格的完整文档字符串,则不要修改它。一个文档字符串是完整的,如果它有:
* 一行摘要
* 参数部分(如果有参数)
* 返回部分(如果返回有意义的内容)
* 仅在文档缺失或不完整时添加或改进文档
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
"""[模块用途的一行描述]。
[可选:功能、关键类或用例的更长解释。]
"""
示例:
"""Neuphonic 文本转语音服务实现。
此模块提供基于 WebSocket 和 HTTP 的 Neuphonic 文本转语音 API 集成,用于实时音频合成。
"""
class ClassName:
"""描述类功能的一行摘要。
[解释目的、行为和关键特性的更长描述。
使用面向行动的语言。]
[可选:事件处理程序、使用说明或重要注意事项。]
"""
示例:
class FrameProcessor(BaseObject):
"""管道中所有帧处理器的基类。
帧处理器是 Pipecat 管道的构建块,它们可以链接起来形成复杂的处理管道。它们接收帧,处理它们,并将它们传递给链中的下一个或上一个处理器。
可用的事件处理程序:
- on_before_process_frame: 在处理帧之前调用
- on_after_process_frame: 在处理帧之后调用
示例::
@processor.event_handler("on_before_process_frame")
async def on_before_process_frame(processor, frame):
...
@processor.event_handler("on_after_process_frame")
async def on_after_process_frame(processor, frame):
...
"""
注意:列出事件处理程序时,请勿使用反引号。包含一个 示例:: 部分(使用双冒号用于 Sphinx),展示每个事件的装饰器模式和函数签名。
__init__) 格式def __init__(self, *, param1: Type, param2: Type = default, **kwargs):
"""初始化 [ClassName]。
参数:
param1: param1 的描述及其用途。
param2: param2 的描述。默认为 [default]。
**kwargs: 传递给父类的附加参数。
"""
示例:
def __init__(
self,
*,
api_key: str,
voice_id: Optional[str] = None,
sample_rate: Optional[int] = 22050,
**kwargs,
):
"""初始化 Neuphonic TTS 服务。
参数:
api_key: 用于身份验证的 Neuphonic API 密钥。
voice_id: 用于合成的语音 ID。
sample_rate: 音频采样率,单位为 Hz。默认为 22050。
**kwargs: 传递给父类 InterruptibleTTSService 的附加参数。
"""
async def method_name(self, param1: Type) -> ReturnType:
"""方法功能的一行摘要。
[如果行为不明显,提供更长描述。]
参数:
param1: param1 的描述。
返回:
返回值的描述。
抛出:
ExceptionType: 当引发此异常时。
"""
示例:
async def put(self, item: Tuple[Frame, FrameDirection, FrameCallback]):
"""将一个项目放入优先队列。
系统帧(`SystemFrame`)的优先级高于任何其他帧。如果提供了非帧项目,它将具有最高优先级。
参数:
item: 要入队的项目。
"""
@dataclass
class ConfigName:
"""配置的一行描述。
[关于何时/如何使用此配置的说明。]
参数:
field1: field1 的描述。
field2: field2 的描述。默认为 [default]。
"""
field1: Type
field2: Type = default_value
示例:
@dataclass
class FrameProcessorSetup:
"""帧处理器初始化的配置参数。
参数:
clock: 用于计时操作的时钟实例。
task_manager: 用于处理异步操作的任务管理器。
observer: 用于监控帧处理事件的可选观察者。
"""
clock: BaseClock
task_manager: BaseTaskManager
observer: Optional[BaseObserver] = None
class EnumName(Enum):
"""枚举用途的一行描述。
[关于如何使用枚举的更长描述。]
参数:
VALUE1: VALUE1 的描述。
VALUE2: VALUE2 的描述。
"""
VALUE1 = 1
VALUE2 = 2
好:"用于身份验证的 Neuphonic API 密钥。" 差:"str: 用于与 Neuphonic 进行身份验证的 API 密钥(字符串)。"
好:"当 VADAnalyzer 检测到语音时触发 on_speech_started。" 差:"当 VADAnalyzer 检测到语音时触发 on_speech_started。"
记录已弃用的代码时:
"""[描述]。
.. deprecated:: X.X.X
`ClassName` 已弃用,将在未来版本中移除。
请改用 `NewClassName`。
"""
完成前,请验证:
__init__ 方法都记录了它们的参数_ 开头)添加文档每周安装量
49
仓库
GitHub 星标
10.8K
首次出现
2026 年 1 月 25 日
安全审计
安装于
opencode47
codex46
cursor46
gemini-cli45
github-copilot45
amp44
Document a Python module or class using Google-style docstrings following project conventions. The argument can be a class name or a module path.
If a module path is provided (e.g. src/pipecat/audio/vad/vad_analyzer.py):
* Use that file directly
If a class name is provided (e.g. VADAnalyzer):
* Search for `class ClassName` in `src/pipecat/`
* If multiple files contain that class name, list all matches with their file paths, ask the user which one they want to document, and wait for confirmation
2. Once the file is identified, read the module to understand its structure:
* Identify all classes, functions, and important type aliases
* Understand the purpose of each component
3. Apply documentation in this order:
* Module docstring (at top, after imports)
* Class docstrings
* `__init__` methods (always document constructor parameters)
* Public methods (not starting with `_`)
* Dataclass/config classes with field descriptions
4. Skip documentation for:
* Private methods (starting with `_`)
* Simple dunder methods (`__str__`, `__repr__`, `__post_init__`)
* Very simple pass-through properties
* **Already documented code** \- If a class, method, or function already has a complete docstring that follows the project style, do not modify it. A docstring is complete if it has:
* A one-line summary
* Args section (if it has parameters)
* Returns section (if it returns something meaningful)
* Only add or improve documentation where it is missing or incomplete
"""[One-line description of module purpose].
[Optional: Longer explanation of functionality, key classes, or use cases.]
"""
Example:
"""Neuphonic text-to-speech service implementations.
This module provides WebSocket and HTTP-based integrations with Neuphonic's
text-to-speech API for real-time audio synthesis.
"""
class ClassName:
"""One-line summary describing what the class does.
[Longer description explaining purpose, behavior, and key features.
Use action-oriented language.]
[Optional: Event handlers, usage notes, or important caveats.]
"""
Example:
class FrameProcessor(BaseObject):
"""Base class for all frame processors in the pipeline.
Frame processors are the building blocks of Pipecat pipelines, they can be
linked to form complex processing pipelines. They receive frames, process
them, and pass them to the next or previous processor in the chain.
Event handlers available:
- on_before_process_frame: Called before a frame is processed
- on_after_process_frame: Called after a frame is processed
Example::
@processor.event_handler("on_before_process_frame")
async def on_before_process_frame(processor, frame):
...
@processor.event_handler("on_after_process_frame")
async def on_after_process_frame(processor, frame):
...
"""
Note: When listing event handlers, do NOT use backticks. Include an Example:: section (with double colon for Sphinx) showing the decorator pattern and function signature for each event.
__init__) Formatdef __init__(self, *, param1: Type, param2: Type = default, **kwargs):
"""Initialize the [ClassName].
Args:
param1: Description of param1 and its purpose.
param2: Description of param2. Defaults to [default].
**kwargs: Additional arguments passed to parent class.
"""
Example:
def __init__(
self,
*,
api_key: str,
voice_id: Optional[str] = None,
sample_rate: Optional[int] = 22050,
**kwargs,
):
"""Initialize the Neuphonic TTS service.
Args:
api_key: Neuphonic API key for authentication.
voice_id: ID of the voice to use for synthesis.
sample_rate: Audio sample rate in Hz. Defaults to 22050.
**kwargs: Additional arguments passed to parent InterruptibleTTSService.
"""
async def method_name(self, param1: Type) -> ReturnType:
"""One-line summary of what method does.
[Longer description if behavior isn't obvious.]
Args:
param1: Description of param1.
Returns:
Description of return value.
Raises:
ExceptionType: When this exception is raised.
"""
Example:
async def put(self, item: Tuple[Frame, FrameDirection, FrameCallback]):
"""Put an item into the priority queue.
System frames (`SystemFrame`) have higher priority than any other
frames. If a non-frame item is provided it will have the highest priority.
Args:
item: The item to enqueue.
"""
@dataclass
class ConfigName:
"""One-line description of configuration.
[Explanation of when/how to use this config.]
Parameters:
field1: Description of field1.
field2: Description of field2. Defaults to [default].
"""
field1: Type
field2: Type = default_value
Example:
@dataclass
class FrameProcessorSetup:
"""Configuration parameters for frame processor initialization.
Parameters:
clock: The clock instance for timing operations.
task_manager: The task manager for handling async operations.
observer: Optional observer for monitoring frame processing events.
"""
clock: BaseClock
task_manager: BaseTaskManager
observer: Optional[BaseObserver] = None
class EnumName(Enum):
"""One-line description of the enum purpose.
[Longer description of how the enum is used.]
Parameters:
VALUE1: Description of VALUE1.
VALUE2: Description of VALUE2.
"""
VALUE1 = 1
VALUE2 = 2
Good: "Neuphonic API key for authentication." Bad: "str: The API key (string) that is used for authenticating with Neuphonic."
Good: "Triggers on_speech_started when the VADAnalyzer detects speech." Bad: "Triggers on_speech_started when the VADAnalyzer detects speech."
When documenting deprecated code:
"""[Description].
.. deprecated:: X.X.X
`ClassName` is deprecated and will be removed in a future version.
Use `NewClassName` instead.
"""
Before finishing, verify:
__init__ methods document their parameters_)Weekly Installs
49
Repository
GitHub Stars
10.8K
First Seen
Jan 25, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode47
codex46
cursor46
gemini-cli45
github-copilot45
amp44
Android 整洁架构指南:模块化设计、依赖注入与数据层实现
1,600 周安装
LiteParse 本地文档解析工具 - 快速解析PDF/DOCX/PPTX/XLSX/图像,无需云依赖
811 周安装
DeepWiki MCP 服务器:AI 驱动的 GitHub 仓库文档搜索与问答工具
814 周安装
社交媒体营销专家指南:Instagram、TikTok、LinkedIn平台策略与内容创作优化
833 周安装
钉钉消息发送技能指南:Webhook机器人、企业应用、工作通知、sessionWebhook全解析
804 周安装
OpenAI Skill Creator 指南:创建高效技能模块,扩展AI代理能力
832 周安装
uni-app跨平台开发框架:基于Vue.js一键发布iOS、Android、小程序和Web应用
819 周安装