plugins/autonomous-dev/skills/python-standards/SKILL.md
Python code quality standards covering PEP 8, Black formatting, type hints, Google-style docstrings, and error handling. Use when writing or reviewing Python code. TRIGGER when: python, formatting, type hints, docstrings, PEP 8, black, isort. DO NOT TRIGGER when: non-Python files, markdown, config, shell scripts.
npx skillsauth add akaszubski/autonomous-dev python-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.
Python code quality standards for autonomous-dev project.
| Setting | Value | |---------|-------| | Line length | 100 characters | | Indentation | 4 spaces (no tabs) | | Quotes | Double quotes | | Imports | Sorted with isort |
black --line-length=100 src/ tests/
isort --profile=black --line-length=100 src/ tests/
Rule: All public functions must have type hints on parameters and return.
def process_file(
input_path: Path,
output_path: Optional[Path] = None,
*,
max_lines: int = 1000
) -> Dict[str, any]:
"""Type hints on all parameters and return."""
pass
Rule: All public functions/classes need docstrings with Args, Returns, Raises.
def process_data(data: List[Dict], *, batch_size: int = 32) -> ProcessResult:
"""Process data with validation.
Args:
data: Input data as list of dicts
batch_size: Items per batch (default: 32)
Returns:
ProcessResult with items and metrics
Raises:
ValueError: If data is empty
"""
Rule: Error messages must include context + expected + docs link.
# ✅ GOOD
raise FileNotFoundError(
f"Config file not found: {path}\n"
f"Expected: YAML with keys: model, data\n"
f"See: docs/guides/configuration.md"
)
# ❌ BAD
raise FileNotFoundError("File not found")
Define a project-level exception hierarchy for structured error handling:
class AppError(Exception):
"""Base exception for the application."""
pass
class ConfigError(AppError):
"""Configuration loading or validation error."""
pass
class ValidationError(AppError):
"""Input or data validation error."""
pass
class ExternalServiceError(AppError):
"""Error communicating with external service."""
pass
When to use custom vs built-in exceptions:
ValueError, TypeError, FileNotFoundError) for standard programming errorsEvery error message should follow this three-part format:
raise ValidationError(
f"Invalid config key '{key}' in {config_path}\n"
f"Expected one of: {', '.join(valid_keys)}\n"
f"See: docs/configuration.md#valid-keys"
)
When a non-critical operation fails, log and continue rather than crashing:
try:
optional_result = enhance_with_cache(data)
except CacheError:
logging.warning("Cache unavailable, proceeding without cache")
optional_result = None
| Type | Convention | Example |
|------|------------|---------|
| Classes | PascalCase | ModelTrainer |
| Functions | snake_case | train_model() |
| Constants | UPPER_SNAKE | MAX_LENGTH |
| Private | _underscore | _helper() |
* for clarityPath not string pathswith for resources# Keyword-only args
def train(data: List, *, learning_rate: float = 1e-4):
pass
# Pathlib
config = Path("config.yaml").read_text()
flake8 src/ --max-line-length=100 # Linting
mypy src/[project_name]/ # Type checking
pytest --cov=src --cov-fail-under=80 # Coverage
* for clarityFORBIDDEN:
except: or except Exception: without re-raising or specific handlingdef f(items=[]))os.path when pathlib.Path is availableREQUIRED:
development
One topic, one home. Routes content to its canonical store (CLAUDE.md, PROJECT.md, MEMORY.md, docs/, memory/) and audits for duplication. TRIGGER when: auditing CLAUDE.md/PROJECT.md/MEMORY.md sizes, deduplicating docs, applying the content-allocation pattern to a new repo, running /align --content. DO NOT TRIGGER when: implementing features, writing tests, routine code edits, debugging.
development
GenAI-first testing with structural assertions, congruence validation, and tier-based test structure. Use when writing tests, setting up test infrastructure, or validating coverage. TRIGGER when: test, pytest, coverage, TDD, test patterns, congruence, validation. DO NOT TRIGGER when: production code implementation, documentation, config-only changes.
testing
Prompt engineering patterns for writing agent prompts and skill files — constraint budgets, register shifting, HARD GATE patterns, anti-personas. Use when writing or reviewing agents/*.md or skills/*/SKILL.md. TRIGGER when: agent prompt, skill file, prompt engineering, model-tier compensation, HARD GATE, prompt quality. DO NOT TRIGGER when: user-facing docs, README, CHANGELOG, config files.
testing
7-step planning workflow for pre-implementation design. Enforced by plan_gate hook, critiqued by plan-critic agent. Use when creating plans, design documents, or architecture decisions before implementation. TRIGGER when: plan, planning, /plan, design document, architecture decision. DO NOT TRIGGER when: implementation, coding, testing.