CopilotHub
SearchPromptsInstructionsAgentsToolsMCPs
  1. Home
  2. Instructions
  3. Python Docstring Standards
Back to Instructions

Python Docstring Standards

Applies to: *.py

Write clear and consistent Python docstrings

python
file
1 downloads
118 views
0

Tags

python
documentation
best-practices

Related Instructions

View all →

TypeScript Error Handling

*.ts

Comprehensive error handling patterns for TypeScript applications

typescript
typescript
error-handling
+1
0
101

React Component Best Practices

*.tsx

Guidelines for creating maintainable and performant React components

typescript
react
react
typescript
+2
0
119

WordPress Development — Copilot Instructions

Coding standards for wordpress.instructions

typescript
testing
security
+5
1
187

VueJS 3 Development Instructions

Coding standards for vuejs3.instructions

typescript
react
testing
security
+6
0
158

TypeScript MCP Server Development

Coding standards for typescript mcp server.instructions

typescript
express
testing
security
+5
0
128

TypeScript Development

These instructions assume projects are built with TypeScript 5.x (or newer) compiling to an ES2022 JavaScript baseline. Adjust guidance if your runtime requires older language targets or down-level transpilation.

typescript
express
testing
security
+6
0
144
Browse More Instructions

CopilotHub

A curated collection of prompts, instructions, agents, and tools for AI-powered development.

Quick Links

  • Prompts
  • Instructions
  • Agents
  • Tools
  • MCPs
  • Search

Browse by Category

  • Code Generation
  • Debugging
  • Documentation
  • Refactoring
  • Testing
  • Security

Legal

  • Guidelines
  • About
  • Privacy Policy
  • Terms of Service

Community

GitHub

© 2026 CopilotHub.

Python Docstring Standards

Function Docstrings

Use Google-style docstrings:

python
def calculate_average(numbers: list[float]) -> float:
    """Calculate the average of a list of numbers.
    
    Args:
        numbers: A list of numeric values.
        
    Returns:
        The arithmetic mean of the numbers.
        
    Raises:
        ValueError: If the list is empty.
        
    Example:
        >>> calculate_average([1, 2, 3, 4, 5])
        3.0
    """
    if not numbers:
        raise ValueError("Cannot calculate average of empty list")
    return sum(numbers) / len(numbers)

Class Docstrings

Document the purpose, attributes, and key methods.

Module Docstrings

Include a brief description of the module's purpose at the top of each file.