360 Secure SkillHub
360 安全技能中心

go-goose

该 Skill 针对 pressly/goose 数据库迁移提供专家指导,覆盖 SQL/Go 迁移编写、CLI 命令、环境变量、Go 库与 Provider API、嵌入迁移及版本排序,并提醒回滚和非事务执行等注意事项。

metalagman
热度 0.00
最近更新 2026-10-19 06:54:07
分类:开发依赖:纯提示词应用场景:代码生成 / DevOps / 自动化脚本 / 工作流

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add metalagman/agent-skills/go-goose
Metadata
name
go-goose
description
Use this skill to plan, write, or run database migrations with the pressly/goose CLI and Go library (SQL/Go migrations, env vars, provider API, embedded migrations).
metadata
{"short-description":"Expert guidance for goose CLI and Go library migrations."}

go-goose

Expert guidance for using pressly/goose to create and run database migrations via the CLI or Go library.

When to trigger

  • The user mentions goose, pressly/goose, database migrations in Go, or asks how to run SQL/Go migrations.
  • The task involves embedding migrations, provider API usage, or CI workflows with goose.

Core rules

  • Follow the repository's existing migration layout, dialect, and naming conventions first.
  • Ensure the database driver and goose dialect match (e.g., postgres driver with postgres dialect).
  • Prefer SQL migrations for schema changes; use Go migrations for complex data backfills or code-driven steps.
  • Keep migrations deterministic and idempotent within goose's rules (one Up, optional Down).

Workflow

  1. Clarify context: target DB/dialect, driver, migration directory, SQL vs Go migration needs, and desired command (create/up/down/status/etc).
  2. Choose interface:
    • CLI for ad-hoc runs or CI/CD.
    • Library/Provider when migrations are executed inside Go services or tests.
  3. Author migrations:
  4. Run migrations:
  5. Versioning + ordering:
    • Use hybrid versioning during development and fix for production sequencing if required (see references/versioning.md).

Output expectations

  • Provide exact commands or code snippets that match the user's dialect and environment.
  • Warn about missing Down migrations when rollbacks are required.
  • If a migration requires special parsing or non-transactional execution, call it out explicitly.

References