Teaching Claude Code Quality Patterns with a Custom Skill
Dagster’s dignified-python-313 skill guides Claude Code to write Python 3.13 code that matches their project conventions.
What It Covers
Modern Python 3.13 Patterns: Use native type syntax (list[str], str | None) instead of older alternatives. Skip from __future__ import annotations since Python 3.13 doesn’t need it.
CLI Development: Build Click interfaces with proper error handling. Use click.echo() for output, direct errors to stderr, and treat CLI commands as error boundaries that catch exceptions and exit with SystemExit(1).
Subprocess Safety: Always use check=True with subprocess.run() to catch failures. Capture both stdout and stderr. Set timeouts to prevent hangs.
Project-Specific Guidance
AI assistants understand Python but lack context for project conventions. This skill provides machine-readable instructions for consistent code generation.
The approach works alongside broader resources like the handbook’s Modern Python Project Setup Guide for AI Assistants.
Example Patterns
For subprocess calls:
# Always use check=True
result = subprocess.run(
["command", "arg"],
check=True,
capture_output=True,
text=True
)For CLI error handling:
# Catch exceptions at command boundary
@click.command()
def main():
try:
# domain logic here
except DomainError as e:
click.echo(f"Error: {e}", err=True)
raise SystemExit(1)