stack-flask-sqlalchemy
Flask + SQLAlchemy architecture plugin. How the application factory, the Flask-SQLAlchemy session, Alembic migrations and Jinja2 templates fit together: where db is created, the app context, the transaction boundary, expire_on_commit, N+1 at the route-to-template edge, and a full-feature recipe. Tool knowledge comes from its dependencies flask-dev and sqlalchemy-dev.
v2.0.4Updated
- stack
- flask-sqlalchemy
- architecture
- agents-store
- flask
- sqlalchemy
- python
- alembic
Install
Pick your agent for the steps.
Install on Claude Code
1.Add the marketplace
/plugin marketplace add Agents-Store/claude-plugins2.Install the plugin
/plugin install stack-flask-sqlalchemy@agents-store-claude-pluginsType it inside Claude Code.
Install on GitHub Copilot CLI
1.Add the marketplace
copilot plugin marketplace add Agents-Store/claude-plugins2.Install the plugin
copilot plugin install stack-flask-sqlalchemy@agents-store-claude-plugins
GitHub Copilot CLI does not receive: commands, agents.
Install on Cursor
1.Manual install
Cursor has no install command for a single plugin. Copy the plugin's folder from its place in the mirror on GitHub into the place Cursor reads plugins from.
Cursor’s plugin documentation now lives at docs.grok.com (cursor.com/docs/plugins redirects there). Plugins come from its marketplace, a team marketplace or a local folder.
Install on Codex
1.Add the marketplace
codex plugin marketplace add Agents-Store/codex-plugins2.Install the plugin
codex plugin add stack-flask-sqlalchemy@agents-store-codex-plugins
Codex does not receive: commands, agents.
Install on Gemini CLI
1.Clone the mirror
git clone https://github.com/Agents-Store/gemini-extensions2.Install the plugin
gemini extensions link ./gemini-extensions/stack-flask-sqlalchemyRun it from the folder you cloned into.
Consumer access to Gemini CLI ended on 2026-06-18. This target serves enterprise Gemini Code Assist; Antigravity is the consumer successor.
Install on Antigravity
1.Clone the mirror
git clone https://github.com/Agents-Store/antigravity-skills2.Install the plugin
agy plugin install ./antigravity-skills/stack-flask-sqlalchemyRun it from the folder you cloned into.
Antigravity does not receive: commands.
Install on Kimi Code
1.Clone the mirror
git clone https://github.com/Agents-Store/kimi-plugins2.Install the plugin
/plugins install ./kimi-plugins/stack-flask-sqlalchemyRun it from the folder you cloned into, and type it inside Kimi Code.
Kimi Code does not receive: commands, agents, hooks, MCP servers.
Install on Devin
1.Install the plugin
devin plugins install Agents-Store/devin-plugins#stack-flask-sqlalchemy
Devin does not receive: commands, agents, hooks, MCP servers.
Install on Hermes Agent
1.Install the plugin
hermes plugins install Agents-Store/hermes-plugins/stack-flask-sqlalchemy
Hermes Agent does not receive: commands, agents, hooks, MCP servers.
Install on OpenCode
1.Manual install
OpenCode has no install command for a single plugin. Copy the plugin's folder from its place in the mirror on GitHub into the place OpenCode reads plugins from.
OpenCode does not receive: hooks.
Install on Pi
1.Manual install
Pi has no install command for a single plugin. Copy the plugin's folder from its place in the mirror on GitHub into the place Pi reads plugins from.
Pi does not receive: commands, agents, hooks, MCP servers.
Install on OpenClaw
1.Clone the mirror
git clone https://github.com/Agents-Store/openclaw-generated-plugins2.Install the plugin
openclaw plugins install ./openclaw-generated-plugins/stack-flask-sqlalchemyRun it from the folder you cloned into.
OpenClaw does not receive: commands, agents, hooks, MCP servers.
Install on Agent Plugins 1.0
1.Manual install
Agent Plugins 1.0 has no install command for a single plugin. Copy the plugin's folder from its place in the mirror on GitHub into the place Agent Plugins 1.0 reads plugins from.
Agent Plugins 1.0 does not receive: commands, agents, hooks.
What is inside
Skills (2)
- full-feature
Use when the user asks to "add a new feature", "create a new page", "build CRUD for a new entity", "add a new section to the app", "implement a full feature end-to-end", or needs a step-by-step recipe for building a complete feature across Flask + SQLAlchemy layers.
- layers-and-boundaries
Use when the user asks about "Flask SQLAlchemy architecture", "where to create db in Flask", "Flask app context and SQLAlchemy session", "when to commit in Flask", "Flask transaction boundary", "expire_on_commit in Flask-SQLAlchemy", "DetachedInstanceError in Flask", "Working outside of application context", "N+1 in a Jinja template", "lazy raise in Flask", "data saved in tests but lost in production", or needs the rules for where each layer of a Flask + SQLAlchemy app starts and ends.
Agents (1)
- stack-orchestrator
Use this agent when the user needs help coordinating work across Flask and SQLAlchemy layers — building features that span models, routes, and templates, debugging cross-layer issues, or planning multi-step implementations. <example> Context: User is building a new feature end-to-end user: "Build a finance tracking page where I can add expenses and see monthly earnings from appointments" assistant: "I'll use the stack-orchestrator agent to coordinate the implementation across model, routes, and templates." <commentary> Feature spans all layers — model (Spending), routes (finance blueprint), templates (finance.html), and queries (aggregate earnings from Appointment). Orchestrator coordinates the full implementation. </commentary> </example> <example> Context: User is debugging a cross-layer issue user: "My appointments page shows the wrong client name — it shows 'None' instead of the actual name" assistant: "I'll use the stack-orchestrator agent to trace the data flow from model through route to template." <commentary> Issue spans model relationships (Appointment→Client), the route's query (a missing joinedload, or a lazy='raise' error), and template rendering. Orchestrator traces the full data path. </commentary> </example> <example> Context: User wants to add authentication to existing pages user: "I need to add login/register and make sure each user only sees their own clients" assistant: "I'll use the stack-orchestrator agent to wire Flask-Login with the User model and add auth to all routes." <commentary> Auth touches every layer — User model, login routes, @login_required decorators, template conditionals, and query scoping by user_id (owned_by). The login flow itself is in flask-dev (auth-flask-login), the User model in sqlalchemy-dev. </commentary> </example>
README
Flask + SQLAlchemy architecture plugin for Agents Store. It describes how the application factory, the Flask-SQLAlchemy session, Alembic migrations and Jinja2 templates fit together: where db is created, what the app context owns, where the transaction ends, what expire_on_commit does to a request, and how a template stays free of queries. It names its parts in dependencies; what one tool does and how to drive it is taught by that tool's own plugin.
Note: Flask and SQLAlchemy are local Python libraries, not external services: there is no MCP server and no
.env.examplebecause there are no service URLs to configure. The value is in the boundaries.
Architecture
| Layer | Library | Role |
|---|---|---|
| Interface | Flask, Jinja2, Flask-Login, Flask-WTF | Routes, templates, sessions, CSRF |
| Data | SQLAlchemy 2.0, Flask-SQLAlchemy, Flask-Migrate (Alembic) | Models, queries, schema through migrations |
The boundaries between them are what this plugin owns:
| Boundary | Rule |
|---|---|
Where db lives | extensions.py, created without an app; the factory imports the models |
| App context | One session per app context; scripts, threads and tasks open their own and pass ids, not instances |
| Transaction | One commit() per unit of work, in the route; rollback() after an IntegrityError |
| Expiry | expire_on_commit stays on; Post/Redirect/Get; ids across contexts |
| Route to template | lazy='raise' on the model, selectinload / joinedload in the route, a statement-count test |
| Schema | Migrations only; no create_all() outside test fixtures |
Dependencies
Declared in plugin.json and installed together with the stack. They hold the tool-level knowledge:
| Plugin | Teaches |
|---|---|
flask-dev | project-scaffold (the files of a new project), auth-flask-login (login, registration, logout, CSRF), app-patterns (factory, blueprints, config, CRUD views, testing), Jinja2, the Flask CLI |
sqlalchemy-dev | Models (model-patterns, including the Flask-Login User model), queries and owner-scoped queries (query-patterns), Alembic and Flask-Migrate (cli-recipes), SQLAlchemy 2.1 |
Prerequisites
- Python 3.10 or newer
- Flask 3.1 or newer
- Flask-SQLAlchemy 3.1 with
"SQLAlchemy<2.1": a plain install resolves SQLAlchemy 2.1, and aMappedAsDataclassbase fails on it (pallets-eco/flask-sqlalchemy#1420; plaindb.Modelworks), so pinSQLAlchemy<2.1to be safe until Flask-SQLAlchemy supports 2.1:
pip install Flask Flask-SQLAlchemy "SQLAlchemy<2.1" Flask-Migrate Flask-Login Flask-WTF python-dotenv
Installation
claude plugin install stack-flask-sqlalchemy@agents-store-claude-plugins
flask-dev and sqlalchemy-dev come with it.
Skills
| Skill | Description |
|---|---|
layers-and-boundaries | Where db lives, the app context, the transaction boundary, expire_on_commit, N+1 at the route-to-template edge, what test fixtures hide |
full-feature | Step-by-step recipe for building a feature across model, migration, routes and templates |
New project: flask-dev → project-scaffold. Login: flask-dev → auth-flask-login. CRUD views: flask-dev → app-patterns. Models and queries: sqlalchemy-dev.
Agent
stack-orchestrator — Cross-layer coordinator for building features that span models, migrations, routes and templates, and for debugging problems at the boundaries.
Source
- Source on GitHub
- Mirror: Agents-Store/claude-plugins
- Mirror: Agents-Store/cursor-plugins
- Mirror: Agents-Store/codex-plugins
- Mirror: Agents-Store/gemini-extensions
- Mirror: Agents-Store/antigravity-skills
- Mirror: Agents-Store/kimi-plugins
- Mirror: Agents-Store/devin-plugins
- Mirror: Agents-Store/hermes-plugins
- Mirror: Agents-Store/opencode-plugins
- Mirror: Agents-Store/pi-extensions
- Mirror: Agents-Store/openclaw-generated-plugins
- Mirror: Agents-Store/agentplugins