module-development
БесплатноБез исполняемых скриптовНе проверенmyfy module protocol, lifecycle phases, and extension patterns. Use when creating new modules, working with configure/extend/finalize methods, module…
Об этом скилле
Module Development in myfy
Modules are the building blocks of myfy applications. Each module follows a protocol with lifecycle hooks.
Available Modules
myfy provides these built-in modules:
| Module | Package | Purpose |
|---|---|---|
| WebModule | myfy.web | HTTP routing, ASGI, FastAPI-like decorators |
| DataModule | myfy.data | SQLAlchemy async, migrations, sessions |
| FrontendModule | myfy.frontend | Jinja2, Tailwind 4, DaisyUI 5, Vite |
| TasksModule | myfy.tasks | Background jobs, SQL-based task queue |
| UserModule | myfy.user | Auth, OAuth, user management |
| CliModule | myfy.commands | Custom CLI commands |
| AuthModule | myfy.web.auth | Type-based authentication, protected routes |
| RateLimitModule | myfy.web.ratelimit | Rate limiting per IP or user |
Module Protocol
from myfy.core import BaseModule, Container, SINGLETON
class MyModule(BaseModule):
"""Custom module following the Module protocol."""
def __init__(self):
super().__init__(name="my-module")
@property
def requires(self) -> list[type]:
"""Module types this module depends on."""
return [] # e.g., [WebModule, DataModule]
@property
def provides(self) -> list[type]:
"""Extension protocols this module implements."""
return [] # e.g., [IWebExtension]
def configure(self, container: Container) -> None:
"""Phase 1: Register providers in DI container."""
container.register(
type_=MyService,
factory=lambda: MyService(),
scope=SINGLETON,
)
def extend(self, container: Container) -> None:
"""Phase 2: Modify other modules' registrations (optional)."""
pass
def finalize(self, container: Container) -> None:
"""Phase 3: Configure singletons after compilation (optional)."""
# Safe to get singletons here - container is compiled
service = container.get(MyService)
service.setup()
async def start(self) -> None:
"""Phase 4: Start runtime services (connect to DB, etc.)."""
pass
async def stop(self) -> None:
"""Phase 5: Cleanup resources gracefully."""
pass
Lifecycle Phases
- Discovery - Application discovers all modules
- Dependency Validation - Validates module dependency graph
- Configure - Each module registers services in DI
- Extend - Modules can modify other modules' registrations
- Compile - DI container builds injection plans
- Finalize - Modules configure singleton services
- Start - Runtime services start (in dependency order)
- Stop - Graceful shutdown (reverse order)
Module Dependencies
Declare dependencies via the requires property:
from myfy.web import WebModule
from myfy.data import DataModule
class MyModule(BaseModule):
@property
def requires(self) -> list[type]:
# This module needs WebModule and DataModule to be registered
return [WebModule, DataModule]
The application validates all required modules are present and initializes them in topological order.
Registering Settings
Modules typically register their own settings:
from myfy.core.config import load_settings
from myfy.core.di.types import ProviderKey
class MyModule(BaseModule):
def __init__(self, settings: MySettings | None = None):
super().__init__("my-module")
self._settings = settings
def configure(self, container: Container) -> None:
# Check if settings already registered (avoid double registration)
key = ProviderKey(MySettings)
if key not in container._providers:
if self._settings is None:
self._settings = load_settings(MySettings)
container.register(
type_=MySettings,
factory=lambda: self._settings,
scope=SINGLETON,
)
Extension Protocols
Define extension interfaces using provides:
from myfy.web.extensions import IWebExtension
class MyModule(BaseModule):
@property
def provides(self) -> list[type]:
return [IWebExtension]
def finalize(self, container: Container) -> None:
# Access ASGIApp after compilation
asgi_app = container.get(ASGIApp)
asgi_app.app.mount("/my-path", MyASGIApp())
Complete Module Example
"""
MyFeature module for myfy.
Provides feature X with Y capabilities.
"""
from __future__ import annotations
import logging
from typing import TYPE_CHECKING
from myfy.core import BaseModule, SINGLETON
from myfy.core.config import load_settings
from myfy.core.di.types import ProviderKey
from .config import MyFeatureSettings
from .service import MyFeatureService
if TYPE_CHECKING:
from myfy.core.di import Container
logger = logging.getLogger(__name__)
class MyFeatureModule(BaseModule):
"""
MyFeature module.
Features:
- Feature capability 1
Установить module-development в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл module-development?
myfy module protocol, lifecycle phases, and extension patterns. Use when creating new modules, working with configure/extend/finalize methods, module dependencies, or using WebModule, DataModule, FrontendModule, TasksModule, UserModule, CliModule, AuthModule, or RateLimitModule.
Как установить скилл module-development?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл module-development запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic