agentleFS
gocronx-teamgocronx-team/gocron/.agents/skills/migration/SKILL.md

migration

Skill808 starsChanged 3 months agoMITView on GitHub

Create, review, or verify gocron database migrations across SQLite, MySQL, and PostgreSQL. Use when adding or changing GORM models, columns, indexes, constraints, persisted settings, migration version ids, Install tables, upgradeForNNN functions, or migration tests.

We split this skill into the rules it gives an agent

14 rules. 0 are common, 9 are distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 22 edited versions we read keep these.

  • 9

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Treat migrations as compatibility code.

    line 8
  2. Distinctive:

    Prefer additive, idempotent changes and compatible defaults on SQLite, MySQL, and PostgreSQL.

    line 17
  3. Distinctive:

    Do not advance the migration version until all work succeeds.

    line 20
  4. Distinctive:

    Document downgrade safety and backup/recovery steps.

    line 22
  5. Distinctive:

    Test against a representative populated database, not only a tiny fixture.

    line 27
  6. Distinctive:

    Add indexes only for demonstrated query patterns.

    line 33
  7. Distinctive:

    Prefer resumable/idempotent batches when a single transaction could block startup or exceed reasonable memory or disk.

    line 35
  8. Very specific:

    Add a new unique id to versionIds in chronological release order.

    line 53
  9. Very specific:

    Add the matching migration.upgradeForNNN entry at the same index.

    line 54
  10. Very specific:

    Add new install-time models to the Install table slice.

    line 57
  11. Distinctive:

    Avoid database-specific SQL.

    line 61
  12. Very specific:

    Add a focused migration test that builds the N-1 pre-upgrade schema (and older affected schemas), runs the upgrade, proves existing rows …

    line 63
  13. Very specific:

    Do not rely only on GORM AutoMigrate when data must be renamed, remapped, backfilled, deduplicated, or constrained.

    line 67
  14. Distinctive:

    If a specific migration was added, pass its id to the structural checker:

    line 80

“Common” is measured: kept by at least 6 in 10 of the 22 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Migrate gocron data

Treat migrations as compatibility code. Preserve existing installations and all three supported databases; do not optimize only for a fresh SQLite database.

Compatibility invariants

  • Upgrade existing installations in place; never require recreating the database or discarding tasks, configuration, users, or logs.
  • Validate from an N-1 schema/data fixture and every older schema directly affected by the change. A fresh database alone is not evidence.
  • Prefer additive, idempotent changes and compatible defaults on SQLite, MySQL, and PostgreSQL. Do not drop or reinterpret persisted data in a minor or patch release.
  • Do not advance the migration version until all work succeeds. A failed migration must remain diagnosable and safely retryable.
  • Document downgrade safety and backup/recovery steps. If downgrade can lose or corrupt data, stop and obtain explicit approval before implementation.

Performance invariants

  • Test against a representative populated database, not only a tiny fixture. Record row counts and migration duration for performance-sensitive changes.
  • For populated-table changes, assess full scans, lock/transaction duration, temporary disk, and write amplification on SQLite, MySQL, and PostgreSQL.
  • On SQLite, keep write transactions short and avoid per-row commits. Use safe bounded batches for large backfills and test busy/lock behavior with readers.
  • Add indexes only for demonstrated query patterns; inspect the query plan and account for index build time, disk growth, and write overhead.
  • Prefer resumable/idempotent batches when a single transaction could block startup or exceed reasonable memory or disk. State the interruption behavior.

Establish the change

  • Inspect cmd/gocron/gocron.go, internal/models/migration.go, the affected models, and nearby migration tests before editing.
  • Determine whether the change affects an existing table, creates a new table, or transforms existing data. Do not create an empty migration for a release with no schema or data change.
  • Derive the migration id from the target AppVersion using the repository's established conversion. Never reuse an id. If the release version is not known and a new id is required, stop and ask for it.

Implement atomically

For a new persisted model or schema change:

  1. Add a new unique id to versionIds in chronological release order.
  2. Add the matching migration.upgradeForNNN entry at the same index.
  3. Implement upgradeForNNN with the transaction passed to it; return every error instead of logging and continuing.
  4. Add new install-time models to the Install table slice. Do not add an existing-table column there as a substitute for an upgrade.
  5. Make the upgrade idempotent where practical. Guard data rewrites that would corrupt values on a second run.
  6. Avoid database-specific SQL. When unavoidable, branch on the GORM dialect and implement SQLite, MySQL, and PostgreSQL behavior explicitly.
  7. Add a focused migration test that builds the N-1 pre-upgrade schema (and older affected schemas), runs the upgrade, proves existing rows and values survive, and exercises a second run when idempotency is expected.

Do not rely only on GORM AutoMigrate when data must be renamed, remapped, backfilled, deduplicated, or constrained.

Verify

Run:

python3 .agents/skills/migration/scripts/check_migration.py
go test -race ./internal/models/...
go test -race ./cmd/gocron/...

If a specific migration was added, pass its id to the structural checker:

python3 .agents/skills/migration/scripts/check_migration.py 191

Then invoke $verify before committing. Report the migration id, affected tables, upgrade path, downgrade/backup implications, database-specific risks, exact tests run, and performance evidence when the change has material risk.

Download now (ZIP)

  • Other versions25 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 25

    1. JuliusBrussee/caveman★ 115ksame name
    2. kortix-ai/suna★ 20ksame name
    3. go-vikunja/vikunja★ 5.9ksame name
    4. langwatch/langwatch★ 5ksame name
    5. SparkDevNetwork/Rock★ 692same name
    6. me2resh/apexyard★ 542same name
    7. DataWithBaraa/claude-code-data-engineering-skills★ 52same name
    8. zllovesuki/cloudflare-agent-skills★ 9same name
    9. nomdedev/agent-manager-template★ 2same name
    10. rcdelfin/agentkit★ 2same name

    15 more not listed

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • Used alongsideProjects with it also use surgical-patch, verify-and-stop and 10 more.

    Other files people use alongside this one.

    Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
    • JuliusBrusseeSkill

      surgical-patch

      Fix bugs and small behavior changes at the narrowest responsible layer. Use when regression proof, preserved surrounding behavior, and task-relevant tests matter.

      Also in 5 projects that use this

    • JuliusBrusseeSkill

      verify-and-stop

      Prove existing work meets acceptance conditions without expanding scope. Use for validation-only tasks, completion checks, focused gate runs, and last-mile proof.

      Also in 4 projects that use this

    • anshul-garg27Skill

      safe-refactor

      Systematic code refactoring with safety nets - maps usages, ensures tests exist, executes incrementally with verification

      Also in 5 projects that use this

    • +9 more from JuliusBrussee
  • In this repository9 other files it gives its agents.

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.