skills/generating-typeorm-migration/SKILL.md
Explains how to create and review TypeORM migrations. Use this skill whenever the user wants to change an entity, add or update schema-related database objects, generate a migration, or decide whether a database change should be handled through TypeORM metadata or a custom migration.
npx skillsauth add ilya-valasiuk/agent-skills generating-typeorm-migrationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill covers the end-to-end process for creating a TypeORM database migration. It ensures migrations are generated correctly, named clearly, and never run automatically. Follow these steps in order every time.
Modify the relevant TypeORM entity file (located in apps/api/src/core/<domain>/entities/ or libs/). Add or change columns, indexes, relations, etc. using TypeORM decorators.
Use generated migrations by default. Do not write migration SQL by hand unless TypeORM cannot represent the database object you need.
Run the following command from the project root, passing a --name flag with a clear descriptive slug:
npm run migration:api:generate --name=<migration-name>
The name becomes part of the filename: apps/api/src/database/migrations/<timestamp>-<migration-name>.ts. Choose it carefully upfront — use kebab-case and follow the conventions from existing migrations:
add- — adding a column, index, constraint, or triggerremove- / delete- / drop- — removing somethingcreate- — creating a new tableupdate- / rename- / replace- / normalize- — modifying existing data or structuremigrate- — moving/transforming data between columns or tablesnew- — introducing a new enum value or entityExamples from this project:
npm run migration:api:generate --name=add-new-office-index
npm run migration:api:generate --name=create-integration-table
npm run migration:api:generate --name=migrate-office-and-remcat-sources-to-integration-source
npm run migration:api:generate --name=add-has-active-office-to-place-trigger
npm run migration:api:generate --name=new-integration-mapper-enum
If the required database change cannot be expressed in TypeORM entity metadata, do not force it into the entity with a fake column or workaround just to make migration generation pass.
Typical examples:
USING GIST (ST_Transform(geom, 2056))In these cases:
npm run migration:api:create --name=<migration-name>
up() / down() SQL required.If you need a concrete project example for a custom migration plus matching entity comment, read references/custom-migration-example.md.
Open the newly created file and verify:
up() method contains only the expected changes.down() method correctly reverts them.If the diff looks wrong, check whether other entities have unsaved changes that were picked up unintentionally.
For hand-written custom migrations, review the same way:
Never run npm run migration:api:run automatically. The developer runs migrations manually at the right time (e.g., before a deployment or after coordinating with the team).
Do not suggest running the migration. Do not run it "just to test". Simply leave the generated file in place and inform the user that the migration is ready and they should run it when appropriate.
| Command | Purpose |
| ---------------------------------------------- | ---------------------------------------------------- |
| npm run migration:api:generate --name=<name> | Generate a migration from entity changes |
| npm run migration:api:create --name=<name> | Create an empty migration file for custom/manual SQL |
| npm run migration:api:show | List applied/pending migrations |
| npm run migration:api:run | Run manually only — never automated |
| npm run migration:api:revert | Revert the last migration |
apps/api/src/core/<domain>/entities/ or libs/domains/apps/api/src/database/migrations/apps/api/src/config/typeorm.config.tstools
Standardize and preserve Next.js App Router project structure across `src/`, including route files, page composition, API modules, server actions, hooks, providers, helpers, and shared utilities. Use this skill whenever the user asks to add, move, rename, refactor, or review files in a Next.js App Router codebase, especially if the task affects file placement, page architecture, or folder naming.
testing
Prepare and open pull requests using the team's PR template, including a short PR title, diff-based classification into Features and Fixes, and an approval checkpoint before any push or PR creation. Use when the user asks to create, draft, preview, or open a pull request.
development
Enforces classNames package usage patterns and Tailwind CSS class ordering conventions in React components. Use this skill whenever writing or reviewing component className props, applying Tailwind classes, using the classnames package, organizing breakpoint-specific styles, writing conditional class expressions, or when the user asks about CSS class ordering, mobile-first responsive patterns, or how to handle className props in components.
development
Builds, restructures, and standardizes React components according to project conventions (placement, folder/file naming, exports, props patterns). Use when adding components or when reorganizing existing components during refactors, migrations, or component moves.