From compound-engineering-feat-python
Enforce Python code style conventions including PEP 8 overrides, modern syntax, and Pythonic patterns. Use when writing, reviewing, or refactoring Python code to ensure consistency with project standards.
npx claudepluginhub weorbitant/compound-engineering-feat-python-plugin --plugin compound-engineering-feat-pythonThis skill uses the workspace's default tool permissions.
This skill defines the Python code style conventions for the project. It combines PEP 8 defaults with project-specific overrides and modern Python idioms. All Python code produced or reviewed must conform to these standards.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Designs and optimizes AI agent action spaces, tool definitions, observation formats, error recovery, and context for higher task completion rates.
This skill defines the Python code style conventions for the project. It combines PEP 8 defaults with project-specific overrides and modern Python idioms. All Python code produced or reviewed must conform to these standards.
This guide covers naming, imports, formatting, type hints, error handling, logging, and module structure. For detailed rules with concrete examples, consult the reference files:
These rules override PEP 8 defaults and must always be followed:
| None not Optional -- use str | None instead of Optional[str]list[str] not List[str], dict[str, int] not Dict[str, int]| Element | Convention | Example |
|---|---|---|
| Functions, methods, variables | snake_case | calculate_total, user_count |
| Classes | PascalCase | OrderProcessor, UserProfile |
| Constants | UPPER_SNAKE_CASE | MAX_RETRIES, DEFAULT_TIMEOUT |
| Private attributes | Leading underscore | _internal_cache |
| Protected methods | Leading underscore | _validate_input |
| Module-level dunder | Double underscore | __all__, __version__ |
Choose names that communicate intent. Prefer active_user_count over cnt. Prefer fetch_order_details over get_data.
Organize imports in three groups separated by blank lines:
Use absolute imports only. Never use wildcard imports. Never place imports inside functions, conditionals, or loops.
import os
from collections import defaultdict
from pathlib import Path
from django.db import models
from pydantic import BaseModel
from myapp.services.billing import BillingService
from myapp.utils.formatting import format_currency
% or .format())pathlib.Path instead of os.pathwith) for all resource handlingApply type hints to all function signatures. Use modern syntax available in Python 3.10+:
def process_items(items: list[str], config: dict[str, int] | None = None) -> bool:
...
Never use typing.Optional, typing.List, typing.Dict, typing.Tuple, or typing.Set. See conventions.md for the complete type hint reference.
except:try:
result = external_api.fetch(resource_id)
except ConnectionError as exc:
logger.error("Failed to fetch resource %s: %s", resource_id, exc)
raise ServiceUnavailableError(f"Cannot reach API for resource {resource_id}") from exc
All log messages must include an emoji prefix that reflects the log level or action:
logger.info("๐ Started processing batch %s", batch_id)
logger.info("โ
User %s registered successfully", user_id)
logger.warning("โ ๏ธ Retrying request to %s (attempt %d/%d)", url, attempt, max_retries)
logger.error("โ Failed to process payment for order %s", order_id)
logger.debug("๐ Cache hit for key %s", cache_key)
Common emoji prefixes:
| Emoji | Usage |
|---|---|
| โ | Success, completion |
| โ | Failure, error |
| โ ๏ธ | Warning, degraded state |
| ๐ | Starting a process |
| ๐ | Debug, inspection |
| ๐ | Retry, refresh |
| ๐ฅ | Receiving data |
| ๐ค | Sending data |
| ๐๏ธ | Deletion |
| ๐ | Auth, security |
Order elements within a module as follows:
__all__, __version__)if __name__ == "__main__":)