typeorm

Guides TypeORM entity design, migrations, and repository patterns for TypeScript applications.

Updated Jul 9, 2026
One-click install
npx skills add https://github.com/octanutri-clin/octaclin --skill typeorm-octanutri-clin
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: typeorm
Source: https://github.com/octanutri-clin/octaclin/tree/main/.agents/skills/typeorm
Command: npx skills add https://github.com/octanutri-clin/octaclin --skill typeorm-octanutri-clin

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Developers working with TypeORM often struggle with correct entity definitions, relationship mapping, migration workflows, and avoiding pitfalls like N+1 queries or unsafe synchronize settings in production. ## Core Features & Use Cases - Entity and Relationship Modeling: Provides patterns for defining entities with decorators, primary keys, column types, and one-to-one, one-to-many, and many-to-many relationships. - Migrations and Transactions: Covers generating and running migrations, writing migration files, and handling transactions with QueryRunner or the transaction method. - NestJS Integration: Shows how to wire TypeORM into NestJS modules using TypeOrmModule.forRoot and repository injection. - Use Case: When building a NestJS backend with PostgreSQL, use this Skill to scaffold entities, generate migrations instead of relying on synchronize, and write query builder code that avoids N+1 query problems. ## Quick Start Ask the AI to create a TypeORM entity with relations and a matching migration for your PostgreSQL database.

Frequently Asked Questions about typeorm

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

FAQPage Schema
How do I define a TypeORM entity with relationships?▼

Define a class with the @Entity decorator and use @PrimaryGeneratedColumn for the ID plus @Column for fields. Add @OneToMany, @ManyToOne, or @ManyToMany decorators with @JoinColumn or @JoinTable to map relationships between entities.

How to create and run TypeORM migrations?▼

Generate a migration from entity changes with npx typeorm migration:generate, then apply it using npx typeorm migration:run with your data source file. Always use migrations instead of synchronize in production environments.

Does TypeORM work with NestJS?▼

Yes, TypeORM integrates with NestJS through the @nestjs/typeorm package. Configure TypeOrmModule.forRoot in your app module, then use TypeOrmModule.forFeature and @InjectRepository to inject repositories into services.

Why should synchronize be disabled in production TypeORM?▼

The synchronize option automatically alters the database schema to match entities, which can cause data loss in production. Use migrations instead to apply schema changes in a controlled, reversible, and versioned manner.

How do I avoid N+1 queries in TypeORM?▼

Avoid N+1 queries by eager loading relations with the relations option in find calls or by using leftJoinAndSelect in the query builder. This fetches related entities in a single query instead of one query per parent record.