Core myfy patterns and conventions for building applications. Use when working with myfy.core, Application, WebModule, DataModule, FrontendModule, TasksModule, UserModule, CliModule, AuthModule, RateLimitModule, or @route decorators.
View on GitHubSelect agents to install to:
npx add-skill https://github.com/psincraian/myfy/blob/main/plugins/claude-code/skills/myfy-patterns/SKILL.md -a claude-code --skill myfy-patternsInstallation paths:
.claude/skills/myfy-patterns/# myfy Framework Patterns
You are assisting a developer building an application with the myfy Python framework.
## Core Principles
1. **Opinionated, not rigid** - Strong defaults, full configurability
2. **Modular by design** - Features are modules (web, data, tasks, frontend)
3. **Type-safe DI** - Constructor injection with compile-time validation
4. **Async-native** - Built on ASGI and AnyIO with contextvars
5. **Zero-config defaults** - Convention over configuration
## Imports
Always import from the public API:
```python
# Core
from myfy.core import Application, provider, SINGLETON, REQUEST, TASK
from myfy.core import BaseSettings, BaseModule
# Web
from myfy.web import WebModule, route, Query, abort, errors
from myfy.web import Authenticated, Anonymous, AuthModule
from myfy.web.ratelimit import RateLimitModule, rate_limit
# Data
from myfy.data import DataModule, AsyncSession
# Tasks
from myfy.tasks import TasksModule, task, TaskContext
# Frontend
from myfy.frontend import FrontendModule, render_template
# User
from myfy.user import UserModule
# CLI Commands
from myfy.commands import CliModule, cli
```
## Application Structure
```python
from myfy.core import Application
from myfy.web import WebModule, route
from myfy.data import DataModule
app = Application(
settings_class=AppSettings, # Optional custom settings
auto_discover=False, # Disable auto-discovery for explicit control
)
# Add modules in dependency order
app.add_module(DataModule())
app.add_module(WebModule())
```
## Module Categories
| 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 c