generating-orm-code
Installation
SKILL.md
ORM Code Generator
Overview
Generate type-safe ORM model classes, migration files, and repository patterns from existing database schemas or domain specifications. Supports Prisma, TypeORM, Sequelize, SQLAlchemy, Django ORM, and Drizzle ORM.
Prerequisites
- Database connection string or credentials for schema introspection
psqlormysqlCLI for queryinginformation_schema- Target ORM framework already installed in the project (
prisma,typeorm,sqlalchemy, etc.) - Node.js/Python/Go runtime matching the target ORM
- Existing project structure to place generated models in the correct directory
Instructions
-
Introspect the database schema by querying
information_schema.COLUMNS,information_schema.TABLE_CONSTRAINTS, andinformation_schema.KEY_COLUMN_USAGEto extract all tables, columns, data types, nullable flags, defaults, primary keys, foreign keys, and unique constraints. -
For PostgreSQL, additionally query
pg_catalog.pg_typefor custom enum types andpg_catalog.pg_indexfor index definitions. For MySQL, queryinformation_schema.STATISTICSfor index details.
Related skills