flask

$npx mdskill add partme-ai/full-stack-skills/flask

Guides Flask web development with routing, templates, extensions, and deployment for Python applications.

  • Helps users build web apps, implement routes, and create REST APIs or server-rendered pages.
  • Integrates with Flask-SQLAlchemy, Flask-Login, Jinja2, and deployment tools like Gunicorn.
  • Recommends based on user queries about Flask, web app creation, or specific framework features.
  • Delivers results through code examples, step-by-step workflows, and configuration guidance.

SKILL.md

.github/skills/flaskView on GitHub ↗
---
name: flask
description: "Provides comprehensive guidance for Flask framework including routing, templates, forms, database integration, extensions, and deployment. Use when the user asks about Flask, needs to create web applications, implement routes, or build Python web services."
license: Complete terms in LICENSE.txt
---

## When to use this skill

Use this skill whenever the user wants to:
- Build Python web applications with Flask routing and templates
- Configure WSGI, blueprints, extensions, and deployment
- Integrate Flask-SQLAlchemy, Flask-Login, or other extensions
- Create REST APIs or serve server-rendered pages with Jinja2

## How to use this skill

### Workflow

1. **Create app** — instantiate Flask and define routes
2. **Add templates** — use Jinja2 for HTML rendering
3. **Organize with blueprints** — split features into blueprint modules
4. **Configure and deploy** — set environment config, deploy with Gunicorn

### Quick Start Example

```python
# app.py
from flask import Flask, render_template, request, jsonify

app = Flask(__name__)
app.config['SECRET_KEY'] = 'change-me-in-production'

@app.route('/')
def index():
    return render_template('index.html', title='Home')

@app.route('/api/items', methods=['GET', 'POST'])
def items():
    if request.method == 'POST':
        data = request.get_json()
        # Process and save item
        return jsonify({'status': 'created', 'item': data}), 201
    return jsonify({'items': []})

if __name__ == '__main__':
    app.run(debug=True)
```

### Application Factory Pattern

```python
# __init__.py
from flask import Flask

def create_app(config_name='default'):
    app = Flask(__name__)
    app.config.from_object(config[config_name])

    # Initialize extensions
    db.init_app(app)
    login_manager.init_app(app)

    # Register blueprints
    from .auth import auth_bp
    app.register_blueprint(auth_bp, url_prefix='/auth')

    from .main import main_bp
    app.register_blueprint(main_bp)

    return app
```

```bash
# Development
flask --app app run --debug

# Production
gunicorn -w 4 -b 0.0.0.0:8000 "app:create_app()"
```

### Blueprint Example

```python
# auth/routes.py
from flask import Blueprint, render_template, redirect, url_for

auth_bp = Blueprint('auth', __name__, template_folder='templates')

@auth_bp.route('/login', methods=['GET', 'POST'])
def login():
    if request.method == 'POST':
        # Authenticate user
        return redirect(url_for('main.index'))
    return render_template('auth/login.html')
```

## Best Practices

- Use the application factory pattern with blueprints for modularity
- Keep sensitive configuration out of source code — use environment variables
- Deploy with Gunicorn or uWSGI behind a reverse proxy (nginx)
- Enable CSRF protection with Flask-WTF; set security headers
- Use `flask shell` for interactive debugging with app context

## Reference

- Official documentation: https://flask.palletsprojects.com/

## Keywords

flask, Python web, routing, templates, Jinja2, blueprints, WSGI, REST API, Gunicorn

More from partme-ai/full-stack-skills

SkillDescription
adobe-xd"Guides creation of UI/UX designs, interactive prototypes, reusable components, and design specs in Adobe XD. Use when the user asks about Adobe XD artboards, prototype links, repeat grids, component states, design tokens export, or developer handoff."
angular"Provides comprehensive guidance for Angular framework including components, modules, services, dependency injection, routing, forms, and TypeScript integration. Use when the user asks about Angular, needs to create Angular applications, implement Angular components, or work with Angular features."
ansible"Provides comprehensive guidance for Ansible automation including playbooks, roles, inventory, and module usage. Use when the user asks about Ansible, needs to automate IT tasks, create Ansible playbooks, or manage infrastructure with Ansible."
ant-design-mini"Builds mini-program UIs with Ant Design Mini components for Alipay and WeChat mini-programs. Covers Button, Form, List, Modal, Tabs, NavBar, and 60+ components with theme customization and CSS variable theming. Use when the user needs to create mini-program interfaces with Ant Design Mini, configure themes, or implement mini-program-specific UI patterns."
ant-design-mobile"Builds React mobile UIs with Ant Design Mobile (antd-mobile) components including Button, Form, List, Modal, Picker, Tabs, PullToRefresh, InfiniteScroll, and 50+ mobile-optimized components. Use when the user needs to create mobile-first React interfaces, implement mobile navigation, forms, or data display with Ant Design Mobile."
ant-design-react"Builds enterprise React UIs with Ant Design (antd) including 60+ components (Button, Form, Table, Select, Modal, Message), design tokens, TypeScript support, and ConfigProvider theming. Use when the user needs to create React applications with Ant Design, build forms with validation, display data tables, or customize the Ant Design theme."
ant-design-vueProvides comprehensive guidance for Ant Design Vue (AntDV) component library for Vue 3. Covers installation, usage, API reference, templates, and all component categories. Use when building enterprise-class UI with Vue 3 and Ant Design.
api-doc-generator"Generate API documentation by scanning Controller classes, extracting endpoint URLs, HTTP methods, parameters, and response structures, then producing standardized docs from templates. Use when the user explicitly mentions generating API documentation, creating API docs, scanning interfaces, or documenting REST APIs. Do not trigger for generic documentation requests without explicit API mention."
appium"Provides comprehensive guidance for Appium mobile testing including mobile app automation, element location, gestures, and cross-platform testing. Use when the user asks about Appium, needs to test mobile applications, automate mobile apps, or write Appium test scripts."
ascii-ansi-colorizer"Add an ANSI color layer to existing ASCII/plain-text output (gradient/rainbow/highlights) with alignment-safe rules and a required no-color fallback. Use when the user wants to colorize terminal output, add rainbow effects to CLI text, or style ASCII art with ANSI colors."