Skip to main content
skill CX Codex

composable-move-functions — Claude Code skill: what it does

composable-move-functions — a skill for Claude Code enforces conventions for Sui Move function signatures. It activates when designing public APIs, ordering parameters, and handling object returns for PTB composition.

Apache-2.0 616 installs ★ 25 updated 2026-11-12

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add MystenLabs/skills --skill composable-move-functions -a claude-code
Open on GitHub

What composable-move-functions does

This skill guides the agent to author composable Move contracts compatible with Sui Programmable Transaction Blocks (PTBs). It bans the public entry pairing, requiring functions to be either composable public calls that return values or non-composable entry endpoints that handle transfers.

Signatures follow an exact argument sequence: target objects come first, followed by capabilities, primitive parameters, Clock, and ctx: &mut TxContext strictly at the end. Returning non-drop structs causes UnusedValueWithoutDrop errors under sui client call, requiring sui client ptb chaining or companion entry wrapper functions.

When available, the skill queries the Sui documentation MCP server at https://sui.mcp.kapa.ai to verify specific implementation details.

What it helps with

  • prevent the invalid public entry visibility combination in Sui Move
  • return newly minted assets to the caller instead of transferring them internally
  • arrange function parameters in the required object-capability-primitive sequence
  • adapt contract functions for chaining in Programmable Transaction Blocks

Example prompts for the agent

  • Write a composable mint function for a Sui NFT that returns the object
  • Fix the parameter order and visibility in this Move pool module
  • Create an entry wrapper to transfer the result of create_thing for CLI calls

How to install composable-move-functions

1Skills CLI (Vercel)

npx skills add MystenLabs/skills --skill composable-move-functions -a claude-code

2Manually: put the files in place

~/.claude/skills/composable-move-functions/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/composable-move-functions/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about composable-move-functions

How to install composable-move-functions in Claude Code?

Run npx skills add MystenLabs/skills --skill composable-move-functions -a claude-code. Alternatively, add the skill definition file to ~/.claude/skills/composable-move-functions/SKILL.md.

What does composable-move-functions do?

It guides the assistant to follow Sui Move standards, including object returns over internal transfers, parameter ordering, and PTB compatibility.

Why does the skill disallow public entry functions?

Combining public entry is redundant and restricts transaction composability. Functions must be either composable public utilities or standalone entry wrappers.

Source text

SKILL.md · Apache-2.0
---
name: composable-move-functions
description: Use when writing Move functions on Sui, especially public APIs. Applies to function visibility (public vs entry), parameter ordering, and return patterns. Use whenever designing function signatures or deciding whether functions should transfer objects or return them.
---

# composable-move-functions

> **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.

## Overview

Sui transactions can chain multiple function calls in a single Programmable Transaction Block (PTB). Functions that transfer objects internally instead of returning them break this composability. This skill covers how to design functions that work well in PTBs.

All patterns sourced from https://move-book.com/guides/code-quality-checklist

## No `public entry`

Functions should be either `public` (composable, can be called from other modules and PTBs) or `entry` (transaction endpoint only). Never use `public entry` together.

```move
// WRONG — public entry is redundant and limits composability
public entry fun do_something() { }

// CORRECT — public for composable functions that return values
public fun mint(ctx: &mut TxContext): NFT { }

// CORRECT — entry for intentionally non-composable endpoints
entry fun mint_and_keep(ctx: &mut TxContext) { }
```

**When to use `entry`:** Only for convenience endpoints that are intentionally non-composable — functions that wrap a composable `public` function and handle transfers to sender.

## Return Objects, Don't Transfer Internally

Public functions should return values to the caller rather than transferring them to `ctx.sender()`. This makes them composable in PTBs — the caller decides what to do with the result.

```move
// WRONG — couples minting with transfer, can't compose
public fun mint_and_transfer(ctx: &mut TxContext) {
    let nft = NFT { id: object::new(ctx) };
    transfer::transfer(nft, ctx.sender());
}

// CORRECT — returns the object, caller decides
public fun mint(ctx: &mut TxContext): NFT {
    NFT { id: object::new(ctx) }
}

// If you need a convenience entry point, add a separate entry wrapper:
entry fun mint_and_keep(ctx: &mut TxContext) {
    let nft = mint(ctx);
    transfer::transfer(nft, ctx.sender());
}
```

### CLI implication for returned values

Functions that return non-`drop` values cannot be invoked via `sui client call` — the CLI has no way to consume the returned value, causing an `UnusedValueWithoutDrop` error. Use `sui client ptb` instead, where you can chain `--assign` and `--transfer-objects` to handle the return value:

```bash
sui client ptb \
  --move-call @pkg::module::create_thing --assign thing \
  --transfer-objects "[thing]" @sender
```

If the function is called frequently from the CLI, consider providing a companion `entry` wrapper that transfers internally (as shown above).

This applies broadly:
- `add_liquidity` should return LP coins and remainder coins, not transfer them
- `remove_liquidity` should return both coins, not transfer them
- `swap` should return the output coin, not transfer it
- `borrow` should return the borrowed asset, not transfer it

## Parameter Ordering

Function parameters follow a strict order:

1. **Objects first** — the primary object being acted on
2. **Capabilities second** — authorization tokens like `AdminCap`
3. **Primitive values** — amounts, flags, addresses
4. **Clock** — always at the end (before ctx), exception to objects-first rule
5. **`ctx: &mut TxContext` last** — ALWAYS the final parameter, after all primitives and all other arguments

```move
// WRONG — cap before object, primitives mixed in
public fun authorize_action(
    cap: &AdminCap,
    value: u8,
    app: &mut App,
    ctx: &mut TxContext,
) { }

// CORRECT — object first, cap second, primitives third, ctx last
public fun authorize_action(
    app: &mut App,
    cap: &AdminCap,
    value: u8,
    ctx: &mut TxContext,
) { }
```

### Clock Exception

`Clock` goes near the end, just before `ctx`, even though it's an object:

```move
public fun timed_action(
    app: &mut App,
    cap: &AppCap,
    value: u8,
    clock: &Clock,
    ctx: &mut TxContext,
) { }
```

## Quick Reference

| Pattern | Rule |
|---------|------|
| Visibility | `public` for composable, `entry` for endpoints. Never `public entry`. |
| Returns | Public functions return objects. Don't transfer to sender internally. |
| Entry wrappers | Separate `entry` function that calls `public` function + transfers. |
| Param order | Object → Capability → Primitives → Clock → TxContext |

© MystenLabs · Apache-2.0 · MystenLabs/skills

Similar skills

All skills for Programming languages →

From the same set30

The whole set →
sui-move sui-move — a skill for Claude Code, Codex and Cursor that guides writing, reviewing and debugging Move smart contracts on Sui. CX Codex +1 633installs naming-conventions The naming-conventions Claude Code skill sets naming rules for Move contracts on Sui. The agent uses it while creating or reviewing types, functions, and constants. CX Codex +1 621installs sui-move-project sui-move-project is a Claude Code skill for setting up Sui Move projects and fixing Move.toml, dependency, and build issues. It activates for project creation and legacy-format migrations. CX Codex +1 620installs sui-object-model The sui-object-model Claude Code skill covers Sui objects and helps answer questions about ownership, transfers, and data storage in Sui Move. It activates for choices between ownership types or storage patterns. CX Codex +1 617installs move-unit-testing The move-unit-testing Claude Code skill guides unit testing for Move smart contracts on Sui. It activates when asked to write tests or add them to a Move module. CX Codex +1 615installs sui-build The sui-build Claude Code skill guides Move package builds with sui move build. The agent uses it for Move coding and questions about the build command. CX Codex +1 613installs modern-move-syntax modern-move-syntax — a skill for Claude Code that enforces Move 2024 edition syntax for Sui smart contracts. It replaces legacy module calls with method dot notation, loop macros, and clean literals. CX Codex +1 613installs accessing-data accessing-data — a skill for Claude Code that guides data fetching on Sui across gRPC, GraphQL RPC, Archival Store, Walrus, and sui-indexer-alt. Triggers on queries about balances, objects, and JSON-RPC migrations. CX Codex +1 491installs

Project sponsors

Companies that keep this analytics open