format-migration
Format TypeORM migrations with beautifully formatted SQL code. Use this skill after generating migrations to ensure consistent SQL formatting.
Install
mkdir -p .claude/skills/format-migration && curl -L -o skill.zip "https://mcp.directory/api/skills/download/3911" && unzip -o skill.zip -d .claude/skills/format-migration && rm skill.zipInstalls to .claude/skills/format-migration
About this skill
TypeORM Migration Formatter
You are an expert in TypeORM and PostgreSQL 18. You will format TypeORM migrations to be beautifully formatted SQL code.
Formatting Rules
1. Always Provide Full Migration Code
Present the entire MigrationInterface class, not just snippets. This helps maintain context and prevents errors.
2. Explicitly State Changes
Clearly mention any new columns, constraints, indexes, or other SQL features you're adding or modifying.
3. SQL Formatting Style
All SQL within queryRunner.query() must be multi-line, wrapped in /* sql */\ `blocks, with/* sql */on the same line asawait queryRunner.query`:
await queryRunner.query(/* sql */ `
CREATE TABLE "example" (
"id" uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
"name" text NOT NULL
)
`);
4. ALTER TABLE Formatting
Use consistent indentation for ALTER TABLE clauses:
await queryRunner.query(/* sql */ `
ALTER TABLE "table_name"
ALTER COLUMN "column_name" SET DEFAULT 'value'
`);
5. Foreign Key Constraints in CREATE TABLE
Split across multiple lines:
await queryRunner.query(/* sql */ `
CREATE TABLE "example" (
"id" uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
"otherId" uuid NOT NULL,
CONSTRAINT "FK_example_other"
FOREIGN KEY ("otherId")
REFERENCES "other_table"("id")
ON DELETE CASCADE
ON UPDATE NO ACTION
)
`);
6. Index Handling
CREATE INDEXinupshould always includeIF NOT EXISTSDROP INDEXindownshould always includeIF EXISTS
// up
await queryRunner.query(/* sql */ `
CREATE INDEX IF NOT EXISTS "IDX_example_column"
ON "example" ("column")
`);
// down
await queryRunner.query(/* sql */ `
DROP INDEX IF EXISTS "IDX_example_column"
`);
7. Atomic CREATE TABLE
Define all possible constraints (Primary Key, Unique, Foreign Key) directly within the CREATE TABLE statement itself. Do not use ALTER TABLE ADD CONSTRAINT for foreign keys that can be defined inline during CREATE TABLE.
8. Concise down Migrations
- When constraints (PK, FK) are defined within
CREATE TABLE, they will be implicitly dropped with the table. Do not include explicitDROP CONSTRAINTfor them indown. - Indexes created on the same table are also implicitly dropped when the table is dropped. Do not include explicit
DROP INDEXindownfor table-bound indexes. - If an index is created on a column that is subsequently dropped, that index is implicitly dropped with the column.
- The
downmigration for aCREATE TABLEshould typically just beDROP TABLE. - If you're dropping and re-adding columns, ensure corresponding
COMMENT ON COLUMN ... IS NULLis indownif a comment was added inup.
9. Single Query Per Statement
Each queryRunner.query() call should only execute a single SQL query.
10. No Comments
You will not add any comments to the code. Any existing comments will be left there.
Example Migration
import type { MigrationInterface, QueryRunner } from 'typeorm';
export class CreateUserProfile1234567890123 implements MigrationInterface {
name = 'CreateUserProfile1234567890123';
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(/* sql */ `
CREATE TABLE "user_profile" (
"id" uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
"userId" text NOT NULL,
"bio" text,
"avatarUrl" text,
"createdAt" timestamp NOT NULL DEFAULT now(),
"updatedAt" timestamp NOT NULL DEFAULT now(),
CONSTRAINT "FK_user_profile_user"
FOREIGN KEY ("userId")
REFERENCES "user"("id")
ON DELETE CASCADE
ON UPDATE NO ACTION
)
`);
await queryRunner.query(/* sql */ `
CREATE INDEX IF NOT EXISTS "IDX_user_profile_userId"
ON "user_profile" ("userId")
`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(/* sql */ `
DROP TABLE "user_profile"
`);
}
}
Best Practice Suggestions
When reviewing migrations, point out opportunities to improve:
- Generic PK names (e.g.,
PK_tablenameinstead of auto-generated names) - Nullable foreign keys where appropriate
- Missing indexes on frequently queried columns
- Proper use of
ON DELETEbehavior
Instructions
When the user asks you to format a migration:
- Read the migration file
- Apply all formatting rules above
- Present the complete formatted migration
- If there are best practice improvements, mention them as suggestions
- Keep replies short unless explanations are needed
When migrations are generated via pnpm run db:migrate:make:
- The auto-lint hook will run ESLint
- Use this skill to format the SQL for readability
- Review for schema drift (unrelated changes from local DB differences)
More by dailydotdev
View all skills by dailydotdev →You might also like
flutter-development
aj-geddes
Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.
drawio-diagrams-enhanced
jgtolentino
Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.
godot
bfollington
This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.
ui-ux-pro-max
nextlevelbuilder
"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."
nano-banana-pro
garg-aayush
Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.
fastapi-templates
wshobson
Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.
Related MCP Servers
Browse all serversRefactor enables regex-based code refactoring for bulk search-and-replace, pattern matching, and large-scale code transf
Unlock AI-ready web data with Firecrawl: scrape any website, handle dynamic content, and automate web scraping for resea
Build persistent semantic networks for enterprise & engineering data management. Enable data persistence and memory acro
Optimize your codebase for AI with Repomix—transform, compress, and secure repos for easier analysis with modern AI tool
Supercharge your AI code assistant with GitMCP—get accurate, up-to-date code and API docs from any GitHub project. Free,
JsonDiffPatch: compare and patch JSON with a compact delta format capturing additions, edits, deletions, and array moves
Stay ahead of the MCP ecosystem
Get weekly updates on new skills and servers.