{"id":"0a3fa0e3-f7e8-4d7a-ae22-528807af111f","shortId":"WEyHFD","kind":"skill","title":"python-modern-python","tagline":"Modern Python language features and typing patterns. Use when writing type hints, using generics, implementing pattern matching, working with async/await, or leveraging Python 3.10+ features.","description":"# Modern Python Features\n\nModern Python 3.10+ language features, type hints, and patterns.\n\n## Type Hints\n\n### Basic Types\n\n```python\ndef greet(name: str) -> str:\n    return f\"Hello {name}\"\n\nage: int = 25\nprices: list[float] = [9.99, 19.99]\nmapping: dict[str, int] = {\"a\": 1}\n```\n\n### Union Types (Python 3.10+)\n\n```python\n# Modern syntax\ndef process(value: int | str) -> bool:\n    ...\n\n# Optional\ndef get_user(id: int) -> User | None:\n    ...\n\n# Multiple types\nResult = int | str | bool\n```\n\n### Generic Types\n\n```python\nfrom typing import TypeVar, Generic\n\nT = TypeVar(\"T\")\n\nclass Repository(Generic[T]):\n    def get(self, id: int) -> T | None:\n        ...\n\n    def save(self, entity: T) -> T:\n        ...\n\nuser_repo = Repository[User]()\n```\n\n### Protocol (Structural Typing)\n\n```python\nfrom typing import Protocol\n\nclass Drawable(Protocol):\n    \"\"\"Structural type - any class with draw()\"\"\"\n    def draw(self) -> None:\n        ...\n\ndef render(obj: Drawable) -> None:\n    \"\"\"Works with any object that has draw()\"\"\"\n    obj.draw()\n```\n\n## Pattern Matching (Python 3.10+)\n\n### Basic Matching\n\n```python\ndef handle_command(command: str):\n    match command:\n        case \"start\":\n            start_process()\n        case \"stop\":\n            stop_process()\n        case \"status\":\n            return get_status()\n        case _:\n            raise ValueError(\"Unknown command\")\n```\n\n### Matching with Values\n\n```python\ndef handle_http_status(status: int):\n    match status:\n        case 200:\n            return \"OK\"\n        case 404:\n            return \"Not Found\"\n        case 500 | 502 | 503:\n            return \"Server Error\"\n        case _:\n            return \"Unknown\"\n```\n\n### Structural Pattern Matching\n\n```python\ndef process_point(point):\n    match point:\n        case (0, 0):\n            return \"Origin\"\n        case (x, 0):\n            return f\"On X-axis at {x}\"\n        case (0, y):\n            return f\"On Y-axis at {y}\"\n        case (x, y):\n            return f\"At ({x}, {y})\"\n```\n\n## Async/Await\n\n### Async Functions\n\n```python\nasync def fetch_data(url: str) -> dict:\n    \"\"\"Async function\"\"\"\n    async with httpx.AsyncClient() as client:\n        response = await client.get(url)\n        return response.json()\n\n# Call async function\ndata = await fetch_data(\"https://api.example.com\")\n```\n\n### Concurrent Execution\n\n```python\nimport asyncio\n\nasync def process_all(urls: list[str]):\n    \"\"\"Process multiple URLs concurrently\"\"\"\n    tasks = [fetch_data(url) for url in urls]\n    results = await asyncio.gather(*tasks)\n    return results\n```\n\n### Async Context Managers\n\n```python\nclass AsyncDatabase:\n    async def __aenter__(self):\n        await self.connect()\n        return self\n\n    async def __aexit__(self, *args):\n        await self.disconnect()\n\nasync with AsyncDatabase() as db:\n    await db.query(...)\n```\n\n## Dataclasses and attrs\n\n```python\nfrom dataclasses import dataclass\n\n@dataclass(frozen=True)\nclass Point:\n    x: float\n    y: float\n\n    def distance_from_origin(self) -> float:\n        return (self.x ** 2 + self.y ** 2) ** 0.5\n```\n\n## Walrus Operator\n\n```python\n# Assign and use in one expression\nif (n := len(items)) > 10:\n    print(f\"Too many items: {n}\")\n\n# In comprehensions\nresults = [y for x in items if (y := process(x)) is not None]\n```\n\n## Modern String Formatting\n\n```python\nname = \"Alice\"\nage = 30\n\n# f-strings\nmessage = f\"Hello {name}, you are {age} years old\"\n\n# f-strings with expressions\nmessage = f\"In 5 years you'll be {age + 5}\"\n\n# Debug f-strings (Python 3.8+)\nprint(f\"{name=}\")  # name='Alice'\n```\n\nSee references/ for advanced typing, async patterns, and pattern matching.","tags":["python","modern","atelier","martinffx","agent-skills","agentic-coding","anthropic","claude-code","claude-skills","code-review","codex","codex-skill"],"capabilities":["skill","source-martinffx","skill-python-modern-python","topic-agent-skills","topic-agentic-coding","topic-anthropic","topic-claude-code","topic-claude-skills","topic-code-review","topic-codex","topic-codex-skill","topic-opencode","topic-prompt-engineering","topic-sdd","topic-spec-driven-development"],"categories":["atelier"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/martinffx/atelier/python-modern-python","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add martinffx/atelier","source_repo":"https://github.com/martinffx/atelier","install_from":"skills.sh"}},"qualityScore":"0.461","qualityRationale":"deterministic score 0.46 from registry signals: · indexed on github topic:agent-skills · 23 github stars · SKILL.md body (3,622 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-05-18T19:05:23.435Z","embedding":null,"createdAt":"2026-05-10T07:03:12.232Z","updatedAt":"2026-05-18T19:05:23.435Z","lastSeenAt":"2026-05-18T19:05:23.435Z","tsv":"'0':237,238,243,253 '0.5':389 '1':69 '10':403 '19.99':63 '2':386,388 '200':208 '25':58 '3.10':28,35,73,166 '3.8':465 '30':432 '404':212 '5':453,459 '500':217 '502':218 '503':219 '9.99':62 'advanc':474 'aenter':341 'aexit':349 'age':56,431,442,458 'alic':430,470 'api.example.com':302 'arg':351 'assign':393 'async':272,275,282,284,296,308,333,339,347,354,476 'async/await':24,271 'asyncdatabas':338,356 'asyncio':307 'asyncio.gather':329 'attr':363 'await':290,299,328,343,352,359 'axi':249,260 'basic':44,167 'bool':82,96 'call':295 'case':177,181,185,190,207,211,216,223,236,241,252,263 'class':108,137,143,337,372 'client':288 'client.get':291 'command':172,173,176,194 'comprehens':411 'concurr':303,318 'context':334 'data':278,298,301,321 'dataclass':361,366,368,369 'db':358 'db.query':360 'debug':460 'def':47,77,84,112,119,146,150,170,199,230,276,309,340,348,378 'dict':65,281 'distanc':379 'draw':145,147,161 'drawabl':138,153 'entiti':122 'error':222 'execut':304 'express':398,449 'f':53,245,256,267,405,434,437,446,451,462,467 'f-string':433,445,461 'featur':8,29,32,37 'fetch':277,300,320 'float':61,375,377,383 'format':427 'found':215 'frozen':370 'function':273,283,297 'generic':18,97,104,110 'get':85,113,188 'greet':48 'handl':171,200 'hello':54,438 'hint':16,39,43 'http':201 'httpx.asyncclient':286 'id':87,115 'implement':19 'import':102,135,306,367 'int':57,67,80,88,94,116,204 'item':402,408,417 'languag':7,36 'len':401 'leverag':26 'list':60,313 'll':456 'manag':335 'mani':407 'map':64 'match':21,164,168,175,195,205,228,234,480 'messag':436,450 'modern':3,5,30,33,75,425 'multipl':91,316 'n':400,409 'name':49,55,429,439,468,469 'none':90,118,149,154,424 'obj':152 'obj.draw':162 'object':158 'ok':210 'old':444 'one':397 'oper':391 'option':83 'origin':240,381 'pattern':11,20,41,163,227,477,479 'point':232,233,235,373 'price':59 'print':404,466 'process':78,180,184,231,310,315,420 'protocol':129,136,139 'python':2,4,6,27,31,34,46,72,74,99,132,165,169,198,229,274,305,336,364,392,428,464 'python-modern-python':1 'rais':191 'refer':472 'render':151 'repo':126 'repositori':109,127 'respons':289 'response.json':294 'result':93,327,332,412 'return':52,187,209,213,220,224,239,244,255,266,293,331,345,384 'save':120 'see':471 'self':114,121,148,342,346,350,382 'self.connect':344 'self.disconnect':353 'self.x':385 'self.y':387 'server':221 'skill' 'skill-python-modern-python' 'source-martinffx' 'start':178,179 'status':186,189,202,203,206 'stop':182,183 'str':50,51,66,81,95,174,280,314 'string':426,435,447,463 'structur':130,140,226 'syntax':76 'task':319,330 'topic-agent-skills' 'topic-agentic-coding' 'topic-anthropic' 'topic-claude-code' 'topic-claude-skills' 'topic-code-review' 'topic-codex' 'topic-codex-skill' 'topic-opencode' 'topic-prompt-engineering' 'topic-sdd' 'topic-spec-driven-development' 'true':371 'type':10,15,38,42,45,71,92,98,101,131,134,141,475 'typevar':103,106 'union':70 'unknown':193,225 'url':279,292,312,317,322,324,326 'use':12,17,395 'user':86,89,125,128 'valu':79,197 'valueerror':192 'walrus':390 'work':22,155 'write':14 'x':242,248,251,264,269,374,415,421 'x-axi':247 'y':254,259,262,265,270,376,413,419 'y-axi':258 'year':443,454","prices":[{"id":"f7df4ec7-1bf8-4ca2-bb9a-09dfe3ccf9a1","listingId":"0a3fa0e3-f7e8-4d7a-ae22-528807af111f","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"martinffx","category":"atelier","install_from":"skills.sh"},"createdAt":"2026-05-10T07:03:12.232Z"}],"sources":[{"listingId":"0a3fa0e3-f7e8-4d7a-ae22-528807af111f","source":"github","sourceId":"martinffx/atelier/python-modern-python","sourceUrl":"https://github.com/martinffx/atelier/tree/main/skills/python-modern-python","isPrimary":false,"firstSeenAt":"2026-05-10T07:03:12.232Z","lastSeenAt":"2026-05-18T19:05:23.435Z"}],"details":{"listingId":"0a3fa0e3-f7e8-4d7a-ae22-528807af111f","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"martinffx","slug":"python-modern-python","github":{"repo":"martinffx/atelier","stars":23,"topics":["agent-skills","agentic-coding","anthropic","claude-code","claude-skills","code-review","codex","codex-skill","opencode","prompt-engineering","sdd","spec-driven-development"],"license":"mit","html_url":"https://github.com/martinffx/atelier","pushed_at":"2026-05-18T06:56:45Z","description":"An atelier for Opencode, Claude Code, and other coding agents: spec-driven workflows, deep thinking, and code quality.","skill_md_sha":"3aef808a064da85b7c45ef6a64b32403f635e308","skill_md_path":"skills/python-modern-python/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/martinffx/atelier/tree/main/skills/python-modern-python"},"layout":"multi","source":"github","category":"atelier","frontmatter":{"name":"python-modern-python","description":"Modern Python language features and typing patterns. Use when writing type hints, using generics, implementing pattern matching, working with async/await, or leveraging Python 3.10+ features."},"skills_sh_url":"https://skills.sh/martinffx/atelier/python-modern-python"},"updatedAt":"2026-05-18T19:05:23.435Z"}}