flask-backend
Use when the user asks about Flask, Flask application factory, blueprints, Flask extensions (init_app), Flask-SQLAlchemy, Alembic migrations or Flask testing…
от j4flmao★ 47 звёзд на GitHub
Установить flask-backend в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Flask Backend
Purpose
Define Flask backend application architecture: lightweight server setup, blueprint organization, extension integration, and WSGI deployment.
Agent Protocol
Trigger
User request includes: flask, flask backend, flask blueprint, flask app factory, flask sqlalchemy, flask extension, flask rest api, python flask.
Input Context
- Python version (3.10+)
- Flask version (3.x)
- Database ORM (SQLAlchemy, Peewee)
- API style (REST, Flask-RESTx)
- Template engine (Jinja2, none for SPA)
- Deployment (Gunicorn, uWSGI, serverless)
Output Artifact
A markdown document containing:
- Project structure
- Application factory pattern
- Blueprint organization
- Extension initialization pattern
- Error handling (app.errorhandler)
- Configuration management
- Testing (pytest, app.test_client)
- CLI commands (click integration)
Response Format
Produce the artifact directly. No preamble, no postamble, no explanations. No filler, no hedging. Compress output.
Completion Criteria
- Application factory creates configurable app instances
- Blueprints group related routes and templates
- Extensions initialized via init_app pattern
- Error handlers registered at app level
- Tests use app.test_client fixture
Max Response Length
4096 tokens
Workflow
Step 1: Project Setup
pip install flask flask-sqlalchemy flask-migrate pydantic
pip install pytest pytest-cov # dev
pip install gunicorn # production
pip install flask-cors flask-limiter redis # optional
Step 2: Project Structure
project/
+-- app/
| +-- __init__.py
| +-- extensions.py
| +-- config.py
| +-- models/
| | +-- __init__.py
| | +-- order.py
| | +-- user.py
| +-- blueprints/
| | +-- orders/
| | | +-- __init__.py
| | | +-- routes.py
| | | +-- schemas.py
| | | +-- service.py
| | +-- products/
| | | +-- __init__.py
| | | +-- routes.py
| | | +-- service.py
| | +-- auth/
| | | +-- __init__.py
| | | +-- routes.py
| | | +-- service.py
| | +-- health/
| | +-- __init__.py
| | +-- routes.py
| +-- services/
| | +-- __init__.py
| | +-- order_service.py
| | +-- payment_service.py
| +-- utils/
| | +-- __init__.py
| | +-- errors.py
| | +-- pagination.py
| | +-- decorators.py
| +-- templates/
| +-- base.html
| +-- orders/
| +-- list.html
| +-- detail.html
+-- migrations/
+-- tests/
| +-- conftest.py
| +-- test_orders.py
| +-- test_health.py
| +-- factories.py
+-- .env
+-- .flaskenv
+-- requirements.txt
+-- wsgi.py
+-- Dockerfile
Step 3: Application Factory
# app/__init__.py
from flask import Flask
def create_app(config_object="app.config.Config") -> Flask:
app = Flask(__name__)
app.config.from_object(config_object)
app.config.from_prefixed_env()
register_extensions(app)
register_blueprints(app)
register_error_handlers(app)
register_cli_commands(app)
return app
def register_extensions(app: Flask) -> None:
from app.extensions import db, migrate
db.init_app(app)
migrate.init_app(app, db)
if app.config.get("SQLALCHEMY_DATABASE_URI"):
import flask_cors
flask_cors.CORS(app)
def register_blueprints(app: Flask) -> None:
from app.blueprints.health.routes import health_bp
from app.blueprints.orders.routes import orders_bp
from app.blueprints.auth.routes import auth_bp
app.register_blueprint(health_bp)
app.register_blueprint(orders_bp, url_prefix="/api/orders")
app.register_blueprint(auth_bp, url_prefix="/api/auth")
def register_error_handlers(app: Flask) -> None:
from app.utils.errors import register_error_handlers as _register
_register(app)
def register_cli_commands(app: Flask) -> None:
import click
@app.cli.command("seed-db")
def seed_db():
"""Seed database with sample data."""
click.echo("Seeding database...")
Step 4: Configuration Classes
# app/config.py
import os
from datetime import timedelta
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = os.environ.get("SECRET_KEY", "change-me-in-production")
SQLALCHEMY_TRACK_MODIFICATIONS = False
JSON_SORT_KEYS = False
MAX_CONTENT_LENGTH = 16 * 1024 * 1024 # 16MB
class DevelopmentConfig(Config):
DEBUG = True
SQLALCHEMY_DATABASE_URI = os.environ.get(
"DATABASE_URL", "sqlite:///" + os.path.join(basedir, "..", "dev.db")
)
class TestingConfig(Config):
TESTING = True
SQLALCHEMY_DATABASE_URI = "sqlite:///:memory:"
class ProductionConfig(Config):
DEBUG = False
SQLALCHEMY_DATABASE_URI = os.environ.get("DATABASE_URL")
SESSION_COOKIE_SECURE = True
SESSION_COOKIE_HTTPONLY = True
SESSION_COOKIE_SAMESITE = "Lax"
config_map = {
"development": DevelopmentConfig,
"testing": TestingConfig,
"production": Productio
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/flask-application-factory.md
- references/flask-blueprints-factories.md
- references/flask-deployment.md
- references/flask-extensions.md
- references/flask-restful-api-design.md
- references/flask-security.md
- references/flask-setup.md
- references/flask-testing.md
FAQ
Что делает скилл flask-backend?
Use when the user asks about Flask, Flask application factory, blueprints, Flask extensions (init_app), Flask-SQLAlchemy, Alembic migrations or Flask testing. Produces modular Flask apps. Not for FastAPI (use python-fastapi-architecture) or Django (use python-django-architecture).
Как установить скилл flask-backend?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл flask-backend запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…