Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

generate-sui-agent-config

БесплатноБез исполняемых скриптовНе проверен

Current Sui dApp Kit APIs for React, Vue, and Next.js apps, and generation of a CLAUDE.md or AGENT.md config for Sui projects. Use when the user asks to…

MystenLabsот MystenLabs★ 25 звёзд на GitHub

Об этом скилле

Sui agent config and current dApp Kit APIs

MCP tool: when the Sui docs MCP server (https://sui.mcp.kapa.ai) is available, query it to verify APIs and fill gaps. Include a directive to use it in any config file you generate.

Use the current API, never the legacy one

Legacy / removed Use instead
@mysten/sui.js @mysten/sui
@mysten/dapp-kit (no suffix) @mysten/dapp-kit-react (React) or @mysten/dapp-kit-core (everything else)
SuiClient, SuiJsonRpcClient SuiGrpcClient from @mysten/sui/grpc
SuiClientProvider + WalletProvider + QueryClientProvider stack createDAppKit() + <DAppKitProvider>, still inside QueryClientProvider
useSuiClient useCurrentClient()
useSuiClientQuery, useSuiClientInfiniteQuery useCurrentClient() + TanStack useQuery / useInfiniteQuery
useSignAndExecuteTransaction (mutation hook), useConnectWallet useDAppKit() → instance.signAndExecuteTransaction(...)
TransactionBlock Transaction from @mysten/sui/transactions
tx.pure('n') typed helpers: tx.pure.u64(n), tx.pure.address(a), tx.pure.string(s)
{ transactionBlock: tx } { transaction: tx }
result.effects?.status?.status result.$kind / result.FailedTransaction discriminant
client.getBalance, client.getAllBalances client.core.listBalances
client.getOwnedObjects client.core.listOwnedObjects
nextCursor + hasNextPage single nullable cursor on the page result

Never say the legacy pattern still works. When a user shows legacy code, name each issue and give the replacement.

React setup

npm install @mysten/dapp-kit-react @mysten/sui @tanstack/react-query
// src/dapp-kit.ts
import { createDAppKit } from '@mysten/dapp-kit-react';
import { SuiGrpcClient } from '@mysten/sui/grpc';

export const dAppKit = createDAppKit({
  networks: ['testnet', 'mainnet'],
  defaultNetwork: 'testnet',
  createClient: (network) => new SuiGrpcClient({ network }), // add `url` for a custom endpoint
});

declare module '@mysten/dapp-kit-react' {
  interface Register {
    dAppKit: typeof dAppKit;
  }
}
// src/providers.tsx
import { DAppKitProvider } from '@mysten/dapp-kit-react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { dAppKit } from './dapp-kit';

const queryClient = new QueryClient();

export function Providers({ children }: { children: React.ReactNode }) {
  return (
    <QueryClientProvider client={queryClient}>
      <DAppKitProvider dAppKit={dAppKit}>{children}</DAppKitProvider>
    </QueryClientProvider>
  );
}

The declare module augmentation is React-only; omit it for @mysten/dapp-kit-core.

Reading chain data

const account = useCurrentAccount();
const client = useCurrentClient();

const { data } = useQuery({
  queryKey: ['balances', account?.address],
  enabled: !!account,
  queryFn: () => client.core.listBalances({ address: account!.address }),
});

Paginated owned objects / NFTs:

const q = useInfiniteQuery({
  queryKey: ['nfts', account?.address],
  enabled: !!account,
  initialPageParam: null as string | null,
  queryFn: ({ pageParam }) =>
    client.core.listOwnedObjects({
      address: account!.address,
      type: '0xPKG::nft::NFT',
      cursor: pageParam,
    }),
  getNextPageParam: (lastPage) => lastPage.cursor ?? undefined,
});

const items = q.data?.pages.flatMap((p) => p.objects) ?? [];
// <button onClick={() => q.fetchNextPage()} disabled={q.isFetchingNextPage || !q.hasNextPage}>

Sending a transaction

Order matters: build → sign+execute → check $kind → waitForTransaction → invalidate.

const dAppKit = useDAppKit();
const client = useCurrentClient();
const queryClient = useQueryClient();
const [isPending, setIsPending] = useState(false);
const [error, setError] = useState<Error | null>(null);

async function onClick() {
  setIsPending(true);
  setError(null);
  try {
    const tx = new Transaction();
    const [coin] = tx.splitCoins(tx.gas, [tx.pure.u64(500_000_000n)]);
    tx.transferObjects([coin], tx.pure.address(RECIPIENT));

    const result = await dAppKit.signAndExecuteTransaction({ transaction: tx });
    if (result.$kind === 'FailedTransaction') throw new Error('Transaction failed');

    await client.waitForTransaction({ digest: result.digest });
    await queryClient.invalidateQueries({ queryKey: ['balances'] });
  } catch (e) {
    setError(e as Error);
  } finally {
    setIsPending(false);
  }
}
  • Pass the Transaction instance itself; do not call tx.build() in app code.
  • Never call tx.setGasBudget, tx.setGasPrice, or tx.setGasPayment — the wallet handles gas.
  • There is no mutation hook; track isPending / error with useState.

Sign without executing (backend-sponsored gas)

const { bytes, signature } = await dAppKit.signTransaction({ transaction: tx });
const res = await fetch('/api/s
Полный SKILL.md на GitHub

Установить generate-sui-agent-config в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл generate-sui-agent-config?

Current Sui dApp Kit APIs for React, Vue, and Next.js apps, and generation of a CLAUDE.md or AGENT.md config for Sui projects. Use when the user asks to build, review, modernize, or debug Sui frontend code — connect wallet, read SUI balance, list owned objects or NFTs, send or sponsor a transaction — or mentions @mysten/dapp-kit, dapp-kit-react, dapp-kit-core, @mysten/sui, @mysten/sui.js, createDAppKit, DAppKitProvider, SuiClientProvider, useSuiClientQuery, a Sui tutorial that may be out of date, "CLAUDE.md", "AGENT.md", or "agent config".

Как установить скилл generate-sui-agent-config?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл generate-sui-agent-config запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить generate-sui-agent-config с