Skip to content
Agentmart
Submit a tool

python-best-practices

Comprehensive Python coding standards, type hints, testing patterns, and PEP 8 compliance for AI-assisted development.

Skill by yasinnerten

IndexedApache-2.0
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/yasinnerten-python-best-practices

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Comprehensive Python coding standards, type hints, testing patterns, and PEP 8 compliance for AI-assisted development.

Use cases: testing, security

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/python-best-practices

What's inside

Skill name
python-best-practices
Description
Comprehensive Python coding standards, type hints, testing patterns, and PEP 8 compliance for AI-assisted development.
License
Apache-2.0
Metadata
category: best-practices
Instructions
674 lines in SKILL.md · view on GitHub

Agent Skills spec issues

  • body: 674 lines (spec recommends under 500)

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Python Best Practices

This skill provides comprehensive guidance for writing clean, maintainable, and testable Python code, especially when working with AI-assisted development.

## Code Style and Formatting

### 1. PEP 8 Compliance
```python
# Use 4 spaces for indentation
def calculate_total(items):
    total = 0
    for item in items:
        total += item.value
    return total

# Line length: max 79 characters (soft), 88 (hard)
long_variable_name = "this_is_acceptable"  # 27 chars
acceptable_but_longer = "this_name_is_still_within_limits"  # 36 chars

# Import order: standard library → third party → local
import os  # standard library
import tempfile  # standard library
import openai  # third party
from .local_module import local_function  # local
```

### 2. Type Hints
```python
from typing import List, Dict, Optional, TypedDict, Union
from datetime import datetime

def process_data(
    items: List[Dict[str, Union[str, int]]],
    timestamp: Optional[datetime] = None
) -> List[str]:
    """Process data items and return results."""
    results = []
    for item in items:
        processed = str(item.get("value", 0))
        results.append(processed)

    return results

# TypedDict for structured data
class UserProfile(TypedDict):
    name: str
    age: int
    email: Optional[str]
```

### 3. Docstrings
```python
def complex_function(param1: str, param2: int) -> bool:
    """
    Perform complex calculation on input parameters.

    Args:
        param1: Description of first parameter
        param2: Description of second parameter

    Returns:
        bool: True if calculation succeeds, False otherwise

    Raises:
        ValueError: If param2 is negative

    Examples:
        >>> complex_function("test", 5)
        True
    """
    if param2 < 0:
        raise ValueError("param2 must be non-negative")

    return True
```

## Error Handling

### 1. Specific Exceptions
```python
class ValidationError(Exception):
    """Raised when input validation fails."""
    pass

class APIError(Exception):
    """Raised when API calls fail."""
    def __init__(self, message: str, status_code: int):
        super().__init__(message)
        self.status_code = status_code

def validate_input(data: dict) -> dict:
    if not isinstance(data, dict):
        raise ValidationError("Input must be a dictionary")

    if not data.get("required_field"):
        raise ValidationError("required_field is missing")

    return data
```

### 2. Context Managers
```python
from contextlib import contextmanager

@contextmanager
def database_connection():
    """Context manager for database connections."""
    conn = create_connection()

    try:
        yield conn
    finally:
        conn.close()

# Usage
with database_connection() as conn:
    result = conn.execute("SELECT * FROM users")
```

From yasinnerten/temporal-openai-agents-sdk, Apache-2.0.

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Feb 27, 2026 (8 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
Apache-2.0
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from yasinnerten

Cite this page

python-best-practices skill. Agent Mart. https://agentmart.dev/skills/yasinnerten-python-best-practices (last updated 2026-10-24)