database-skill

Generates SQLAlchemy models, Alembic migrations, and PostgreSQL queries for database persistence.

Updated Mar 12, 2026
One-click install
npx skills add https://github.com/tendercoconut174/ai-agent-platform --skill database-skill-tendercoconut174
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: database-skill
Source: https://github.com/tendercoconut174/ai-agent-platform/tree/main/.cursor/skills/database-skill
Command: npx skills add https://github.com/tendercoconut174/ai-agent-platform --skill database-skill-tendercoconut174

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Designing database schemas, writing migrations, and managing SQLAlchemy sessions involves repetitive boilerplate and easy-to-miss conventions. This Skill standardizes how models, migrations, and queries are generated so persistence code stays consistent across services. ## Core Features & Use Cases - Model Generation: Creates SQLAlchemy 2.0 declarative models with explicit primary keys and typed attributes, separated from Pydantic API schemas. - Migration Management: Generates Alembic migrations via autogenerate with rules for reviewing, naming, and never editing applied migrations. - Session & Connection Handling: Enforces environment-based connection strings, connection pooling, and context-managed session lifecycles. - Use Case: When adding a new orders table to a microservice, use this Skill to generate the SQLAlchemy model, produce the Alembic migration, and scaffold repository queries following project conventions. ## Quick Start Generate a SQLAlchemy model and Alembic migration for a new users table with email and created_at columns.

Frequently Asked Questions about database-skill

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate SQLAlchemy models with Alembic migrations?▼

Define models using SQLAlchemy 2.0 declarative style with explicit primary keys, then run alembic revision --autogenerate to create the migration. Always review the generated migration before applying it and use descriptive migration messages.

What is the difference between SQLAlchemy models and Pydantic schemas?▼

SQLAlchemy models handle database persistence and table mapping, while Pydantic schemas validate and serialize API data. Keep them separate: use SQLAlchemy for storage layers and Pydantic for request and response boundaries.

Can I edit an Alembic migration after it has been applied?▼

No, applied migrations must never be edited because they represent recorded schema history. Instead, generate a new migration that performs the corrective change on top of the existing one.

How should database sessions be managed in workers and agents?▼

Use context managers to control session lifecycle so connections are always released. Workers and agents must not hold long-lived database connections; prefer connection pooling for production workloads.

Why should database connection strings use environment variables?▼

Environment variables keep credentials out of source code and allow the same code to run against different databases per environment. This is the required approach for connection configuration in this workflow.