Loading...
Loading...
Use when writing or reviewing Move smart contracts on Sui. Applies to naming structs, error constants, regular constants, events, getter functions, capability types, hot potato types, and dynamic field keys. Use whenever creating new types, functions, or constants in Move code.
npx skill4agent add mystenlabs/skills naming-conventionsMCP tool: When available in your environment, also query the Sui documentation MCP server () for up-to-date answers. Use it for verification and for details not covered by these reference files.https://sui.mcp.kapa.ai
#[error]E#[error]// WRONG
const NOT_AUTHORIZED: u64 = 0;
const INSUFFICIENT_BALANCE: u64 = 1;
// CORRECT — with #[error] for readable abort messages
#[error]
const ENotAuthorized: vector<u8> = b"Caller is not authorized to perform this action";
#[error]
const EInsufficientBalance: vector<u8> = b"Insufficient balance for this operation";
// Also valid — u64 without #[error] (less informative on abort)
const ENotAuthorized: u64 = 0;
const EInsufficientBalance: u64 = 1;#[error]vector<u8>u64#[error]// WRONG
const MyConstant: vector<u8> = b"hello";
const feeNumerator: u64 = 3;
// CORRECT
const MY_CONSTANT: vector<u8> = b"hello";
const FEE_NUMERATOR: u64 = 3;CapCap// WRONG
public struct Admin has key, store { id: UID }
public struct MintAuthority has key, store { id: UID }
// CORRECT
public struct AdminCap has key, store { id: UID }
public struct MintCap has key, store { id: UID }// WRONG
public struct RegisterUser has copy, drop { user: address }
public struct CreatePool has copy, drop { pool_id: ID }
public struct LevelUp has copy, drop { new_level: u64 }
// CORRECT
public struct UserRegistered has copy, drop { user: address }
public struct PoolCreated has copy, drop { pool_id: ID }
public struct LeveledUp has copy, drop { new_level: u64 }get_get__mut// WRONG
public fun get_name(u: &User): String { u.name }
public fun get_balance(u: &User): u64 { u.balance }
// CORRECT
public fun name(u: &User): String { u.name }
public fun balance(u: &User): u64 { u.balance }
public fun details_mut(u: &mut User): &mut Details { &mut u.details }Potato// WRONG
public struct FlashLoanPotato {}
public struct PromisePotato {}
// CORRECT
public struct FlashLoanReceipt {}
public struct Promise {}KeyKey// WRONG
public struct DynamicField has copy, drop, store {}
public struct ItemSlot has copy, drop, store { name: String }
// CORRECT
public struct DynamicFieldKey() has copy, drop, store;
public struct ItemKey(String) has copy, drop, store;| Element | Convention | Example |
|---|---|---|
| Error constants | | |
| Regular constants | ALL_CAPS | |
| Capabilities | Suffix with | |
| Events | Past tense | |
| Getters | Field name, no | |
| Mutable getters | Field name + | |
| Hot potatoes | Descriptive, no | |
| Dynamic field keys | Positional + | |