Skip to content

hoatv2211/GameStudio-CodexKIT / skills/save-data-schema-migration

save-data-schema-migration

Verified

Use when versioning or converting serialized player save files, profiles, checkpoints, or persistence payloads across recognized save-format versions with fixture compatibility and rollback.

FileKindSize
SKILL.mdskill md3.5 KB
agents/openai.yamlconfig271 B
scripts/save_migration.pyscript2.2 KB

scripts/save_migration.py

View on GitHub
# Generated by scripts/sync_skill_resources.py. Do not edit manually.

from __future__ import annotations

from copy import deepcopy
from typing import Any


def plan_save_migration(
    save: dict[str, Any], target_version: int, migrations: list[dict[str, Any]]
) -> dict[str, Any]:
    source = deepcopy(save)
    current_version = source.get("schema_version")
    if not isinstance(current_version, int) or current_version > target_version:
        return {
            "verdict": "BLOCKED",
            "reasons": ["unknown or newer save schema version"],
            "rollback": source,
        }
    migration_by_version = {
        migration.get("from_version"): migration
        for migration in migrations
        if isinstance(migration.get("from_version"), int)
    }
    migrated = deepcopy(source)
    applied: list[dict[str, int]] = []
    while migrated["schema_version"] < target_version:
        migration = migration_by_version.get(migrated["schema_version"])
        if not migration or migration.get("to_version") != migrated["schema_version"] + 1:
            return {
                "verdict": "BLOCKED",
                "reasons": [f"no recognized migration from version {migrated['schema_version']}"],
                "rollback": source,
            }
        data = migrated.get("data")
        if not isinstance(data, dict):
            return {
                "verdict": "BLOCKED",
                "reasons": ["save data must be an object"],
                "rollback": source,
            }
        for old_name, new_name in migration.get("rename", {}).items():
            if old_name in data:
                data[new_name] = data.pop(old_name)
        for name, value in migration.get("defaults", {}).items():
            data.setdefault(name, deepcopy(value))
        for name in migration.get("remove", []):
            data.pop(name, None)
        previous = migrated["schema_version"]
        migrated["schema_version"] = migration["to_version"]
        applied.append({"from_version": previous, "to_version": migrated["schema_version"]})
    return {
        "verdict": "PASS",
        "migrated": migrated,
        "rollback": source,
        "applied": applied,
        "limitations": ["Fixture migration only; no live player save was modified."],
    }
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall