sui-move-patterns

Standardize Sui Move design patterns for events, errors, OTW publishing, and capabilities.

4|Updated Feb 13, 2026
One-click install
npx skills add https://github.com/widnyana/eyay-toolkits --skill sui-move-patterns
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: sui-move-patterns
Source: https://github.com/widnyana/eyay-toolkits/tree/main/plugins/sui-dev-tools/skills/sui-move-patterns
Command: npx skills add https://github.com/widnyana/eyay-toolkits --skill sui-move-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Sui Move projects often ship with inconsistent event emission, brittle error handling, and low-composability core logic, which makes off-chain integrations harder and future upgrades riskier.

Core Features & Use Cases

  • Event emission for state changes: Emit typed events for client-visible changes like liquidity additions and other mutations.
  • Consistent error handling: Use predictable error constants and optional #[error] clever errors for readable abort messages.
  • Composability-focused design: Keep core logic pure by returning results instead of transferring them inside library-style functions.
  • Safer authority and publishing: Use the one-time witness (OTW) pattern for unique proofs and capability objects (AdminCap-style) instead of ctx.sender checks.
  • Use Case: Standardize a DeFi protocol module so indexers can reliably subscribe to events, clients get meaningful abort messages, and privileged actions are gated by capabilities.

Quick Start

Use the sui-move-patterns skill to review your Move module and rewrite its event emission, error constants, OTW initialization, capability gating, and pure-function boundaries for safer composability.

Frequently Asked Questions about sui-move-patterns

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

FAQPage Schema
How do I emit events for state changes in Sui Move to make them visible to off-chain indexers?▼

Emit events for state changes in Sui Move by using the event::emit function. This ensures client-visible mutations like liquidity additions are observable by off-chain indexers and subscribers.

What is the best way to handle errors and aborts in a Sui Move module?▼

Handle errors in Sui Move by defining predictable error constants using EPascalCase and u64 conventions. Optional #[error] attributes can provide readable abort messages for easier debugging.

How do I use capability-based authorization instead of ctx.sender checks in Sui Move?▼

Use capability objects like AdminCap to gate privileged functions in Sui Move. This replaces brittle ctx.sender checks with secure, transferable authority boundaries across upgrades.

How do I keep Sui Move library functions composable and pure?▼

Keep Sui Move library functions composable by returning results instead of transferring them inside the function. This pure-function design allows callers to safely handle the output.

What is the one-time witness (OTW) pattern used for in Sui Move publishing?▼

The one-time witness (OTW) pattern in Sui Move provides unique proofs for module initialization. It enforces package::claim initialization rules to ensure safe, single-execution setup.