К основному содержанию
скилл CX Codex

sui-object-model — скилл для Claude Code: модели объектов Sui

Скилл sui-object-model для Claude Code описывает модель объектов Sui и помогает разбирать владение, передачу и хранение данных в Sui Move. Подключается к вопросам о выборе типа владения или структуры для данных.

Apache-2.0 617 установок ★ 25 обновлён 2026-11-12

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add MystenLabs/skills --skill sui-object-model -a claude-code
Открыть на GitHub

Что делает sui-object-model

Скилл разбирает объекты Sui: типы владения, abilities, версии, передачу и удаление. Он помогает сравнить dynamic_field с dynamic_object_field, а также Table, Bag, VecMap и LinkedTable для хранения данных. Для вопросов о конкретной теме загружает подходящий справочный файл.

Отдельные материалы посвящены шаблонам hot potato и capability, derived objects и отображению объектов через Display<T>. При полном ревью проекта нужны все справочные файлы. Для установки в Claude Code используется npx skills add MystenLabs/skills --skill sui-object-model -a claude-code; файл навыка находится по пути ~/.claude/skills/object-model/SKILL.md.

Какие задачи решает

  • выбрать тип владения для объекта Sui
  • сравнить динамические поля и коллекции
  • разобрать передачу, обёртывание или удаление объектов
  • спроектировать инвентарь или реестр в Sui Move
  • настроить отображение NFT через Object Display

Примеры запросов агенту

  • Сравни shared и owned для моего объекта Sui.
  • Как выбрать между Table, Bag и VecMap для инвентаря?
  • Проверь модель объектов в проекте целиком.

Как установить sui-object-model

1Через Skills CLI (Vercel)

npx skills add MystenLabs/skills --skill sui-object-model -a claude-code

2Вручную: положить файлы

~/.claude/skills/object-model/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/object-model/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о sui-object-model

Как установить sui-object-model в Claude Code?

Выполни npx skills add MystenLabs/skills --skill sui-object-model -a claude-code. Файл скилла находится в ~/.claude/skills/object-model/SKILL.md.

Что делает sui-object-model?

Скилл объясняет устройство объектов Sui и помогает с владением, передачей, версиями и хранением данных. Он также охватывает паттерны Move и Object Display.

Какие справочные файлы нужны для полного ревью проекта?

Для полного ревью загружаются все справочные файлы: об ownership, transfers, dynamic fields and collections, patterns и display.

Исходный текст

SKILL.md · Apache-2.0
---
name: sui-object-model
description: >
  Deep reference for the Sui object model: ownership types, object abilities,
  dynamic fields, collections, versioning, transfer patterns, and derived objects.
  Use this skill whenever the user asks about Sui objects, object ownership
  (address-owned, shared, immutable, wrapped), how to transfer or share or freeze
  objects, dynamic fields vs dynamic object fields, Table vs Bag vs VecMap,
  object versioning, wrapping and unwrapping, the Receiving type, custom transfer
  rules, hot potato pattern, capability pattern, object deletion, Object Display,
  or how to model data (inventories, registries, nested items) in Sui Move. Also
  use when the user needs to choose between ownership types or storage patterns
  for their use case.
---

# Sui Object Model

> **MCP tool:** When available in your environment, also query the Sui documentation MCP server (`https://sui.mcp.kapa.ai`) for up-to-date answers. Use it for verification and for details not covered by these reference files.

> **Source constraint:** All information in this skill is sourced exclusively from [docs.sui.io](https://docs.sui.io) and [move-book.com](https://move-book.com). When extending or updating this skill, only pull from these two sources. Do not use third-party blogs, tutorials, or unofficial documentation.

Objects are the fundamental unit of storage on Sui. Every resource, asset, and piece of data onchain is an object. Unlike account-based blockchains where state lives in shared mappings inside contracts, Sui gives each piece of state its own identity, version, and owner. Transactions consume objects as inputs and produce modified versions as outputs.

This skill routes to focused reference files. Load only the ones relevant to the current task.

---

## Reference files

### ownership — Ownership Types and Versioning
**Path:** `ownership.md`
**Load when:** asking about ownership types (address-owned, consensus-address-owned, shared, immutable, wrapped), choosing between shared and owned, parallel execution, consensus, Mysticeti, object versioning, Lamport timestamps, or frontend access to shared objects.
**Covers:** all five ownership types with consensus implications, consensus-address-owned objects, shared object access mode optimization, frontend PTB access pattern, wrapped object behavior, Lamport timestamp versioning, owned vs consensus-assigned versioning.

### transfers — Transferring and Deleting Objects
**Path:** `transfers.md`
**Load when:** transferring objects, choosing between `transfer` and `public_transfer`, implementing custom transfer rules, using `Receiving<T>`, transfer-to-object, or deleting/destroying objects.
**Covers:** eight core transfer functions (module-restricted vs public, including party_transfer variants), custom transfer rules, transfer-to-object with `Receiving<T>`, `receive` vs `public_receive`, object deletion/unpacking pattern, dynamic field cleanup warning.

### dynamic-fields-and-collections — Dynamic Fields and Collections
**Path:** `dynamic-fields-and-collections.md`
**Load when:** using dynamic fields, choosing between `dynamic_field` and `dynamic_object_field`, working with collections (`Table`, `Bag`, `VecMap`, `LinkedTable`), or designing storage for large datasets.
**Covers:** dynamic field vs dynamic object field visibility, field naming, core API (add/borrow/remove/exists_), all collection types with decision table, cleanup requirements, system limits (256 KB object size, 2048 objects/txn).

### patterns — Common Patterns and Derived Objects
**Path:** `patterns.md`
**Load when:** implementing hot potato, capability, soulbound, inventory, or borrow patterns, or working with derived objects.
**Covers:** hot potato pattern (no-ability structs), capability pattern (AdminCap/TreasuryCap), borrow pattern with `sui::borrow` module, soulbound objects, inventory pattern (ObjectBag), derived objects with deterministic IDs, derived objects vs dynamic fields comparison.

### display — Object Display (V2)
**Path:** `display.md`
**Load when:** setting up how objects render in wallets, explorers, or apps, working with Display templates, configuring NFT metadata, or migrating from Display V1.
**Covers:** V2 `Display<T>` creation via `display_registry::new_with_publisher`, `DisplayCap<T>` for updates, `set`/`unset`/`clear`/`share` API, `{field_name}` template syntax with nested field access, common display properties, V1 to V2 migration.

---

## Routing guide

| Task | Load |
|------|------|
| What is an object / object structure | SKILL.md only |
| Abilities: key, store, copy, drop | SKILL.md only |
| Ownership types, shared vs owned vs consensus-address-owned | ownership |
| Parallel execution, consensus | ownership |
| Object versioning, Lamport timestamps | ownership |
| Wrapped objects and accessibility | ownership |
| Frontend access to shared objects | ownership |
| Transferring objects, transfer vs public_transfer | transfers |
| Custom transfer rules | transfers + patterns |
| Transfer to object, Receiving | transfers |
| Deleting / destroying objects | transfers |
| Dynamic fields, dynamic object fields | dynamic-fields-and-collections |
| Collections: Table, Bag, VecMap, LinkedTable | dynamic-fields-and-collections |
| Scalability, large collection design | dynamic-fields-and-collections |
| Hot potato pattern | patterns |
| Capability pattern, AdminCap | patterns |
| Borrow pattern, cap inside object | patterns |
| Soulbound / non-transferable objects | transfers + patterns |
| Inventory for arbitrary objects | patterns + dynamic-fields-and-collections |
| Derived objects | patterns |
| Object Display, NFT rendering | display |
| Full project / code review | **all reference files** |

---

## Object structure

Every Sui object contains four components:

- **Globally unique ID:** A 32-byte identifier derived from the creation transaction digest plus a generation counter. The ID never changes across the object's lifetime.
- **Version number:** An 8-byte integer that increments with each modification. Uses Lamport timestamps: the new version for all objects a transaction touches is `1 + max(version of all input objects)`.
- **Owner field:** A 32-byte value designating access control (an address, another object's ID, or a sentinel for shared/immutable).
- **Transaction digest:** A 32-byte hash referencing the last transaction that modified the object.

Objects can be referenced three ways: by ID alone (query current state), by versioned ID (read historical state), or by full object reference containing ID + version + digest (transaction inputs, authenticated snapshot).

## Defining objects in Move

A Sui object is a Move struct with the `key` ability and an `id: UID` as the first field:

```move
public struct Sword has key, store {
    id: UID,
    damage: u64,
    element: String,
}
```

`object::new(ctx)` is the only way to create a `UID`. You cannot call `ctx.new()` directly.

## Move abilities and objects

| Ability | What it controls |
|---|---|
| `key` | The struct is a Sui object. Must have `id: UID` as first field. Required for all onchain objects. |
| `store` | The struct can be stored inside other objects, and transferred by any module using `public_transfer`. Without it, only the defining module can transfer the object. Adding `store` permanently removes the ability to enforce custom transfer rules. |
| `copy` | The struct can be duplicated. **Cannot be used on objects** — `UID` lacks `copy`, so any struct with `key` cannot have `copy`. Used only on non-object structs (configs, event data, read-only values). |
| `drop` | The struct can be silently discarded at end of scope. **Cannot be used on objects** — `UID` lacks `drop`, so any struct with `key` cannot have `drop`. Used only on non-object structs (ephemeral receipts, events). Objects must always be explicitly unpacked to destroy. |

### Object ability combinations

Because `UID` has neither `copy` nor `drop`, objects (structs with `key`) can only combine `key` and `store`:

- **`has key`:** Only the defining module can transfer, share, or freeze. Use for custom transfer rules.
- **`has key, store`:** Any module can transfer, share, freeze, or wrap. Use for freely composable assets. Once `store` is granted, you cannot re-add custom transfer restrictions.

### Non-object struct combinations (no `key`)

- **`has store`:** Can be stored as a field inside an object. Cannot exist independently.
- **`has copy, drop`:** A plain data struct for events, intermediate values, and configs.
- **`has copy, drop, store`:** Can be used as dynamic field names.
- **No abilities:** A hot potato. Must be consumed in the same transaction. See patterns reference file.

## Rules

- `object::new(ctx)` is the only way to create a UID. The `id: UID` field must be first.
- Once `store` is added to a type, custom transfer rules are permanently disabled.
- Once an object is shared, it cannot be converted back to address-owned.
- Always remove all dynamic fields before deleting a parent object — orphaned fields become permanently inaccessible.
- Accessing a nonexistent dynamic field (via `borrow`, `borrow_mut`, or `remove`) aborts the transaction. Use `exists_` to check first.
- Wrapping and unwrapping can happen within the same transaction — a PTB can wrap an object and later unwrap it atomically.
- Common capabilities: `AdminCap`, `TreasuryCap`, `UpgradeCap`. Always mention all three when discussing the capability pattern.
- Each `Table` entry is a separate storage operation — gas cost scales linearly with entries accessed per transaction.
- Prefer immutable references (`&`) on shared objects to maximize parallel execution.
- Do not use `VecMap` for collections larger than ~100 entries. Use `Table` instead.

## Common mistakes

- **Adding `store` when you need custom transfer rules.** Once granted, any module can call `public_transfer` and your enforcement logic is bypassed permanently.
- **Using `VecMap` for large collections.** It has O(n) lookup and is stored inline, hitting the 256 KB object size limit quickly.
- **Confusing `dynamic_field` with `dynamic_object_field`.** Use `dynamic_object_field` when the child must remain queryable by ID in explorers. Use `dynamic_field` for plain values.
- **Deleting an object without removing its dynamic fields first.** Those fields become permanently inaccessible.
- **Using the legacy `sui::display` module for new code.** Use `sui::display_registry` (Display V2). V1 was migrated to V2 via a system snapshot migration.
- **Forgetting to `display_registry::share(display)` after setting fields.** The display must be shared to be discoverable.

© MystenLabs · Apache-2.0 · MystenLabs/skills

Похожие скиллы

Все скиллы по теме «Языки программирования» →
Sui Knowledge Base (kapa.ai) MystenLabs Sui Knowledge Base (kapa.ai) — MCP-сервер для Claude Code и других платформ: ищет ответы в документации Sui по смыслу запроса и возвращает точные ссылки вместо списка файлов. CX Codex +1 ★ 7 782звёзд репо move-code-quality davila7 Скилл move-code-quality разбирает пакеты на языке Move по чек-листу качества из Move Book и подсказывает, что поправить под Move 2024 Edition. CX Codex +1 100установок aptos-agent-skills aptos-labs Набор скиллов для разработки на Aptos: контракты Move, TypeScript SDK, аудит безопасности и оптимизация газа. ★ 21звёзд репо 121-java-object-oriented-design Juan Antonio Breña Moral Скилл 121-java-object-oriented-design разбирает Java-код по принципам SOLID, DRY и YAGNI, находит God Class и Feature Envy и предлагает точечные рефакторинги. Пригодится при ревью и переработке объектной модели. CX Codex +1 505установок neon-object-storage neondatabase Скилл neon-object-storage для Claude Code настраивает S3-совместимое хранилище файлов в проекте Neon. Он включается, когда приложению нужны бакеты для загрузок, изображений или документов. CX Codex +1 46 500установок extension-object-storage caffeinelabs Скилл extension-object-storage для Claude Code добавляет в проект off-chain хранилище файлов: файлы хранятся вне сети, а бэкенд держит только ссылки. Хранит изображения, видео и документы для галерей. CX Codex +1 32 200установок

Из того же набора30

Весь набор →
sui-move Скилл sui-move для Claude Code, Codex и Cursor управляет написанием, проверкой и отладкой смарт-контрактов на Move в блокчейне Sui. CX Codex +1 633установок naming-conventions Скилл naming-conventions для Claude Code задаёт правила именования в Move-контрактах для Sui. Агент применяет их при создании и проверке типов, функций и констант. CX Codex +1 621установок sui-move-project Скилл sui-move-project для Claude Code настраивает Move-проекты в Sui и разбирает ошибки Move.toml, зависимостей и сборки. Срабатывает при создании проекта и миграции старого формата. CX Codex +1 620установок composable-move-functions Скилл composable-move-functions для Claude Code задаёт правила оформления функций на языке Move в блокчейне Sui. Включается при проектировании публичных сигнатур, порядка параметров и возврата объектов для транзакций PTB. CX Codex +1 616установок move-unit-testing Скилл move-unit-testing для Claude Code помогает писать модульные тесты для смарт-контрактов Move на Sui. Подключается, когда нужно создать тесты или добавить их к модулю Move. CX Codex +1 615установок sui-build Скилл sui-build для Claude Code помогает собирать пакеты Move командой sui move build. Агент подключает его, когда нужно написать или собрать Move-код либо ответить на вопрос о sui move build. CX Codex +1 613установок modern-move-syntax Скилл modern-move-syntax для Claude Code переводит генерацию смарт-контрактов Sui на синтаксис Move 2024. Он заменяет вызовы функций модулей на вызовы методов через точку, макросы и литералы. CX Codex +1 613установок accessing-data Скилл accessing-data для Claude Code подсказывает архитектуру чтения данных из блокчейна Sui: gRPC, GraphQL RPC, Archival Store, Walrus или sui-indexer-alt. Включается при запросах балансов, объектов и миграции. CX Codex +1 491установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой