skills/sraloff/gravityboots/django-flask-patterns

django-flask-patterns

SKILL.md

Django / Flask Patterns

When to use this skill

  • Maintaining Django or Flask applications.
  • Writing migrations.
  • Working with templates (Jinja2/DTL).

1. Django

  • Models: Fat models, thin views. Put business logic in Model methods or Managers.
  • CBV vs FBV: Context dependent, but stick to one style per project. Function-Based Views often cleaner for simple logic.
  • ORM: Use select_related (FK) and prefetch_related (M2M) to avoid N+1 queries.

2. Flask

  • Blueprints: Always use Blueprints to organize routes.
  • Application Factory: Use the create_app() pattern for better testing and config management.
  • Extensions: Initialize extensions (db.init_app(app)) inside the factory.
Weekly Installs
3
GitHub Stars
2
First Seen
Feb 21, 2026
Installed on
opencode3
gemini-cli3
github-copilot3
codex3
kimi-cli3
amp3