serialization-review

Audit JSON serialization for scenes, prefabs, and components.

13|2|Updated Jul 17, 2023
One-click install
npx skills add https://github.com/kateusz/GameEngine --skill serialization-review
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: serialization-review
Source: https://github.com/kateusz/GameEngine/tree/main/.claude/skills/serialization-review
Command: npx skills add https://github.com/kateusz/GameEngine --skill serialization-review

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill audits JSON serialization for scenes, prefabs, and components to ensure correct data persistence, version compatibility, and proper handling of resource references. It helps prevent data corruption, save/load failures, and ensures that game assets can be reliably saved and loaded across different engine versions.

Core Features & Use Cases

  • Runtime Data Exclusion: Verifies that runtime-only objects (e.g., physics bodies, loaded textures) are correctly marked with [JsonIgnore] to prevent serialization errors and bloated files.
  • Resource Path Serialization: Ensures that only asset paths (not the loaded resources themselves) are serialized, with proper error handling for missing assets.
  • Custom Converter Implementation: Guides the creation and registration of JsonConverter for complex types or backward compatibility.
  • Circular Reference Handling: Checks for and helps resolve circular references in entity hierarchies to prevent infinite loops during serialization.
  • Use Case: When a new RigidBody2DComponent is added, this Skill ensures its RuntimeBody property is marked [JsonIgnore], and that its Material property serializes only a path to a material asset, not the entire loaded material object.

Quick Start

Review the RigidBody2DComponent for any runtime physics objects that are being serialized and suggest adding [JsonIgnore].

Frequently Asked Questions about serialization-review

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent runtime objects from being serialized in JSON?

Mark runtime-only properties like physics bodies and loaded textures with `[JsonIgnore]` to exclude them from serialization. This prevents serialization errors, reduces file bloat, and ensures only persistent data is saved.

Why does my JSON serialization fail when saving game assets?

Serialization fails when loaded resources (textures, materials) are saved directly instead of asset paths. Store only resource paths as strings and implement error handling for missing assets to maintain data integrity.

How do I handle circular references in scene and prefab serialization?

Detect circular references in entity hierarchies and resolve them by serializing only the necessary data paths rather than full object graphs. This prevents infinite loops and enables reliable save/load cycles.

What's the best way to maintain backward compatibility when versioning JSON data formats?

Implement custom `JsonConverter` classes with symmetric Read/Write methods and error handling to support format migrations. Forward-compatible patterns allow old data to load in new versions without corruption.

Do I need custom converters for complex component types in C#?

Custom `JsonConverter` implementations are needed for complex types that require special serialization logic, backward compatibility across versions, or conditional field handling during save/load operations.

How do I audit existing components for serialization correctness?

Review components for missing `[JsonIgnore]` on runtime fields, verify resource references use paths not objects, check custom converters for symmetric Read/Write pairs, and test save/load cycles for data corruption or version mismatches.