python

Python development guidelines and best practices. Use when working with Python code.

8 stars

Best use case

python is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Python development guidelines and best practices. Use when working with Python code.

Teams using python should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/python/SKILL.md --create-dirs "https://raw.githubusercontent.com/siviter-xyz/dot-agent/main/skills/python/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/python/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How python Compares

Feature / AgentpythonStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Python development guidelines and best practices. Use when working with Python code.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Python Guidelines

Standards and best practices for Python development. Follow these guidelines when writing or modifying Python code.

## Design Principles

Apply DRY, KISS, and SOLID consistently. Prefer functional methods where relevant; use classes for stateful behavior. Use composition with Protocol classes for interfaces rather than inheritance. Each module should have a single responsibility. Use dependency injection for class dependencies.

## Code Style

- **Naming**: Descriptive yet concise names for variables, methods, and classes
- **Documentation**: Docstrings for all classes, functions, enums, enum values
- **Type hints**: Use consistently; avoid `Any` unless necessary
- **Imports**: Avoid barrel exports in `__init__.py`; prefer blank files

## Type Annotations

- Use `dict`, `list` instead of `typing.Dict`, `typing.List`
- Use `str | None` instead of `Optional[str]`
- Include `from __future__ import annotations` at top of files with type hints
- Prefer built-in types over typing module equivalents

## Architecture

### Dependency Injection

- Always inject dependencies via constructors or methods when using classes
- One service class per module (interface and class models allowed in addition)
- Use Protocol classes to define interfaces for dependency injection and testing

### Module Organization

- Each module focuses on one concern with clear boundaries
- Extract reusable methods to avoid duplication
- Design for reusability across contexts

### Environment Variables

- Use an `environment.py` file with individual methods per variable (e.g., `api_key()` for `API_KEY`, `database_url()` for `DATABASE_URL`)
- Co-locate all environment access in one place per package for easier mocking in tests

### Data Models

- Use Pydantic v2 for schemas, validation, and data models
- Leverage Pydantic's type validation, serialization, and configuration management
- Use Pydantic models for API request/response schemas, configuration objects, and data transfer objects

## Testing

### Structure

- Tests mirror `src/` directory structure
- Test methods start with `test_`
- Use test class suites: for `def foo()` create `class TestFoo`
- Keep names concise, omit class suite name from method
- Always check for appropriate unit tests when changing code

### Quality

- Use AAA (Arrange, Act, Assert) pattern
- Tests should be useful, readable, concise, maintainable
- Avoid tests that create massive diffs or become burdensome

### Tools

- Prefer `pytest` over `unittest`
- Use `pytest-mock` for mocking
- Use `conftest.py` for shared fixtures
- Use `tests/__test_<package_name>__` for shared testing code

## Implementation

When implementing Python code:
- Ensure code passes type checking and tests before committing
- Group related changes with tests in atomic commits
- Check for existing workflow patterns (spec-first, TDD, etc.) and follow them

## References

- For adhoc Python scripts in uv-managed projects, see `references/uv-scripts.md`.
- For monorepo-specific patterns using uv and Hatch, see `references/uv-monorepo.md`.

Related Skills

typescript

8
from siviter-xyz/dot-agent

TypeScript standards and best practices with modern tooling. Use when working with TypeScript or TypeScript React files.

software-engineer

8
from siviter-xyz/dot-agent

Core software engineering principles for code style, documentation, and development workflow. Applies when editing code, working in software repositories, or performing software development tasks.

semantic-git

8
from siviter-xyz/dot-agent

Manage Git commits using conventional commit format with atomic staging. Always generate plain git commands before running them and offer to let the user run them manually.

psi

8
from siviter-xyz/dot-agent

Plan-spec-implement workflow for structured development. Only use when explicitly directed by user or when mentioned in project AGENTS.md file. Generates ephemeral plans in ~/.dot-agent/, applies specs to project docs, then implements test-first.

media-processing

8
from siviter-xyz/dot-agent

Media processing utilities for images, audio, and video using FFmpeg and ImageMagick. Use when working with media conversion, optimization, or batch processing tasks.

frontend-engineer

8
from siviter-xyz/dot-agent

Frontend development guidelines for React/TypeScript applications. Modern patterns including Suspense, lazy loading, useSuspenseQuery, file organization with features directory, MUI v7 styling, TanStack Router, performance optimization, and TypeScript best practices. Use when creating components, pages, features, fetching data, styling, routing, or working with frontend code.

create-skill

8
from siviter-xyz/dot-agent

Guide for creating effective skills following best practices. Use when creating or updating skills that extend agent capabilities.

create-agents-md

8
from siviter-xyz/dot-agent

Create AGENTS.md files for project-specific inline rules. Use when adding small, project-specific instructions that should be committed in repos.

context-engineering

8
from siviter-xyz/dot-agent

Master context engineering for AI agent systems. Use when designing agent architectures, debugging context failures, optimizing token usage, implementing memory systems, building multi-agent coordination, evaluating agent performance, or developing LLM-powered pipelines. Covers context fundamentals, degradation patterns, optimization techniques, compression strategies, memory architectures, multi-agent patterns, evaluation, tool design, and project development.

code-review

8
from siviter-xyz/dot-agent

Code review practices emphasizing technical rigor, evidence-based claims, and verification. Use when receiving code review feedback, completing tasks requiring review, or before making completion claims.

cli-building

8
from siviter-xyz/dot-agent

Build command-line interfaces with async-first design, composable commands, and proper output formatting. Use when creating CLI tools, commands, or interactive terminal applications.

backend-engineer

8
from siviter-xyz/dot-agent

Build robust backend systems with modern technologies (Node.js, Python, Go, Rust), frameworks (NestJS, FastAPI, Django), databases (PostgreSQL, MongoDB, Redis), APIs (REST, GraphQL, gRPC), authentication (OAuth 2.1, JWT), testing strategies, security best practices (OWASP Top 10), performance optimization, scalability patterns (microservices, caching, sharding), DevOps practices (Docker, Kubernetes, CI/CD), and monitoring. Use when designing APIs, implementing authentication, optimizing database queries, setting up CI/CD pipelines, handling security vulnerabilities, building microservices, or developing production-ready backend systems.