Aurora SQL Migrations Management

VerifiedSafe

Manages PostgreSQL schema migrations and stored procedures in the tools bounded context. Organizes DDL changes and programmable objects with structured patterns.

Sby Skills Guide Bot
DevelopmentIntermediate
3/4/2026
Claude Code
#postgresql#sql-migrations#stored-procedures#database-schema#triggers

Recommended for

Automated summary

Defines where to place and how to structure SQL migrations and programmable PostgreSQL objects (procedures, functions, triggers, sequences) in the tools bounded context.

Strengths

  • Explicit decision tree for choosing between migrations.ts (DDL) and procedures.ts (programmable objects).
  • Enforces precise naming conventions for functions, triggers, sequences, indexes, and variables, plus idempotent SQL scripts.
  • Provides the expected object shapes (id, name, version, sort, upScript, downScript) for both migrations and procedures.
  • Requires pairing with the postgresql skill so SQL authoring follows a separate standard.

Limitations

  • Tightly coupled to the Aurora project: fixed file paths, the ToolsProcedureType enum, and the tools bounded context.
  • Does not cover migration execution, rollback testing, or data migrations (DML).
  • Relies on a companion postgresql skill whose content is not included here.
When to use it

Use when adding or changing PostgreSQL schema objects or programmable logic in the tools bounded context of the Aurora project.

When not to use it

Do not use for general PostgreSQL query authoring outside that codebase or for data-only migrations that do not change schema.

Security analysis

Safe
Quality score92/100

The skill provides documentation and patterns for SQL migration and procedure management. It declares Bash but only for generating UUIDs via uuidgen or node, which is benign. There are no destructive, exfiltrating, or obfuscated commands. The SQL examples are standard DDL/DML and are not executed by the skill itself.

No concerns found

How this analysis is made

Examples

Add rowId migration
In the Aurora tools bounded context, add a migration that adds a `rowId` column to `public."LoadOrder"` and a matching downScript. Tell me whether it belongs in migrations.ts or procedures.ts.
Create load order code trigger
Create the PostgreSQL trigger and trigger function in procedures.ts that populate `load_order_code` from a sequence for the load order table. Follow the set_{entity}_{field} and trg_{function_name} naming conventions and include the downScript.
Add unique constraint and index
I need a unique constraint and an index on `public."MessageOutbox"(rowId)`. Put the DDL in the correct file, use IF NOT EXISTS where possible, and provide the exact inverse downScript.

name: aurora-tools-scripts description: > SQL migrations and stored procedures management in the tools bounded context. Trigger: Creating migrations, procedures, functions, triggers, or sequences for PostgreSQL. license: MIT metadata: author: aurora version: '1.0' allowed-tools: Read, Edit, Write, Glob, Grep, Bash

Required Companion Skill

IMPORTANT: Always use this skill together with postgresql skill.

  • This skill defines WHERE to put the code (migrations.ts vs procedures.ts)
  • The postgresql skill defines HOW to write the SQL statements

Read .claude/skills/postgresql/SKILL.md before writing any SQL.


When to Use

migrations.ts - Schema Changes (DDL)

Use for database schema modifications:

  • ALTER TABLE (add/drop/modify columns)
  • CREATE/DROP INDEX
  • Add constraints (UNIQUE, FOREIGN KEY, CHECK)
  • Add rowId pattern to existing tables
  • Any structural change to tables

procedures.ts - Programmable Objects

Use for stored logic and automation:

  • Stored procedures (PROCEDURE)
  • Functions (FUNCTION)
  • Triggers (TRIGGER)
  • Sequences (via FUNCTION that creates them)

Critical Patterns

File Structure

| File | Purpose | | -------------------------------- | ----------------------------------------------------------- | | src/assets/tools/migrations.ts | Schema changes only: ALTER TABLE, CREATE INDEX, DDL | | src/assets/tools/procedures.ts | Programmable objects: procedures, functions, triggers | | src/@api/graphql.ts | Types and ToolsProcedureType enum |

Migration Object Structure

{
  id: 'UUID',           // Generate with crypto.randomUUID()
  name: string,         // English description: "Verb + Object + Table"
  version: string,      // Semver matching package.json, e.g., '0.0.7'
  sort: number,         // Execution order within version
  upScript: `SQL`,      // Pure PostgreSQL SQL in template literal
  downScript: `SQL`,    // Exact inverse of upScript
}

Procedure Object Structure

{
  id: 'UUID',
  name: string,                    // Descriptive name
  type: ToolsProcedureType,        // PROCEDURE | FUNCTION | TRIGGER
  version: string,
  sort: number,
  upScript: `SQL`,                 // Pure SQL: CREATE OR REPLACE...
  downScript: `SQL`,               // Pure SQL: DROP...
}

SQL Conventions

| Rule | Example | | ------------------------------ | -------------------- | | Table names use double quotes | "TableName" | | Always prefix with schema | public."TableName" | | Use IF EXISTS/IF NOT EXISTS | Idempotent scripts | | Environment vars interpolation | ${process.env.VAR} |

Naming Conventions

| Element | Pattern | Example | | ---------- | ---------------------- | ------------------------- | | Functions | set_{entity}_{field} | set_load_order_code | | Triggers | trg_{function_name} | trg_set_load_order_code | | Sequences | {purpose}_seq | load_order_code_seq | | Indexes | {table_snake}_{col} | message_outbox_row_id | | Local vars | v_ prefix | v_code | | Counters | t_ prefix | t_counter |

Decision Tree

What do you need?
│
├─ Schema/Structure change (DDL)?
│   └─ YES → migrations.ts
│       ├─ ALTER TABLE (add/drop/modify columns)
│       ├─ CREATE/DROP INDEX
│       ├─ ADD CONSTRAINT
│       └─ Any table structure change
│
└─ Programmable logic?
    └─ YES → procedures.ts
        ├─ Stored procedure (no return)     → type: PROCEDURE
        ├─ Function (returns value/table)   → type: FUNCTION
        ├─ Trigger + trigger function       → type: TRIGGER
        └─ Sequence (created via function)  → type: FUNCTION

Code Examples

Migration: Add Column

{
  id: '98978f96-b617-469f-b80c-2a30c5516f47',
  name: 'Add defaultRedirection to IamRole',
  version: '0.0.6',
  sort: 8,
  upScript: `
    ALTER TABLE public."IamRole" ADD COLUMN "defaultRedirection" VARCHAR(2046) NULL;
  `,
  downScript: `
    ALTER TABLE public."IamRole" DROP COLUMN IF EXISTS "defaultRedirection";
  `,
}

Migration: Add rowId (Aurora Standard Pattern)

{
  id: 'bf177b46-6671-410b-bf49-4ce97c29884e',
  name: 'Add rowId to MessageOutbox',
  version: '0.0.5',
  sort: 5,
  upScript: `
    ALTER TABLE public."MessageOutbox" ADD COLUMN "rowId" BIGINT GENERATED BY DEFAULT AS IDENTITY;
    WITH ordered AS (
        SELECT id AS uuid_pk, ROW_NUMBER() OVER (ORDER BY "createdAt", id) AS rn FROM public."MessageOutbox"
    )
    UPDATE public."MessageOutbox" t
        SET "rowId" = o.rn
    FROM ordered o
        WHERE t.id = o.uuid_pk
            AND t."rowId" IS NULL;

    SELECT setval(pg_get_serial_sequence('public."MessageOutbox"','rowId'), (SELECT MAX("rowId") FROM public."MessageOutbox"), true);

    ALTER TABLE public."MessageOutbox" ALTER COLUMN "rowId" SET NOT NULL;
    CREATE UNIQUE INDEX message_outbox_row_id ON public."MessageOutbox" USING btree ("rowId");
  `,
  downScript: `
    DROP INDEX IF EXISTS "message_outbox_row_id";
    ALTER TABLE public."MessageOutbox" DROP COLUMN IF EXISTS "rowId";
  `,
}

Procedure: Basic

{
  id: '1cd0c79e-b83b-4ebf-b112-063669703cdc',
  name: 'insert_user',
  type: ToolsProcedureType.PROCEDURE,
  version: '0.0.1',
  sort: 1,
  upScript: `
CREATE OR REPLACE PROCEDURE insert_user(name_input VARCHAR, age_input INTEGER)
LANGUAGE plpgsql
AS $$
BEGIN
    INSERT INTO users (name, age) VALUES (name_input, age_input);
END;
$$;
  `,
  downScript: `DROP PROCEDURE IF EXISTS insert_user(VARCHAR, INTEGER);`,
}

Commands

# Generate UUID for new entry
uuidgen | tr '[:upper:]' '[:lower:]'

# Or in Node.js
node -e "console.log(crypto.randomUUID())"

# Check current package version
jq -r '.version' package.json

Resources

  • Templates: See assets/templates.ts for copy-paste templates
  • Migrations: See src/assets/tools/migrations.ts for real examples
  • Procedures: See src/assets/tools/procedures.ts for procedure examples

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/aurora-sql-migrations-management-mmbizjud/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/aurora-sql-migrations-management-mmbizjud' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/aurora-sql-migrations-management-mmbizjud/download' --output '.skill-downloads/aurora-sql-migrations-management-mmbizjud/SKILL.md.part' && mv '.skill-downloads/aurora-sql-migrations-management-mmbizjud/SKILL.md.part' '.skill-downloads/aurora-sql-migrations-management-mmbizjud/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Tools declared by the author (check availability in your agent): Read, Edit, Write, Glob, Grep, Bash

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/aurora-sql-migrations-management-mmbizjud/SKILL.md' && test -s '.skill-downloads/aurora-sql-migrations-management-mmbizjud/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/aurora-tools-scripts' && cp -R '.skill-downloads/aurora-sql-migrations-management-mmbizjud' '.claude/skills/aurora-tools-scripts'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/aurora-sql-migrations-management-mmbizjud'

openskills read 'aurora-sql-migrations-management-mmbizjud'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/aurora-sql-migrations-management-mmbizjud/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills