sui-move-objectlisted
Install: claude install-skill widnyana/eyay-toolkits
## 1. Structs
All structs must be declared `public`. Ability declarations go **after** the fields:
```move
// ✅
public struct Pool has key {
id: UID,
balance_x: Balance<SUI>,
balance_y: Balance<USDC>,
}
public struct PoolCap has key, store {
id: UID,
pool_id: ID,
}
// ❌ Legacy — no public keyword
struct Pool has key {
id: UID,
}
```
**Object rule**: Any struct with the `key` ability **must** have `id: UID` as its first field. Use `object::new(ctx)` to create UIDs — never reuse or fabricate them.
### Naming conventions
**Capabilities** must be suffixed with `Cap`:
```move
// ✅
public struct AdminCap has key, store { id: UID }
// ❌ Unclear it's a capability
public struct Admin has key, store { id: UID }
```
**No `Potato` suffix** — a struct's lack of abilities already communicates it's a hot potato:
```move
// ✅
public struct Promise {}
// ❌
public struct PromisePotato {}
```
**Events named in past tense** — they describe something that already happened:
```move
// ✅
public struct LiquidityAdded has copy, drop { ... }
public struct FeesCollected has copy, drop { ... }
// ❌
public struct AddLiquidity has copy, drop { ... }
public struct CollectFees has copy, drop { ... }
```
**Dynamic field keys** — use positional structs (no named fields):
```move
// ✅
public struct BalanceKey() has copy, drop, store;
// ⚠️ Acceptable but not canonical
public struct BalanceKey has copy, drop, store {}
```
### Constants naming
Error constants use `EPas