mystenlabs/sui-dev-skills/patterns
Claude Code and agent skill by mystenlabs/sui-dev-skills
- community
Checking that the SKILL.md file is still in the repository.
Move design patterns — events, error handling, one-time witness (OTW), capability pattern, and pure functions/composability.
Install
npx vskill@latest install mystenlabs/sui-dev-skills/patternsSKILL.md
1. Events
Emit events for all state-changing operations that clients need to observe:
2. Error Handling
Error constants use EPascalCase and u64 values:
Clever errors
Annotating a constant with #[error] allows it to carry a human-readable message. The value can be any valid constant type — vector<u8> is most common for string messages:
At runtime, the Sui CLI and GraphQL server automatically decode these into a readable message:
Gotcha: clever error abort codes encode the source line number, so their u64 value can change if the file is reformatted or lines shift. Don't hardcode clever error abort codes in tests or off-chain tooling — match by constant name instead.
**assert! without an abort code** is also valid and auto-derives a clever abort code from the source line:
This is fine for internal invariants where the line number alone is enough context.
3. One-Time Witness (OTW) Pattern
Use the OTW pattern for modules that need a unique, uncopyable proof-of-publication (e.g., coin types, publisher objects):
4. Capability Pattern
Use capability objects to gate privileged functions instead of checking ctx.sender(). This is more composable and testable — the capability can be held by a contract, not just a wallet:
Note the parameter order: the object (pool) comes before the primitive (new_fee), and _: &AdminCap follows the objects-then-capabilities ordering from the syntax skill's §3 Visibility.
5. Pure Functions and Composability
Keep core logic functions pure — they take objects by reference/value and return values. Do not call transfer::transfer to deliver results to the caller:
Internal transfers are acceptable when they serve the function's own mechanics (e.g., burning tokens to @0x0, sharing a newly created object). The key rule is: don't transfer the caller's results — return them instead so the caller can compose.
Return excess coins even if their value is zero — let the caller decide what to do with them.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingmove/patterns/SKILL.md
Popularity
- Repository stars
- 20
- Repository forks
- 9
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/mystenlabs/sui-dev-skills/patterns)