Skip to content
Back to skills

Designing Data Models

ASecurity

Use when designing the in-memory object model of an editor, tool, or engine: typed objects with properties, references between them, undo/redo, and save/load. Triggers on object/property schemas, stable ids or GUIDs, change notification, transactional edits, undo history, versioned serialization and migration, copy-on-write snapshots, even when the user doesn't say 'data model'.

  • 6 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 30, 2026
ai-agentsgoexpressapi

Works with

  • api

Security analysis

A100/100

Pro scans all 12 files and shows the line behind each finding

Scanned November 30, 2026

npx -y skills add xonovex/platform --skill designing-data-models --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Designing Data Models?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Designing Data Models
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/xonovex-designing-data-models/badge)](https://www.skillsdirectory.com/skills/xonovex-designing-data-models)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: designing-data-models
description: "Use when designing the in-memory object model of an editor, tool, or engine: typed objects with properties, references between them, undo/redo, and save/load. Triggers on object/property schemas, stable ids or GUIDs, change notification, transactional edits, undo history, versioned serialization and migration, copy-on-write snapshots, even when the user doesn't say 'data model'."
---

# Data-Model Guidelines

Keep editor and tool state in one typed object model with stable identity, explicit ownership, and reversible changes.

## Essentials

- **One central model** - Route tool/editor state through a single typed object store, not scattered structs, see [references/object-model.md](references/object-model.md)
- **Make mutation observable** - Edits go through the model so it can notify, undo, and persist, see [references/change-notification.md](references/change-notification.md)

## Object model

- **Typed objects** - Describe each type by a runtime schema, not a hand-written C struct, see [references/object-model.md](references/object-model.md)
- **Property set per type** - bool/int/float/string/reference/sub-object/buffer/array properties, see [references/object-model.md](references/object-model.md)
- **Data-driven types** - Add a type or property at runtime without recompiling, see [references/object-model.md](references/object-model.md)
- **Separate metadata from instances** - Type/schema lives once; instance data is just values, see [references/object-model.md](references/object-model.md)

## References & ownership

- **Strong = owning sub-object** - A parent owns its sub-objects; deleting the parent deletes them, see [references/references-and-ownership.md](references/references-and-ownership.md)
- **Local vs global ids** - Local ids inside a file, GUIDs for cross-file/cross-session links, see [references/references-and-ownership.md](references/references-and-ownership.md)
- **Identity vs role** - A GUID names a fixed identity; a name/path names a role that late-binds: default to GUIDs, see [references/references-and-ownership.md](references/references-and-ownership.md)

## Prototypes & overrides

- **Per-property override bitmask** - One bit per property marks local-vs-inherited; sub-object sets track inherited / instantiated / removed children, see [references/prototypes.md](references/prototypes.md)

## Mutation

- **Pull vs push** - Poll a version number, or register callbacks; avoid notification storms, see [references/change-notification.md](references/change-notification.md)
- **Undo/redo** - Record inverse ops or before/after snapshots into an undo journal, see [references/undo-redo.md](references/undo-redo.md)

## Persistence

- **References serialize by id** - Persist ids/GUIDs, re-resolve on load, see [references/serialization.md](references/serialization.md)
- **Deterministic output** - Stable ordering for diff/version control; choose text vs binary, see [references/serialization.md](references/serialization.md)
- **Save changes or re-spawn from assets** - Persist member-level deltas for runtime state, asset references for content; POD serializes by default, see [references/serialization.md](references/serialization.md)
- **ABI-stable struct evolution** - Append fields at the end, add a leading `size`, never reorder/retype; semantic-version the API, see [references/serialization.md](references/serialization.md)
- **Snapshots & threading** - Publish immutable/copy-on-write versions for readers, see [references/snapshots-and-threading.md](references/snapshots-and-threading.md)

## Gotchas

- An undo entry that captured a pointer/index breaks once storage moves: capture ids and values, not addresses.
- External side effects (file writes, network) are not undoable; keep them out of the transactional journal.
- A loader that rejects unknown fields cannot open older OR newer files: migrate forward and ignore-or-preserve unknowns.
- Overriding a sub-object in an instance gives it a new id, so references to the prototype's original silently miss: resolve references through the override, don't store the new id everywhere.
- Allowing computed overrides (a property defined as an expression over the prototype's value) drags evaluation order and cycles into the data model: keep overrides concrete values.

## Progressive Disclosure

- Read [references/object-model.md](references/object-model.md) - Load when defining typed objects, property kinds, or data-driven schemas
- Read [references/references-and-ownership.md](references/references-and-ownership.md) - Load when linking objects by id, modeling ownership, or handling deletes
- Read [references/prototypes.md](references/prototypes.md) - Load when adding prefabs/templates/presets: prototype-instance inheritance, per-property overrides, override propagation
- Read [references/change-notification.md](references/change-notification.md) - Load when making edits observable, batching, or recomputing derived data
- Read [references/undo-redo.md](references/undo-redo.md) - Load when adding transactional edits, undo journals, or redo stacks
- Read [references/serialization.md](references/serialization.md) - Load when saving/loading, versioning the format, or migrating old files
- Read [references/snapshots-and-threading.md](references/snapshots-and-threading.md) - Load when giving reader threads a consistent view while writers mutate

Files in this skill

  • SKILL.md5.3 KB
  • eval-output.json4 KB
  • eval-trigger.json7 KB
  • moon.yml86 B
  • references/change-notification.md3 KB
  • references/object-model.md3.9 KB
  • references/prototypes.md3.1 KB
  • references/references-and-ownership.md4.6 KB
  • references/serialization.md6.4 KB
  • references/snapshots-and-threading.md5.1 KB
  • references/undo-redo.md5 KB
  • sources.json7.3 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.