$120 tested Claude codes · real before/after data · Full tier $15 one-timebuy --sheet=15 →
$Free 40-page Claude guide — setup, 120 prompt codes, MCP servers, AI agents. download --free →
clskills.sh — terminal v2.4 — 2,347 skills indexed● online
[CL]Skills_
PythonbeginnerNew

Flask Setup

Share

Scaffold Flask application with blueprints and extensions

Works with OpenClaude

You are a Python web developer. The user wants to scaffold a Flask application with blueprints and extensions for modular, production-ready structure.

What to check first

  • Verify Python 3.8+ is installed: python --version
  • Check pip is available: pip --version
  • Ensure you have a project directory ready or create one with mkdir flask_app && cd flask_app

Steps

  1. Create a virtual environment: python -m venv venv and activate it (source venv/bin/activate on macOS/Linux, or venv\Scripts\activate on Windows)
  2. Install Flask and essential extensions: pip install flask flask-sqlalchemy flask-migrate flask-login python-dotenv
  3. Create the project structure with folders: mkdir app, mkdir app/auth, mkdir app/main, mkdir migrations
  4. Create app/__init__.py and initialize extensions (SQLAlchemy, Migrate, LoginManager) before blueprint registration
  5. Create app/auth/routes.py and app/main/routes.py with blueprint definitions using Blueprint(name, __name__)
  6. Create app/models.py with database models using SQLAlchemy ORM
  7. Create run.py as the entry point that creates the app with create_app() factory function
  8. Create .env file with FLASK_ENV=development and SECRET_KEY=your-secret-key
  9. Initialize the database: flask db init, then flask db migrate -m "Initial migration", then flask db upgrade
  10. Run the server: flask run and verify it starts on http://127.0.0.1:5000

Code

# app/__init__.py
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from flask_login import LoginManager
import os
from dotenv import load_dotenv

load_dotenv()

db = SQLAlchemy()
migrate = Migrate()
login_manager = LoginManager()

def create_app(config_name='development'):
    app = Flask(__name__)
    
    # Configuration
    app.config['SECRET_KEY'] = os.getenv('SECRET_KEY', 'dev-secret-key')
    app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv(
        'DATABASE_URL', 
        'sqlite:///app.db'
    )
    app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
    
    # Initialize extensions
    db.init_app(app)
    migrate.init_app(app, db)
    login_manager.init_app(app)
    login_manager.login_view = 'auth.login'
    
    # Register blueprints
    from app.auth import auth_bp
    from app.main import main_bp
    
    app.register_blueprint(auth_bp, url_

Note: this example was truncated in the source. See the GitHub repo for the latest full version.

Common Pitfalls

  • Treating this skill as a one-shot solution — most workflows need iteration and verification
  • Skipping the verification steps — you don't know it worked until you measure
  • Applying this skill without understanding the underlying problem — read the related docs first

When NOT to Use This Skill

  • When a simpler manual approach would take less than 10 minutes
  • On critical production systems without testing in staging first
  • When you don't have permission or authorization to make these changes

How to Verify It Worked

  • Run the verification steps documented above
  • Compare the output against your expected baseline
  • Check logs for any warnings or errors — silent failures are the worst kind

Production Considerations

  • Test in staging before deploying to production
  • Have a rollback plan — every change should be reversible
  • Monitor the affected systems for at least 24 hours after the change

Quick Info

CategoryPython
Difficultybeginner
Version1.0.0
AuthorClaude Skills Hub
pythonflaskweb

Install command:

curl -o ~/.claude/skills/flask-setup.md https://claude-skills-hub.vercel.app/skills/python/flask-setup.md

Related Python Skills

Other Claude Code skills in the same category — free to download.

Want a Python skill personalized to YOUR project?

This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.