/cstk-language-go:go-add-migrationfrom cstk-language-go
Creates properly named PostgreSQL migration files (.up.sql and .down.sql) for GOB microservices following project conventions. Automatically determines schema from service name, sequences migration numbers, and generates type-specific templates (create_table, add_column, etc.).
Ships in cstk-language-go. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Create properly named PostgreSQL migration files for a GOB microservice following all project conventions.
"add migration", "new migration", "criar migration", "nova migration", "create migration"
$ARGUMENTS should specify:
gob-member-service) — requiredBefore generating files, read:
ls services/{service}/migrations/ to determine the next 3-digit sequence numberservices/{service}/go.mod to confirm the service exists and get module path| Service | Schema |
|---|---|
| gob-auth-service | auth |
| gob-member-service | member |
| gob-lodge-service | lodge |
| gob-session-service | session |
| gob-process-service | process |
| gob-election-service | election |
| gob-bulletin-service | bulletin |
| gob-partnership-service | partnership |
| gob-audit-service | audit |
| gob-report-service | report |
| gob-notification-service | notification |
| gob-financial-service | financial |
| gob-assistance-service | assistance |
| gob-whatsapp-service | |
| gob-migration-service | migration |
If the service is not listed, extract the schema name from the service name by removing the gob- prefix and -service suffix.
services/{service}/migrations/012_xxx.up.sql → 12)highest + 1, zero-padded to 3 digits (e.g., 013).up.sql and .down.sql filesFile naming: {NNN}_{description_in_snake_case}.up.sql and {NNN}_{description_in_snake_case}.down.sql
Up migration:
-- {NNN}: Create {table_name} table
CREATE TABLE IF NOT EXISTS {schema}.{table_name} (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
-- entity-specific columns here --
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP
);
-- Indexes
CREATE INDEX IF NOT EXISTS idx_{table_name}_{column} ON {schema}.{table_name}({column});
-- Comments
COMMENT ON TABLE {schema}.{table_name} IS '{description}';
Down migration:
DROP TABLE IF EXISTS {schema}.{table_name} CASCADE;
Up migration:
-- {NNN}: Add {column_name} to {table_name}
ALTER TABLE {schema}.{table_name}
ADD COLUMN IF NOT EXISTS {column_name} {type} {constraints};
Down migration:
ALTER TABLE {schema}.{table_name}
DROP COLUMN IF EXISTS {column_name};
Up migration:
-- {NNN}: Create index on {table_name}.{column}
CREATE INDEX IF NOT EXISTS idx_{table_name}_{column} ON {schema}.{table_name}({column});
Down migration:
DROP INDEX IF EXISTS {schema}.idx_{table_name}_{column};
Up migration:
-- {NNN}: Seed {table_name} with default data
INSERT INTO {schema}.{table_name} (col1, col2, ...)
VALUES
('value1', 'value2'),
('value3', 'value4')
ON CONFLICT DO NOTHING;
Down migration:
-- Remove seeded data
DELETE FROM {schema}.{table_name}
WHERE col1 IN ('value1', 'value3');
Up migration:
-- {NNN}: {description}
ALTER TABLE {schema}.{table_name}
{alterations};
Down migration:
-- Revert: {description}
ALTER TABLE {schema}.{table_name}
{reverse_alterations};
Schema prefix: ALWAYS use {schema}.{table_name} (e.g., member.members, process.process_definitions). Never use unqualified table names.
CIMs: When inserting CIM values, always use 7-digit zero-padded format. Use LPAD(cim::text, 7, '0') for JOINs with legacy data.
Portuguese accents: Always use proper accents in seed data text (e.g., "Administracao" is WRONG, "Administracao" is WRONG, "Administracao" -> use "Administrativo" etc.). Example correct values: "Iniciacao", "Elevacao", "Exaltacao", "Filiacao".
Down migrations must be idempotent: Always use IF EXISTS, CASCADE where appropriate. Running down twice must not error.
Timestamps: Use TIMESTAMP NOT NULL DEFAULT NOW() for created_at. Use TIMESTAMP (nullable) for updated_at.
UUIDs: Use UUID PRIMARY KEY DEFAULT gen_random_uuid() for primary keys.
Enums: Prefer VARCHAR or TEXT with CHECK constraints over PostgreSQL ENUM types. This avoids migration complexity when adding new values.
Foreign keys: Include ON DELETE behavior explicitly (CASCADE, SET NULL, or RESTRICT).
Boolean defaults: Always specify DEFAULT false or DEFAULT true for boolean columns.
Naming conventions:
snake_case, plural (e.g., members, process_definitions)snake_case (e.g., lodge_id, created_at)idx_{table}_{column} (e.g., idx_members_lodge_id)uniq_{table}_{column} (e.g., uniq_members_cim)fk_{table}_{referenced_table} (e.g., fk_members_lodges)After creating both files:
make migrate-up SERVICE={service-name} (for local dev)./scripts/migrate.sh --service={service-name} upWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
PostgreSQL, SQL, Go
npx claudepluginhub jotjunior/cstk --plugin cstk-language-go7 skills in this plugin
/commitCommit staged and unstaged changes with a well-crafted conventional commit message.
Handles submodule updates, multi-service changes, and follows project conventions.
Triggers: "/commit", "commit", "commitar", "fazer commit", "commit changes".
/go-add-consumerAdd a RabbitMQ event consumer to an existing GOB Go microservice/go-add-entityAdd a full CRUD vertical slice (domain, DTO, repository, service, handler, migration, factory wiring) to an existing GOB Go microservice/go-add-testAdd unit/integration tests to a GOB Go microservice following established project patterns.
Triggers: "add test", "add tests", "criar teste", "novo teste", "test coverage", "testar",
"write tests for", "escrever testes para".
/go-review-prReview all changes in the current branch against GOB project conventions before opening a PR.
Diff-aware: only analyzes what changed, not the entire codebase.
Triggers: "review pr", "revisar pr", "pre-pr check", "review branch", "revisar branch",
"checar antes do pr", "quality gate".
/go-review-serviceAudit a GOB Go microservice against all project conventions and patternsOther plugins' skills for the same job