Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

moai-lang-python

БесплатноБез исполняемых скриптовНе проверен

Python 3.13+ development specialist covering FastAPI, Django, async patterns, data science, testing with pytest, and modern Python features. Use when…

modu-aiот modu-ai★ 69 звёзд на GitHub19 установок в других каталогах

Об этом скилле

Quick Reference (30 seconds)

Python 3.13+ Development Specialist - FastAPI, Django, async patterns, pytest, and modern Python features.

Auto-Triggers: Python files with .py extension, pyproject.toml, requirements.txt, pytest.ini, FastAPI or Django discussions

Core Capabilities:

  • Python 3.13 Features: JIT compiler via PEP 744, GIL-free mode via PEP 703, pattern matching with match and case statements
  • Web Frameworks: FastAPI 0.115 and later, Django 5.2 LTS
  • Data Validation: Pydantic v2.9 with model_validate patterns
  • ORM: SQLAlchemy 2.0 async patterns
  • Testing: pytest with fixtures, async testing, parametrize decorators
  • Package Management: poetry, uv, pip with pyproject.toml
  • Type Hints: Protocol, TypeVar, ParamSpec, and modern typing patterns
  • Async: asyncio, async generators, and task groups
  • Data Science: numpy, pandas, and polars basics

Quick Patterns

FastAPI Endpoint Pattern:

Import FastAPI and Depends from fastapi, and BaseModel from pydantic. Create a FastAPI application instance. Define a UserCreate model class inheriting from BaseModel with name and email string fields. Create an async post endpoint at the users path that accepts a UserCreate parameter and returns a User by calling UserService.create with await.

Pydantic v2.9 Validation Pattern:

Import BaseModel and ConfigDict from pydantic. Define a User class inheriting from BaseModel. Set model_config using ConfigDict with from_attributes set to True and str_strip_whitespace set to True. Add id as integer, name as string, and email as string fields. Use model_validate to create from ORM objects and model_validate_json to create from JSON data.

pytest Async Test Pattern:

Import pytest and mark the test function with pytest.mark.asyncio decorator. Create an async test function that takes async_client as a fixture parameter. Send a post request to the users endpoint with a JSON body containing a name field. Assert that the response status_code equals 201.


Implementation Guide (5 minutes)

Python 3.13 New Features

JIT Compiler via PEP 744:

  • Experimental feature disabled by default
  • Enable using the PYTHON_JIT environment variable set to 1
  • Build option available as enable-experimental-jit flag
  • Provides performance improvements for CPU-bound code
  • Uses copy-and-patch JIT that translates specialized bytecode to machine code

GIL-Free Mode via PEP 703:

  • Experimental free-threaded build available as python3.13t
  • Allows true parallel thread execution
  • Available in official Windows and macOS installers
  • Best suited for CPU-intensive multi-threaded applications
  • Not recommended for production use yet

Pattern Matching with match and case:

Create a process_response function that takes a response dictionary and returns a string. Use match statement on response. For case with status ok and data field, return success message with the data. For case with status error and message field, return error message. For case with status matching pending or processing using a guard condition, return in progress message. For default case using underscore, return unknown response.

FastAPI 0.115+ Patterns

Async Dependency Injection:

Import FastAPI, Depends from fastapi, AsyncSession from sqlalchemy.ext.asyncio, and asynccontextmanager from contextlib. Create a lifespan async context manager decorated with asynccontextmanager that takes the FastAPI app. In the lifespan, call await init_db for startup, yield, then call await cleanup for shutdown. Create the FastAPI app with the lifespan parameter. Define an async get_db function returning AsyncGenerator of AsyncSession that uses async with on async_session and yields the session. Create a get endpoint for users with user_id path parameter, using Depends with get_db to inject the database session. Call await get_user_by_id and return UserResponse.model_validate with the user.

Class-Based Dependencies:

Create a Paginator class with an init method accepting page defaulting to 1 and size defaulting to 20. Set self.page to max of 1 and page, self.size to min of 100 and max of 1 and size, and self.offset to page minus 1 multiplied by size. Create a list_items endpoint using Depends on Paginator to inject pagination and return items using get_page with offset and size.

Django 5.2 LTS Features

Composite Primary Keys:

Create an OrderItem model with ForeignKey to Order with CASCADE deletion, ForeignKey to Product with CASCADE deletion, and an IntegerField for quantity. In the Meta class, set pk to models.CompositePrimaryKey with order and product fields.

URL Reverse with Query Parameters:

Import reverse from django.urls. Call reverse with the search view name, query dictionary containing q set to django and page set to 1, and fragment set to results. The result is the search path with query string and fragment.

Automatic Model Imports in Shell:

Run python manage.py shell and models from all installed apps are automatically imported without explicit import statem

Полный SKILL.md на GitHub

Установить moai-lang-python в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Grep
Glob
Bash(python:*)
Bash(python3:*)
Bash(pytest:*)
Bash(ruff:*)
Bash(pip:*)
Bash(uv:*)
Bash(mypy:*)
Bash(pyright:*)
Bash(black:*)
Bash(poetry:*)
mcp__context7__resolve-library-id
mcp__context7__get-library-docs

Вложенные файлы

references/examples.mdreferences/reference.md

FAQ

Что делает скилл moai-lang-python?

Python 3.13+ development specialist covering FastAPI, Django, async patterns, data science, testing with pytest, and modern Python features. Use when developing Python APIs, web applications, data pipelines, or writing tests.

Как установить скилл moai-lang-python?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл moai-lang-python запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить moai-lang-python с