Agent skill

python-patterns

Python best practices including type hints, async patterns, testing, and project structure

Cosmic Stack3,294★ · 2 repos on radarProfile →
claude-codeMIT
Install
npx skills add cosmicstack-labs/mercury-agent-skills --skill python-patterns --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 8 KB
Bundled scripts: none
Version: 1.0.0
Declared author: cosmicstack-labs
Path: categories/backend/python-patterns/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 364
Language: JavaScript
Read our review of the source →

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

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

What's inside
Steps it walks through
  1. Core Principles
  2. 1. Explicit Over Implicit
  3. 2. Composition Over Inheritance
  4. 3. Async Done Right
  5. 4. Test-First for Critical Paths
  6. Python Maturity Model
  7. Actionable Guidance
  8. Type Hints
  9. Async Patterns
  10. Project Structure
  11. Testing Patterns
  12. Error Handling
  13. Common Mistakes
More from mercury-agent-skills
All skills →
About this skill
What does the python-patterns skill do?

Python best practices including type hints, async patterns, testing, and project structure

How do I install it?

Run `npx skills add cosmicstack-labs/mercury-agent-skills --skill python-patterns --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From cosmicstack-labs/mercury-agent-skills, a repository with 364 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going