python-best-practices
Expert guidance for writing professional Python code following industry best practices including PEP 8 compliance, testing, type hints, error handling, and…
Skill by woernfl
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/woernfl-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.
About
Use cases: testing, security, writing
Reviews
Write a reviewNo 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
- Runs as
- Python package
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
- Expert guidance for writing professional Python code following industry best practices including PEP 8 compliance, testing, type hints, error handling, and modern tooling. Use this skill when writing new Python code, refactoring existing code, setting up Python projects, implementing tests, or ensuring code quality and maintainability. Emphasizes: PEP 8, modularity, DRY principle, TDD, virtual environments (uv), and modern tooling (Ruff, Black, Mypy).
- License
- MIT
- Instructions
- 797 lines in SKILL.md · view on GitHub
Before installing
- Ships executable scripts
Agent Skills spec issues
- allowed-tools: must be a space-separated string
- body: 797 lines (spec recommends under 500)
Files (7)
- QUICK_REFERENCE.md
- README.md
- SKILL.md
- error_handling.py · examples/
- project_structure.py · examples/
- testing_examples.py · examples/
- type_hints_demo.py · examples/
SKILL.md (first lines)
# Python Best Practices Skill
This skill provides expert guidance for writing professional, maintainable Python code that follows industry best practices and standards.
## When to Use This Skill
Use this skill when:
- Writing new Python functions, classes, or modules
- Refactoring existing Python code for better quality
- Setting up a new Python project with proper structure
- Implementing unit tests or adopting TDD
- Adding type hints for better code clarity
- Configuring linting, formatting, and type checking tools
- Managing dependencies and virtual environments
- Improving code readability and maintainability
- Following PEP 8 style guidelines
## Core Principles
### 1. PEP 8: Style Guide for Python Code
**Key Guidelines:**
- **Indentation**: Use 4 spaces per indentation level (never tabs)
- **Line Length**: Limit lines to 79 characters (99 for code, 72 for docstrings/comments)
- **Blank Lines**: 2 blank lines between top-level functions/classes, 1 within classes
- **Imports**:
- One import per line
- Order: standard library, third-party, local (each group separated by blank line)
- Avoid wildcard imports (`from module import *`)
- **Naming Conventions**:
- `snake_case` for functions, variables, methods
- `PascalCase` for classes
- `UPPER_CASE` for constants
- Leading underscore `_private` for internal use
- **Whitespace**:
- No trailing whitespace
- One space around operators: `x = 1`, not `x=1`
- No space before function parentheses: `func(x)`, not `func (x)`
**Example:**
```python
"""Module docstring describing purpose."""
import os
import sys
from pathlib import Path
import numpy as np
import pandas as pd
from mypackage.module import MyClass
# Constants
MAX_RETRIES = 3
DEFAULT_TIMEOUT = 30
class DataProcessor:
"""Process and analyze data sets.
Attributes:
name: Processor name
threshold: Minimum value threshold
"""
def __init__(self, name: str, threshold: float = 0.5):
"""Initialize processor.
Args:
name: Name of the processor
threshold: Threshold value for filtering (default: 0.5)
"""
self.name = name
self.threshold = threshold
def process_data(self, data: list[float]) -> list[float]:
"""Process data by filtering values below threshold.
Args:
data: List of numeric values to process
Returns:
Filtered list containing only values >= threshold
Raises:
ValueError: If data is empty
"""
if not data:
raise ValueError("Data cannot be empty")
return [x for x in data if x >= self.threshold]
```
### 2. Readability and Clarity
**Write Self-Documenting Code:**
```python
# Bad: unclear variable names
def calc(x, y, z):
return x * y / z
# Good: descriptive names
def calculate_unit_price(total_cost: float, quantity: int, tax_rate: float) -> float:
"""Calculate price per unit including tax."""
return total_cost * (1 + tax_rate) / quantity
```
**Use Docstrings:**
```python
def fetch_user_data(user_id: int, include_history: bool = False) -> dict:
"""Fetch user data from the database.
Args:
user_id: Unique identifier for the userFrom woernfl/ai-lab, MIT.
More from woernfl/ai-lab
- 0.566score
k8s-security-policies
woernfl
Implement Kubernetes security policies including NetworkPolicy, PodSecurityPolicy, and RBAC for production-grade security.
SkillAFreshness: AClaude Code +9 - 0.560score
k8s-manifest-generator
woernfl
Create production-ready Kubernetes manifests for Deployments, Services, ConfigMaps, and Secrets following best practices and security standards.
SkillAFreshness: AClaude Code +9 - 0.557score
python-ase
woernfl
Expert assistance with the Atomic Simulation Environment (ASE) Python library for atomistic simulations, including structure building, calculator setup…
SkillAFreshness: AClaude Code +9 - 0.548score
python-multiobjective-optimization
woernfl
Expert guidance for multiobjective optimization in Python - Pareto optimality, evolutionary algorithms (NSGA-II, NSGA-III, MOEA/D), scalarization methods…
SkillAFreshness: AClaude Code +9 - 0.548score
python-jax
woernfl
Expert guidance for JAX (Just After eXecution) - high-performance numerical computing with automatic differentiation, JIT compilation, vectorization, and…
SkillAFreshness: AClaude Code +9 - 0.524score
github-issue-enhancer
woernfl
Enhance GitHub issues with additional information, context, and structure to prepare them for autonomous agent processing.
SkillBFreshness: BClaude Code +9 - 0.474score
github-pr
woernfl
Commit staged or local changes, push the branch, then open a Pull Request on GitHub using the gh CLI.
SkillCFreshness: CClaude Code +9 - 0.474score
commit-push
woernfl
Stage current git changes, generate a Conventional Commit message, commit, and push safely to the remote.
SkillCFreshness: CClaude Code +9 - 0.474score
naming-convention
woernfl
Help the user choose, validate, or rename infrastructure resource names using a well known naming convention.
SkillCFreshness: CClaude Code +9 - 0.471score
kubernetes-architect
woernfl
Expert Kubernetes architect specializing in cloud-native infrastructure, advanced GitOps workflows (ArgoCD/Flux), and enterprise container orchestration.
SkillCFreshness: CClaude Code +9 - 0.471score
kubernetes-deployment
woernfl
Kubernetes deployment workflow for container orchestration, Helm charts, service mesh, and production-ready K8s configurations.
SkillCFreshness: CClaude Code +9 - 0.445score
clarify
woernfl
Interview the user relentlessly about a plan or design until reaching shared understanding, resolving each branch of the decision tree.
SkillCFreshness: CClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Oct 21, 2026 (8 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/woernfl/ai-lab
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from woernfl
- 0.566score
k8s-security-policies
woernfl
Implement Kubernetes security policies including NetworkPolicy, PodSecurityPolicy, and RBAC for production-grade security.
SkillAFreshness: AClaude Code +9 - 0.560score
k8s-manifest-generator
woernfl
Create production-ready Kubernetes manifests for Deployments, Services, ConfigMaps, and Secrets following best practices and security standards.
SkillAFreshness: AClaude Code +9 - 0.557score
python-ase
woernfl
Expert assistance with the Atomic Simulation Environment (ASE) Python library for atomistic simulations, including structure building, calculator setup…
SkillAFreshness: AClaude Code +9 - 0.548score
python-jax
woernfl
Expert guidance for JAX (Just After eXecution) - high-performance numerical computing with automatic differentiation, JIT compilation, vectorization, and…
SkillAFreshness: AClaude Code +9 - 0.548score
python-multiobjective-optimization
woernfl
Expert guidance for multiobjective optimization in Python - Pareto optimality, evolutionary algorithms (NSGA-II, NSGA-III, MOEA/D), scalarization methods…
SkillAFreshness: AClaude Code +9 - 0.524score
github-issue-enhancer
woernfl
Enhance GitHub issues with additional information, context, and structure to prepare them for autonomous agent processing.
SkillBFreshness: BClaude Code +9
Cite this page
python-best-practices skill. Agent Mart. https://agentmart.dev/skills/woernfl-python-best-practices (last updated 2026-10-24)