python-engineering

Production Python engineering patterns covering architecture, observability, testing, performance/concurrency, and core practices. Use when designing Python systems, implementing async/sync APIs, setting up monitoring, structuring tests, optimizing performance, or following Python best practices.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "python-engineering" with this command: npx skills add yariv1025/skills/yariv1025-skills-python-engineering

Python Engineering

Production-grade patterns drawn from (not requiring) exemplar projects—FastAPI, Poetry, HTTPX, Celery, Black—as reference. Apply the patterns with any stack.

This skill is structured per the skill-creator: essentials and navigation in SKILL.md; detailed patterns in references/, loaded only when needed (progressive disclosure).

When to Read Which Reference

NeedRead
Package layout, DI, config, pluginsreferences/architecture.md
Logging, metrics, tracing, healthreferences/observability.md
Test structure, fixtures, CIreferences/testing.md
Async safety, concurrency, throughputreferences/performance-concurrency.md
GIL, packaging, I/O, reliabilityreferences/core-practices.md

Quick Patterns

  • Structure: Separate routing, domain, persistence, integration; use dependency injection and typed config (any framework or stdlib).
  • Observability: Structured logs with correlation IDs; metrics (Prometheus/StatsD); health/readiness endpoints; distinguish operational vs programmer errors.
  • Tests: Pyramid (unit → integration → e2e); fixtures for isolation; parametrize edge cases; parallel CI; avoid hidden network/time.
  • Concurrency: Async for I/O; threads for blocking libs; processes for CPU-bound. One long-lived client per dependency; timeouts and backpressure everywhere.
  • Reliability: Context managers for cleanup; validate at boundaries; no blocking calls in async paths; idempotent retries and circuit breaking for I/O.

Quick Reference / Examples

TaskApproach
Inject dependenciesUse typed getters or framework DI; see references/architecture.md.
Structured loggingLog with extra dict and correlation ID; see references/observability.md.
Reuse HTTP clientOne long-lived client per app; timeouts on every call. See references/performance-concurrency.md.
Resource cleanupUse context managers; avoid blocking in async. See references/core-practices.md.
Isolate testsFixtures, parametrize, no hidden network/time. See references/testing.md.

Context manager (reliable cleanup):

with open(path) as f:
    process(f.read())
# or async: async with client: ...

Structured log / typed config:

logger.info("request_handled", extra={"request_id": req_id, "path": path})
# Config: Settings from Pydantic BaseSettings or env, validated at startup.

Workflow

  1. Designing a new service → Read references/architecture.md, then references/core-practices.md.
  2. Adding monitoring → Read references/observability.md.
  3. Writing or refactoring tests → Read references/testing.md.
  4. Optimizing or introducing async/threads/workers → Read references/performance-concurrency.md.

Keep SKILL.md lean; load reference files only when relevant to the task.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

agent-dev-guardrails

No summary provided by upstream source.

Repository SourceNeeds Review
Security

owasp-api-security-top-10

No summary provided by upstream source.

Repository SourceNeeds Review
General

owasp-iot-top-10

No summary provided by upstream source.

Repository SourceNeeds Review
General

owasp-mobile-top-10

No summary provided by upstream source.

Repository SourceNeeds Review