Write docstrings for PyTorch functions and methods following PyTorch conventions. Use when writing or updating docstrings in PyTorch code.
The docstring skill provides a structured approach to writing documentation for functions and methods in the PyTorch project, adhering to established conventions. This skill addresses the need for consistent and clear documentation in code, which is crucial for user comprehension and effective collaboration among developers. By following the specified guidelines, users can ensure that their docstrings are not only informative but also formatted correctly for easy readability and integration into the PyTorch documentation system.
Main features of this skill include the use of raw strings for LaTeX compatibility, adherence to Sphinx/reStructuredText formatting, and the inclusion of comprehensive sections such as function signatures, descriptions, mathematical formulas, cross-references, notes, and warnings. The structured format promotes clarity and completeness, making it easier for developers to understand the purpose and usage of functions while also providing necessary context and examples. This skill is particularly valuable for contributors to the PyTorch project who are writing or updating code documentation, ensuring that all essential information is communicated effectively.
Target users of this skill include PyTorch developers, contributors, and technical writers who are involved in documenting functions and methods within the PyTorch framework. By utilizing this skill, users can enhance the quality of documentation, making it more accessible for other developers and users of the library, ultimately contributing to a better understanding of the capabilities of PyTorch.
Follow the structured guidelines provided for writing docstrings, ensuring to include all required sections.
This skill is tailored for PyTorch documentation, which is compatible with Python versions supported by PyTorch.
The skill focuses specifically on PyTorch conventions and may not apply to other Python projects or frameworks.
It's recommended to include examples whenever possible, but if not applicable, ensure that other sections are well-documented.
While the guidelines are specific to PyTorch, the general principles of clear documentation can be adapted for other projects.
Quick Setup:
.claude/skills/Repository
pytorch/pytorch