Python Patterns
Python best practices including type hints, async patterns, testing, and project structure
Install
npx skills add cosmicstack-labs/mercury-agent-skills --skill python-patternsgit clone --depth 1 https://github.com/cosmicstack-labs/mercury-agent-skills.git /tmp/mercury-agent-skills
mkdir -p ~/.claude/skills
cp -r /tmp/mercury-agent-skills/categories/backend/python-patterns ~/.claude/skills/python-patternsPersonal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.
From the SKILL.md
# Python Patterns Write Python that is type-safe, testable, and a joy to maintain. ## Core Principles ### 1. Explicit Over Implicit Use type hints. Avoid `*args` and `**kwargs` when named parameters work. Favor clear interfaces over dynamic flexibility. ### 2. Composition Over Inheritance Python's multiple inheritance is powerful but dangerous. Prefer composition and protocols over deep class hierarchies. ### 3. Async Done Right Async is a tool for I/O-bound workloads, not a universal default. Use synchronous code for CPU-bound tasks, async for network calls and file I/O. ### 4. Test-First for Critical Paths Your business logic should be testable without mocks. Use dependency injection. Keep I/O at the boundaries. --- ## Python Maturity Model | Level | Typing | Async | Testing | Structure | |-------|--------|-------|---------|-----------| | **1: Script** | No type hints | sync only | Manual testing | Single file | | **2: Module** | Basic types (str, int) | Basic asyncio | pytest, some coverage | Package with `__init__.py` | | **3: Package** | Full type hints with mypy | Async with proper patterns | pytest + fixtures + mocking | src-layout, entry points | | **4: Service** | Generics, Protocols, TypedDict | Structured concurrency | Property-based, integration tests | Domain-driven structure | | **5: Library** | Precise types, variance annotations | Trio / anyio | Fuzzing, benchmark tests | Public API surface explicit | Target: **Level 3+** for production services.
Details
- Skill name
python-patterns- Repository
- cosmicstack-labs/mercury-agent-skills
- Path
categories/backend/python-patterns/SKILL.md- License
- MIT
- Repo updated
- 25 August 2026
FAQ
What does the Python Patterns skill do?
Python best practices including type hints, async patterns, testing, and project structure
How do I install the Python Patterns skill?
skills CLI (Claude Code, Cursor, Codex and more): npx skills add cosmicstack-labs/mercury-agent-skills --skill python-patterns. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.
Is Python Patterns popular?
It lives in cosmicstack-labs/mercury-agent-skills, which has 492 GitHub stars and 68 forks.
Related skills
Accessibility
492cosmicstack-labs/mercury-agent-skills
Achieve and maintain WCAG compliance through inclusive design practices, proper ARIA usage, and comprehensive testing methodologies.
Accessibility Testing
492cosmicstack-labs/mercury-agent-skills
WCAG 2.1/2.2 audit, axe, Lighthouse, manual testing, screen reader testing, and remediation
Agent Audit Logging
492cosmicstack-labs/mercury-agent-skills
Implement comprehensive audit logging and reporting for multi-agent systems. Covers event capture, structured logging, traceability, compliance reporting, forensic analysis, and real-time monitoring dashboards for agent actions and decisions.
Readwise CLI
329readwiseio/readwise-skills
How to use the Readwise CLI — access highlights, documents, and your entire reading library from the command line
Product Strategy
492cosmicstack-labs/mercury-agent-skills
A comprehensive skill for product strategy — covering frameworks, opportunity sizing, prioritization, roadmap building, OKRs, and stakeholder management. From early-stage discovery to mature product org execution.
Refactoring Patterns
492cosmicstack-labs/mercury-agent-skills
Systematic refactoring techniques, code smell elimination, pattern extraction, and legacy modernization
Browse the most popular Claude skills, all software development skills, or write your own with the skills generator.