/marks-languages:pythonfrom marks-languages
Python patterns for backend development, testing, and async programming. Use when writing Python code.
Ships in marks-languages. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
from dataclasses import dataclass
from typing import Optional, TypeVar, Generic
@dataclass
class User:
name: str
email: str
id: Optional[str] = None
# Generic types
T = TypeVar('T')
E = TypeVar('E')
@dataclass
class Result(Generic[T, E]):
value: Optional[T] = None
error: Optional[E] = None
@property
def ok(self) -> bool:
return self.error is None
import pytest
from unittest.mock import Mock, AsyncMock, patch
# Fixtures
@pytest.fixture
def mock_db():
return Mock()
@pytest.fixture
def user_service(mock_db):
return UserService(mock_db)
# Parameterized tests
@pytest.mark.parametrize("email,valid", [
("[email protected]", True),
("invalid", False),
])
def test_validate_email(email, valid):
assert validate_email(email) == valid
# Async tests
@pytest.mark.asyncio
async def test_fetch_user(user_service, mock_db):
mock_db.find.return_value = {"id": "1", "name": "Test"}
result = await user_service.get("1")
assert result.name == "Test"
# Mocking
@patch("myapp.services.external_api")
def test_with_mock(mock_api):
mock_api.fetch.return_value = {"status": "ok"}
import asyncio
from contextlib import asynccontextmanager
# Gather with error handling
async def fetch_all(urls: list[str]) -> list[Result]:
tasks = [fetch(url) for url in urls]
return await asyncio.gather(*tasks, return_exceptions=True)
# Async context manager
@asynccontextmanager
async def get_connection():
conn = await pool.acquire()
try:
yield conn
finally:
await pool.release(conn)
# Semaphore for rate limiting
sem = asyncio.Semaphore(10)
async def limited_fetch(url):
async with sem:
return await fetch(url)
# Custom exceptions
class AppError(Exception):
def __init__(self, message: str, code: int = 500):
self.message = message
self.code = code
class NotFoundError(AppError):
def __init__(self, resource: str):
super().__init__(f"{resource} not found", 404)
# Result pattern
def find_user(id: str) -> Result[User, str]:
user = db.users.get(id)
if not user:
return Result(error="User not found")
return Result(value=user)
logging module, not printWhat SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub malston/marks-marketplace --plugin marks-languages8 skills in this plugin
/bashDefensive Bash scripting patterns for reliable automation. Use when writing shell scripts./cloud-designDesign resilient, scalable multi-cloud architectures with best practices for AWS, Azure, and GCP. Use when creating cloud architecture diagrams, planning cloud infrastructure, or designing cloud migration strategies./golangGo patterns for backend development, testing, and clean architecture. Use when writing Go code./k8s-architectureDesign and implement production-grade Kubernetes clusters with best practices for reliability, security, and scalability. Use when planning cluster architecture, designing K8s network models, or implementing multi-cluster strategies./rust-engineerAcquire expert Rust developer specialisation in rust systems programming, memory safety, and zero-cost abstractions. Masters ownership patterns, async programming, and performance optimisation for mission-critical applications./terraformTerraform patterns for AWS infrastructure. Use when writing IaC for cloud infrastructure.