go-migration-gen

Generate golang-migrate SQL migration files from Go domain structs.

Updated Jan 17, 2026
One-click install
npx skills add https://github.com/saddam-eng-tech/ai-agent-skills --skill go-migration-gen
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-migration-gen
Source: https://github.com/saddam-eng-tech/ai-agent-skills/tree/main/go-migration-gen
Command: npx skills add https://github.com/saddam-eng-tech/ai-agent-skills --skill go-migration-gen

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill automates the creation of golang-migrate compatible SQL migration files by translating Go domain structs into SQL schema definitions, ensuring consistency between your application's data models and your database schema.

Core Features & Use Cases

  • Automatic SQL Generation: Creates Up and Down migration SQL statements based on Go struct definitions.
  • Type Mapping: Correctly maps Go types to PostgreSQL data types.
  • Constraint & Index Support: Includes definitions for NOT NULL constraints and indexes as specified in the struct.
  • Soft Delete Column: Automatically adds a soft delete column if configured.
  • Makefile Integration: Updates the Makefile with new migration targets.
  • Use Case: When you define a new User struct in your Go application, use this skill to instantly generate the corresponding CREATE TABLE SQL migration file, including necessary indexes and constraints.

Quick Start

Generate a golang-migrate SQL migration file for the attached Go struct definition.

Frequently Asked Questions about go-migration-gen

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

FAQPage Schema
How do I generate SQL migration files from Go structs?

You can generate golang-migrate compatible SQL migration files directly from Go structs. The skill translates struct fields into PostgreSQL schema definitions, automatically applying NOT NULL constraints, indexes, and soft delete columns while generating matching Up and Down SQL statements.

What is the best way to map Go types to PostgreSQL data types in a SQL migration?

Mapping Go types to PostgreSQL data types in a SQL migration is handled automatically by this skill. When translating Go domain structs, it applies correct PostgreSQL type mapping rules to ensure database columns accurately match your application struct field definitions without manual conversion.

Can I automatically add soft delete columns and indexes when creating SQL migrations from Go structs?

Yes, you can automatically add soft delete columns and indexes when creating SQL migrations from Go structs. The skill detects your struct configuration and automatically includes soft delete columns, applies indexes, and enforces NOT NULL constraints within the generated golang-migrate SQL files.

Does this SQL generation skill support rollback migrations for PostgreSQL?

Yes, this SQL generation skill supports rollback migrations for PostgreSQL by generating matching Down migration files. Alongside the Up migration that creates your tables, it outputs the corresponding Down SQL statements required to reverse the schema changes using golang-migrate.

How do I update my Makefile with new golang-migrate targets after generating SQL files?

To update your Makefile with new golang-migrate targets after generating SQL files, leverage the skill's Makefile integration feature. It automatically injects the necessary migration targets into your Makefile, streamlining the execution of database schema evolution commands for your Go microservices.