advanced-alchemy-flask
SKILL.md
Flask
Execution Workflow
- Choose
SQLAlchemySyncConfigby default, orSQLAlchemyAsyncConfigonly when Flask async routes are intentional and supported. - Initialize
AdvancedAlchemywith the app and use its session helpers rather than global engine state. - Use
bind_keyonly when the application truly needs multiple databases. - Wrap CRUD-heavy services with
FlaskServiceMixinwhen itsjsonify()helper meaningfully simplifies responses. - Use
flask databasecommands once migrations are wired through the extension.
Implementation Rules
- Keep
commit_modeexplicit:manual,autocommit, orautocommit_include_redirect. - Prefer request or app-context-managed sessions over module-level state.
- Translate Flask query params into Advanced Alchemy filters near the route boundary.
- Use async sessions in sync routes only with care; that path is documented as experimental.
Example Pattern
from advanced_alchemy.extensions.flask import AdvancedAlchemy, SQLAlchemySyncConfig
from flask import Flask
app = Flask(__name__)
alchemy = AdvancedAlchemy(
SQLAlchemySyncConfig(connection_string="sqlite:///local.db", commit_mode="autocommit"),
app,
)
Validation Checklist
- Confirm sessions are opened inside request or app context and closed cleanly.
- Confirm the chosen commit mode matches endpoint behavior, including redirects if relevant.
- Confirm
flask database --helpexposes migration commands when expected. - Confirm
FlaskServiceMixin.jsonify()returns the intended serialization format.
Cross-Skill Handoffs
- Use
advanced-alchemy-repositoriesandadvanced-alchemy-servicesfor the persistence layer itself. - Use
advanced-alchemy-clifor migration command semantics behind Flask CLI wrappers. - Use
advanced-alchemy-database-seedingfor fixture loading during app initialization or admin workflows.
Advanced Alchemy References
Weekly Installs
4
Repository
alti3/litestar-skillsGitHub Stars
5
First Seen
7 days ago
Security Audits
Installed on
cline4
gemini-cli4
github-copilot4
codex4
kimi-cli4
cursor4