agentsclimarketplace

Create migration

Skill falkcorp/audiobook-organizer/.claude/skills/create-migration

Create a new PebbleDB/SQLite database migration following the project patternFrom its SKILL.md

Install
npx -y skills add falkcorp/audiobook-organizer --skill create-migration

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 3 stars3 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

1.8 KB, as published. Nobody here has run it

Create Database Migration

Create a new migration in internal/database/migrations.go following the established pattern.

Arguments

  • First argument: short description of the migration (e.g., "add genre field to books")

Steps

  1. Find the current highest migration version:

    grep 'Version:' internal/database/migrations.go | grep -oP '\d+' | sort -n | tail -1
    
  2. Create the migration function at the end of migrations.go (before the closing of the file), following this pattern:

    func migration<NNN>Up(store Store) error {
        // For PebbleDB operations:
        ps, ok := store.(*PebbleStore)
        if !ok {
            return nil // Skip for non-Pebble stores
        }
        _ = ps
    
        // For SQLite operations:
        ss, ok := store.(*SQLiteStore)
        if !ok {
            return nil
        }
        _, err := ss.db.Exec(`ALTER TABLE books ADD COLUMN new_field TEXT DEFAULT ''`)
        return err
    }
    
  3. Register the migration in the migrations slice:

    {
        Version:     <next_version>,
        Description: "<description>",
        Up:          migration<NNN>Up,
        Down:        nil,
    },
    
  4. Update the file version header at the top of migrations.go

Rules

  • Migration version numbers must be sequential (no gaps)
  • Always handle both PebbleStore and SQLiteStore if both need changes
  • Use Down: nil unless rollback is critical (most migrations are additive)
  • PebbleDB uses key-value patterns; SQLite uses SQL DDL
  • Test with go build ./internal/database/... after adding
  • For backfill operations, use versioned keys (e.g., my_backfill_v1_done) to prevent re-runs

Keep looking

Skills are one crate of 608,475. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.