skills/coding-standards/SKILL.md
Python coding standards and best practices for AI coding agents
npx skillsauth add ludo-technologies/python-best-practices coding-standardsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
A comprehensive collection of Python coding standards and best practices. Designed for AI agents and LLMs to generate high-quality, performant, and maintainable Python code.
Apply Python optimization patterns to improve processing speed and memory efficiency.
| Rule | Description | |------|-------------| | perf-list-comprehension | Prefer list comprehensions over loops (1.5-2x faster) | | perf-generator-expression | Use generators for large datasets (O(1) memory) | | perf-dict-get | Use dict.get() for efficient default values | | perf-set-lookup | Use set for fast lookups (O(1) vs O(n)) | | perf-str-join | Use join for string concatenation (O(n) vs O(n²)) |
Efficient asynchronous programming patterns using asyncio.
| Rule | Description | |------|-------------| | async-gather | Use asyncio.gather for independent tasks | | async-create-task | Proper background task creation | | async-context-manager | Resource management with async with | | async-semaphore | Limit concurrency with semaphores |
Software design principles for maintainability and extensibility.
| Rule | Description | |------|-------------| | design-philosophy | DRY, YAGNI, KISS principles | | design-single-responsibility | Single Responsibility Principle | | design-dependency-injection | Loose coupling with dependency injection | | design-pure-functions | Prefer pure functions without side effects | | design-early-return | Reduce nesting with early returns |
Best practices for Pythonic object-oriented programming.
| Rule | Description | |------|-------------| | oop-composition-over-inheritance | Prefer composition over inheritance | | oop-dataclass | Use dataclass for data containers | | oop-protocol | Prefer Protocol over abstract base classes | | oop-property | Use property instead of getters |
# List comprehension (not loops)
result = [x * 2 for x in items]
# Generator for large data
total = sum(x * x for x in range(1_000_000))
# dict.get() with default
value = config.get("key", default_value)
# Set for fast lookup
valid_ids: set[int] = {1, 2, 3}
if item_id in valid_ids: ...
# join for strings
result = ",".join(values)
# Concurrent execution
results = await asyncio.gather(task1(), task2(), task3())
# Resource management
async with aiohttp.ClientSession() as session:
async with session.get(url) as response:
data = await response.json()
# Concurrency limit
semaphore = asyncio.Semaphore(10)
async with semaphore:
await do_work()
# Dependency injection
class Service:
def __init__(self, repository: Repository) -> None:
self.repository = repository
# Early return
def process(data: Data | None) -> Result:
if data is None:
return Result.empty()
# main logic here
# Dataclass
@dataclass
class User:
name: str
email: str
# Protocol for interfaces
class Repository(Protocol):
def get(self, id: str) -> Entity: ...
# Property
@property
def full_name(self) -> str:
return f"{self.first} {self.last}"
tools
Python development tooling configuration and best practices
development
Maintainer-only workflow for handling GitHub Secret Scanning alerts on OpenClaw. Use when Codex needs to triage, redact, clean up, and resolve secret leakage found in issue comments, issue bodies, PR comments, or other GitHub content.
development
Maintainer workflow for OpenClaw releases, prereleases, changelog release notes, and publish validation. Use when Codex needs to prepare or verify stable or beta release steps, align version naming, assemble release notes, check release auth requirements, or validate publish-time commands and artifacts.
development
Run, watch, debug, and extend OpenClaw QA testing with qa-lab and qa-channel. Use when Codex needs to execute the repo-backed QA suite, inspect live QA artifacts, debug failing scenarios, add new QA scenarios, or explain the OpenClaw QA workflow. Prefer the live OpenAI lane with regular openai/gpt-5.4 in fast mode; do not use gpt-5.4-pro or gpt-5.4-mini unless the user explicitly overrides that policy.