claudegoodies
Command

app-factory

From davila7

Create a scalable Flask application using the factory pattern with blueprints and configuration management.

Install

/app-factory

Facts

Status
Actively maintained
Last commit

Source preview

The instructions Claude Code reads when this command runs.

# Flask Application Factory Pattern

Create a scalable Flask application using the factory pattern with blueprints and configuration management.

## Purpose

This command helps you set up a Flask application using the application factory pattern, which is the recommended approach for larger Flask applications.

## Usage

```
/app-factory
```

## What this command does

1. **Creates application factory** with proper structure
2. **Sets up configuration management** for different environments
3. **Implements blueprints** for modular design
4. **Configures extensions** (database, auth, etc.)
5. **Adds error handling** and logging

## Example Output

```python
# app/__init__.py
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from flask_login import LoginManager
from flask_mail import Mail
from flask_wtf.csrf import CSRFProtect
from flask_cors import CORS
import logging
from logging.handlers import RotatingFileHandler
import os

# Initialize extensions
db = SQLAlchemy()
migrate = Migrate()
login = LoginManager()
mail = Mail()
csrf = CSRFProtect()
cors = CORS()

def create_app(config_class=None):
    """Application factory function."""
    app = Flask(__name__)
    
    # Load configuration
    if config_class is None:
        config_class = os.environ.get('FLASK_CONFIG', 'development')
    
    if isinstance(config_class, str):
     
View full source on GitHub →

Other slash commands