fastsqla-session
Skill by hadrien
Manages async SQLAlchemy sessions in FastSQLA endpoints and background tasks. It covers the Session dependency, flush versus commit rules, IntegrityError handling, and open_session(). Written for developers using FastAPI with FastSQLA.
Install fastsqla-session
Built from the published package, never by AI.
git clone --depth 1 https://github.com/hadrien/FastSQLA /tmp/FastSQLA && mkdir -p ~/.claude/skills && cp -r /tmp/FastSQLA/plugin/fastsqla/skills/fastsqla-session ~/.claude/skills/fastsqla-sessionRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/hadrien/FastSQLA /tmp/FastSQLA && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/FastSQLA/plugin/fastsqla/skills/fastsqla-session ~/.gemini/antigravity-cli/skills/fastsqla-sessionAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
The fastsqla-session skill gives an AI assistant guidance for managing async SQLAlchemy sessions in FastSQLA endpoints and background tasks. It explains the Session dependency, which commits on success, rolls back on an exception and always closes the session. It also covers flush versus commit rules, handling IntegrityError, and the open_session() context manager for code outside endpoints.
The skill is aimed at developers building FastAPI endpoints or background tasks that use a database through FastSQLA. It advises against calling session.commit() inside endpoints and recommends session.flush() when server-generated values such as IDs are needed. It shows how to re-raise IntegrityError as an HTTPException, and the source includes code examples for each pattern.
Written from the project's SKILL.md and checked against it.
What it can do
- Session dependencyInjects an async session into FastAPI endpoints with automatic commit, rollback and close.
- flush vs commit rulesAdvises flush() for server-generated values and against manual commit() in endpoints.
- IntegrityError handlingShows how to catch IntegrityError after flush() and re-raise it as an HTTPException.
- open_session()Describes an async context manager for background tasks, scripts and scheduled jobs.
What you need
- FastAPI
- SQLAlchemy (async)
- FastSQLA
Try asking
- Write a FastAPI endpoint that creates a hero and returns its generated id
- Add IntegrityError handling to my unique-email user creation endpoint
- Write a background task that updates rows using open_session()
Good to know
- Calling session.commit() inside an endpoint breaks the auto-commit lifecycle, according to the source.
- The session is invalidated after an IntegrityError and cannot be used for further queries.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: plugin/fastsqla/skills/fastsqla-session/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Alternatives to fastsqla-session
All alternatives →Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.
Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.
Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.
Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.
Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.
Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.
Compare with openclaw-github-repo-commander, gradio or hig-components-menus
fastsqla-session: common questions
When should I use flush() instead of commit() in FastSQLA?
Use flush() when you need server-generated data such as auto-increment IDs before the response returns. The source says not to call commit() in endpoints because FastSQLA commits automatically.
What happens if the commit fails inside open_session()?
The session is rolled back and closed, and the commit exception is re-raised. The source says this prevents a silent failure.
How does FastSQLA handle exceptions in endpoints?
If an exception is raised, the session is rolled back automatically and then closed. Raising an HTTPException after an IntegrityError triggers this rollback.
How do I install fastsqla-session?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is fastsqla-session free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is fastsqla-session safe to use?
It scores 70 of 100. Grades: maintenance A, licence A, quality B. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to fastsqla-session?
Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.
