.claude/skills/save-module/SKILL.md
SaveModule reference — binary serialization with AES encryption, versioning, migration, cloud sync, and reactive key-value storage. Use when working with save/load, persistence, or data migration.
npx skillsauth add punkfuncgames/tetris-clone save-moduleInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Package: com.punkfuncgames.save | Define: PUNKFUNC_SAVE
Location: Packages/com.punkfuncgames.save/Runtime/PunkFuncGames.Save/
Namespace: PunkFuncGames.Save
Properties:
bool IsInitialized, bool HasSaveDataReactiveProperty<bool> AutoSaveEnabledbool IsCloudSyncAvailableLifecycle:
UniTask InitializeAsync(ct), UniTask SaveAsync(ct), UniTask LoadAsync(ct), DeleteAll()Key-Value Storage:
Set<T>(string key, T value) — marks dirty, notifies observersT Get<T>(string key, T defaultValue = default)bool HasKey(string key), Delete(string key)Observable<T> Observe<T>(string key, T defaultValue) — reactive stream for key changesMetadata:
SaveMetadata GetMetadata(), SetMetadata(SaveMetadata)Dependencies (all optional):
GameSettings, ISaveSerializer, ISaveEncryption, SaveMigrator, ISteamCloudServiceDefaults: BinarySerializer (MessagePack+LZ4 or JSON fallback), AesEncryption (device-specific key)
Save Flow: Serialize → Compute checksum → Encrypt → Backup existing → Write → Cloud sync Load Flow: Cloud download (if available) → Decrypt → Validate checksum → Migrate → Deserialize → Notify observers
Auto-save: Configurable interval (default 60s), only if dirty
ISaveSerializer — Serialize<T>(T), Deserialize<T>(byte[]), SerializeToString<T>, DeserializeFromString<T>
BinarySerializer: Uses MessagePack with LZ4 compression (#if MESSAGEPACK), falls back to JSON (Newtonsoft.Json)
AesEncryption : ISaveEncryption
SystemInfo.deviceUniqueIdentifier + model + graphicsDeviceIDComputeChecksum(byte[]) → SHA256 Base64, VerifyChecksum(byte[], string)ISaveMigration — int FromVersion, int ToVersion, SaveData Migrate(SaveData)
SaveMigrator:
RegisterMigration(ISaveMigration), bool NeedsMigration(SaveData)SaveData MigrateToLatest(SaveData) — chains migrations sequentiallybool HasMigrationPath(int from, int to)SaveDataVersion: const int V1 = 1, const int Current = V1
SaveData: Version, LastSaved (UTC), Checksum, Dictionary<string, byte[]> Values
SaveMetadata: PlayTimeSeconds, CurrentLevel, ProfileName, SlotIndex, Thumbnail (PNG bytes), Custom dict
| Event | Key Fields |
|-------|------------|
| SaveStartedEvent | SlotIndex |
| SaveCompletedEvent | Success, SlotIndex, ErrorMessage |
| LoadStartedEvent | SlotIndex |
| LoadCompletedEvent | Success, SlotIndex, ErrorMessage |
| SaveConflictEvent | LocalSave, CloudSave, OnResolved callback |
| CloudSyncCompletedEvent | Success, Direction (Upload/Download), ErrorMessage |
| SaveMigratedEvent | FromVersion, ToVersion |
SaveConflictResolution enum: UseCloud, UseLocal, UseMostRecent, KeepBoth
SaveInstaller.Install(builder, options);
// Registers: AesEncryption (Singleton) with .WithParameter("enabled", true).WithParameter("customSalt", (string)null)
// Registers: BinarySerializer (Singleton)
// Registers: SaveMigrator (Singleton)
// Registers: SaveService (Singleton)
// Events: 7 message brokers
// Storing data
_saveService.Set("PlayerLevel", 42);
_saveService.Set("Inventory", myInventoryObject);
// Reading data
int level = _saveService.Get<int>("PlayerLevel", defaultValue: 1);
// Reactive observation
_saveService.Observe<int>("PlayerLevel", 1)
.Subscribe(level => UpdateLevelUI(level))
.AddTo(_disposables);
// Creating a migration
public sealed class V1ToV2Migration : ISaveMigration
{
public int FromVersion => 1;
public int ToVersion => 2;
public SaveData Migrate(SaveData data)
{
// Transform data as needed
return data;
}
}
development
WalletModule reference — currency management with BigDouble support, reactive properties, caps, lifetime stats, and persistence. Use when working with currencies, wallets, or financial systems.
development
UnlockConditionModule reference — composable unlock conditions using ScriptableObjects with AND/OR/NOT logic, stat/currency/upgrade/prestige/gamestate/boolean checks, reactive service layer with progress tracking. Use when implementing unlock systems, gating, or progression requirements.
development
UndoModule reference — command pattern with undo/redo stacks, command merging, and reactive state. Use when implementing undo/redo, undoable actions, or command patterns.
tools
Unity UI Toolkit reference — UXML documents, USS styling, MVVM pattern (ViewModel + Presenter), custom VisualElements, responsive layout, animations, performance guidelines, and complete Figma-to-UI-Toolkit property mapping. Use when building or modifying UI with UI Toolkit, creating UXML/USS files, writing ViewModels or Presenters, designing screens/panels/components, or converting Figma designs to UI Toolkit.