Agent skill

New CLI Action

by phantom in phantom/phantom-connect-sdk

Scaffold a new CLI action for this SDK repository. An agent skill from phantom/phantom-connect-sdk.

MITAuto-check: notesAgent Workflows

Install New CLI Action

skills CLI
$ npx skills add phantom/phantom-connect-sdk --skill new-cli-action -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install phantom/phantom-connect-sdk new-cli-action --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/phantom/phantom-connect-sdk.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/new-cli-action .claude/skills/new-cli-action && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
new-cli-action
GitHub stars
162
Token cost
~3k tokens
SKILL.md length
787 words
Files
1
Skills in repo
2
Repo updated
First seen
Licence
MIT

At a glance

Scaffold a new CLI action for this SDK repository. An agent skill from phantom/phantom-connect-sdk.

  • Works in 7 steps: Understand the requirement → Determine the file location and CLI group → Write the action file → …
  • The user asks to add a new command
  • SKILL.md covers Step 1 — Understand the…, Step 2 — Determine the file…, Step 3 — Write the action file and Step 4 — Register the CLI…, plus 5 more sections
  • Calls npx

What it does

New CLI Action is an agent skill from phantom/phantom-connect-sdk. Scaffold a new CLI action for this SDK repository. Use when the user asks to add a new command, tool, or action to the Phantom CLI/MCP. Guides through creating the action file, registering the command in the appropriate CLI group, and adding the tool to the OpenClaw registry.

Its SKILL.md is about 3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Agent Workflows, covering MCP servers. It works with Model Context Protocol. The repository describes itself as: Multi-platform SDKs for integrating Phantom. The licence is MIT.

When your agent uses it

  • The user asks to add a new command
  • Action to the Phantom CLI/MCP

Example prompts

  • “/new-cli-action”

Requirements

  • Node.js
  • Pre-approved tools (allowed-tools): Read, Write, Edit, Bash, Agent

Workflow steps

7 steps, taken from the step headings in SKILL.md.

  1. Understand the requirement
  2. Determine the file location and CLI group
  3. Write the action file
  4. Register the CLI command
  5. Register the MCP tool for OpenClaw
  6. Verify
  7. Update documentation

What it can do on your machine

Read from SKILL.md and the folder at commit daa18ef. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit
    • Bash
    • Agent

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npx

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

New CLI Action loads about 3k tokens when it runs. Until then it costs about 73 tokens; SKILL.md has 787 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~73
When it runs · the whole SKILL.md, loaded when a task matches
~3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NotePre-approves every shell command (allowed-tools: Bash)SKILL.md
    allowed-tools: Read, Write, Edit, Bash, Agent

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from phantom/phantom-connect-sdk at commit daa18ef, republished under its MIT licence (© phantom). 787 words, ~3,019 tokens.

Download SKILL.mdSave it as .claude/skills/new-cli-action/SKILL.md (or your agent's skills folder).
name
new-cli-action
description
Scaffold a new CLI action for this SDK repository. Use when the user asks to add a new command, tool, or action to the Phantom CLI/MCP. Guides through creating the action file, registering the command in the appropriate CLI group, and adding the tool to the OpenClaw registry.
allowed-tools
Read, Write, Edit, Bash, Agent
user-invocable
true

/new-cli-action — Scaffold a New CLI Action

Arguments passed: $ARGUMENTS

You are helping the user add a new command to the Phantom CLI (packages/cli). Every action is automatically exposed in three places: the CLI binary, the MCP server, and OpenClaw. All three come for free from a single createAction call — the user only needs to write one file and make two registration edits.

Framework: The CLI is built on incur, a TypeScript framework for building CLIs that work as both binaries and MCP servers. The Cli and z imports in every action file come from incur. If you need deeper guidance on incur patterns — schemas, Cli APIs, or advanced usage — run npx incur skills add in the project root to pull the official incur skill into Claude Code and piggyback off it.


Step 1 — Understand the requirement

If $ARGUMENTS is empty or vague, ask the user:

  1. What should the command do? (one sentence)
  2. What inputs does it need?
  3. What does a success response look like?
  4. Where should it live in the CLI? (top-level like phantom buy, or under a sub-group like phantom perps open)

If $ARGUMENTS describes the command well enough, proceed directly.


Step 2 — Determine the file location and CLI group

The CLI is structured as follows. Read packages/cli/src/index.ts and the relevant command file to confirm the current shape before writing anything.

CLI pathCommand fileAction files
phantom <cmd>src/index.ts (registered directly)src/actions/<name>.ts
phantom wallet <cmd>src/commands/wallet.tssrc/actions/<name>.ts
phantom solana <cmd>src/commands/solana.tssrc/actions/<name>.ts
phantom evm <cmd>src/commands/evm.tssrc/actions/<name>.ts
phantom perps <cmd>src/commands/perps.tssrc/actions/<name>.ts
phantom token <cmd>src/commands/token.tssrc/actions/<name>.ts

If the command belongs to a new group that doesn't have a command file yet, create src/commands/<group>.ts following the pattern of an existing one (e.g. wallet.ts), then register <group>Cli in src/index.ts.

Decide the kebab-case filename: src/actions/<verb>-<noun>.ts (e.g. get-perp-account.ts, send-evm-transaction.ts).


Step 3 — Write the action file

Create packages/cli/src/actions/<name>.ts using the template below. Fill every section — do not leave TODOs or placeholders.

typescript
/**
 * <mcp_command_name> tool
 *
 * <One or two sentences describing what this action does and any important
 * preconditions (e.g. "Wallet must hold USDC in the perps account").>
 */

import { Cli, z } from "incur";
import { createAction } from "../utils/actions.js";
// Import helpers as needed:
//   Session/wallet:  import { WalletIdSchema, DerivationIndexSchema } from "../utils/schemas.js";
//   Solana address:  import { getSolanaAddress } from "../utils/solana.js";
//   EVM address:     import { getEthereumAddress } from "../utils/evm.js";
//   Perps client:    import { createPerpsClient } from "../utils/perps.js";
//   Shared schemas:  import { ActionResponseSchema, PendingConfirmationSchema } from "../utils/output-schemas.js";

const <PascalName>Schema = z.object({
  // Each field needs a .describe() explaining its purpose and any defaults.
  // Always include these at the bottom if the action touches the wallet:
  // walletId: WalletIdSchema.describe("Optional wallet ID (defaults to authenticated wallet)"),
  // derivationIndex: DerivationIndexSchema.describe("Optional derivation index (default: 0)"),
});

const <PascalName>OutputSchema = z.object({
  // Define every field the run() function returns.
  // Use z.string().nullable() when a field can be null.
  // Use .optional() for fields that are sometimes absent.
});

const <camelName>Action = createAction({
  // description: Shown to the LLM agent. Should be detailed enough that the
  // agent knows when and how to use this tool. Include:
  //   - What it does
  //   - Any required preconditions
  //   - What the success response looks like
  //   - Any important defaults or two-step flow notes
  description:
    "Phantom Wallet — <detailed description>.",
  options: <PascalName>Schema,
  output: <PascalName>OutputSchema,
  mcp: {
    // command: The MCP/RPC method name. Use snake_case. Should be more
    // descriptive than the CLI sub-command name because MCP tools are flat
    // (no nesting), e.g. "get_perp_account" not just "account".
    command: "<snake_case_mcp_name>",
    annotations: {
      // readOnlyHint: true  → no side effects (reads only)
      // readOnlyHint: false → has side effects (writes, transactions)
      readOnlyHint: <true|false>,
      // destructiveHint: true → irreversible (sends tx, deletes data)
      destructiveHint: <true|false>,
      // openWorldHint: true → makes network/external calls
      openWorldHint: <true|false>,
    },
  },
  run: async ({ options: params, var: context }) => {
    const { logger } = context;
    const session = context.manager.getSession();

    // context.manager.getClient() → PhantomClient (sign, send, addresses)
    // context.apiClient           → PhantomApiClient (REST endpoints)
    // session.walletId            → currently authenticated wallet ID
    // session.organizationId      → org ID for the current session

    // A session is automatically initialized on first use and persisted
    // across calls — no manual session management required.

    // ... implementation ...

    return { /* must match <PascalName>OutputSchema */ };
  },
});

export const <camelName>Command = Cli.create("<cli-subcommand>", <camelName>Action.command);
export const <camelName>Tool = <camelName>Action.tool;
Key rules when filling out the template
  • Input schema first, output schema second — the input schema is defined above the output schema in every action file.
  • description on every input field — each z.* field must have .describe(...). Include the default value in the description text if one exists (e.g. "Default: false.").
  • No output: z.any() — always define a concrete output schema.
  • mcp.command vs CLI sub-command — the MCP command name is flat and globally unique (get_perp_account); the CLI sub-command is the leaf word under its group (account under phantom perps).
  • readOnlyHint: true only for pure reads with no side effects.
  • Shared output schemas — if the output shape is also used by another action, add it to src/utils/output-schemas.ts and import it. Otherwise define it inline.
  • ActionResponseSchema — use for any Hyperliquid write operation that returns { status, data? }.
  • PendingConfirmationSchema — use in a union for two-step flows (simulate first, then confirm).

Show full SKILL.md (319 more words)Show less

Step 4 — Register the CLI command

Open the relevant command file and add one import + one .<command>() call.

Example — adding to perps:

typescript
// In src/commands/perps.ts
import { <camelName>Command } from "../actions/<name>.js";
// ...
perpsCli.command(<camelName>Command);

Example — adding top-level to src/index.ts:

typescript
import { <camelName>Command } from "./actions/<name>.js";
// ...
cli.command(<camelName>Command);

Step 5 — Register the MCP tool for OpenClaw

Open src/tools/index.ts, add the import, and add the tool to the tools array in the appropriate section:

typescript
import { <camelName>Tool } from "../actions/<name>.js";

export const tools: ToolHandler[] = [
  // ... existing tools ...
  <camelName>Tool,   // add in the logical group (wallet / solana / evm / perps read / perps write)
];

Step 6 — Verify

Run the TypeScript check to confirm zero errors:

bash
cd packages/cli && npx tsc --noEmit

If there are type errors, fix them before reporting the work as done. Common issues:

  • Return type of run() doesn't match <PascalName>OutputSchema — check every return path.
  • z.string().nullable() needed where the value can be null.
  • Missing as const on literal returns inside discriminated unions.

Step 7 — Update documentation

Four places need updating. Do all four before reporting done.

1. packages/cli/src/index.ts — MCP_INSTRUCTIONS

Add the new tool to the Available tools: sentence in MCP_INSTRUCTIONS:

typescript
"<mcp_command> (<one-line description>), " +
2. packages/cli/README.md
  • Commands section: Add the CLI command under the appropriate group heading (or add a new heading for a new group).
  • MCP Tools table: Add a row | \<mcp_name>` | <description> |` in the logical group.
3. packages/mcp-server/README.md

Add a row to the relevant tools table (or a new table + heading for a new category):

markdown
| `<mcp_name>` | <One-sentence description.> |
4. packages/phantom-openclaw-plugin/README.md

Add a full tool entry in the Available Tools section following the existing pattern:

markdown
### `<mcp_name>`

<Two-sentence description: what it does and when to use it.>

**Parameters:**

- `<param>` (<type>, required/optional): <description>

**Example:**

\`\`\`json
{ "<param>": "<value>" }
\`\`\`

**Response:** `{ <key fields> }`

Reference: context object

typescript
context.logger; // Logger — .info(), .warn(), .error(), .debug()
context.apiClient; // PhantomApiClient — Phantom REST endpoints
context.manager.getClient(); // PhantomClient — KMS signing, wallet ops
context.manager.getSession(); // { walletId, organizationId }
context.manager.isInitialized(); // boolean — false if not yet authed

A session is initialized on first use (triggering the browser auth flow) and persisted automatically. The createAction wrapper handles AUTH_EXPIRED by resetting the session and surfacing a clear error — no manual handling needed.


Reference: commonly used helpers

HelperImport pathWhen to use
getSolanaAddress(context, walletId, derivationIndex)../utils/solana.jsDerive Solana public key
getEthereumAddress(context, walletId, derivationIndex)../utils/evm.jsDerive EVM address
createPerpsClient(context, walletId, derivationIndex?)../utils/perps.jsAll Hyperliquid perps ops
normalizeNetworkId(id)../utils/network.jsNormalise CAIP-2 chain IDs
parseBaseUnitAmount(amount)../utils/amount.jsString/number → bigint base units
parseUiAmount(amount, decimals)../utils/amount.jsUI units → bigint base units
runSimulation(body, context)../utils/simulation.jsSimulate before submitting
WalletIdSchema../utils/schemas.jsOptional wallet ID input field
DerivationIndexSchema../utils/schemas.jsOptional HD index input field
Caip2ChainIdSchema../utils/schemas.jsCAIP-2 chain ID input field

© phantom, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/new-cli-action of phantom/phantom-connect-sdk.

Open the folder on GitHubat commit daa18ef

Compare with similar skills

New CLI Action next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

New CLI Action compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
New CLI Action this skillphantom/phantom-connect-sdk162—~3kAutomated safety check: NotesMIT
MCP Server Builderanthropics/skills180k62 repos~2.3kAutomated safety check: PassApache-2.0
MCP Server BuildershareAI-lab/learn-claude-code78k5 repos~1.2kAutomated safety check: PassMIT
MCP Integration for Pluginsanthropics/claude-plugins-official37k11 repos~3.1kAutomated safety check: PassApache-2.0
Fastmcp Client CLIPrefectHQ/fastmcp28k1 repos~823Automated safety check: PassApache-2.0
Crush Configurationcharmbracelet/crush29k—~3.7kAutomated safety check: PassCustom licence

Similar skills

  • MCP Server Builder

    anthropics/skills

    Official

    Guides the design and implementation of Model Context Protocol servers in TypeScript or Python, from tool naming and error messages to evaluation.

    180k GitHub starsUsed in 62 repos~2.3k tokens
    Agent WorkflowsAuto-check passed
  • MCP Server Builder

    shareAI-lab/learn-claude-code

    Walks through building MCP servers in Python or TypeScript that expose tools, resources and prompts to Claude, with templates, registration and testing.

    78k GitHub starsUsed in 5 repos~1.2k tokens
    Agent WorkflowsAuto-check passed
  • MCP Integration for Plugins

    anthropics/claude-plugins-official

    Official

    Explains how to bundle Model Context Protocol servers in a Claude Code plugin, covering config files, stdio, SSE, HTTP and WebSocket server types, and authentication.

    37k GitHub starsUsed in 11 repos~3.1k tokens
    Agent WorkflowsAuto-check passed
  • Fastmcp Client CLI

    PrefectHQ/fastmcp

    Query and invoke tools on MCP servers using fastmcp list and fastmcp call.

    28k GitHub starsUsed in 1 repo~823 tokens
    Agent WorkflowsAuto-check passed
  • Crush Configuration

    charmbracelet/crush

    Explains how to configure the Crush coding agent with crushrc or crush.json, covering providers, models, LSPs, MCP servers, hooks, permissions and config precedence.

    29k GitHub stars~3.7k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Context Mode Output Sandbox

    mksglu/context-mode

    Routes large command, file, API and browser output through context-mode tools so only the needed result enters the agent's context, instead of dumping it via Bash.

    26k GitHub stars~4.1k tokensUpdated today
    Agent WorkflowsAuto-check passed

More from phantom/phantom-connect-sdk

  • Phantom Wallet

    phantom/phantom-connect-sdk

    Phantom wallet connected. An agent skill from phantom/phantom-connect-sdk.

    162 GitHub stars~3.5k tokensUpdated 2 days ago
    Auto-check passed

Categories

Questions about New CLI Action

What does New CLI Action do?

Scaffold a new CLI action for this SDK repository. An agent skill from phantom/phantom-connect-sdk. New CLI Action is an agent skill from phantom/phantom-connect-sdk. Scaffold a new CLI action for this SDK repository.

When should I use New CLI Action?

New CLI Action fits situations like: the user asks to add a new command; action to the Phantom CLI/MCP.

How do I install New CLI Action in Claude Code?

Run `npx skills add phantom/phantom-connect-sdk --skill new-cli-action -a claude-code`. Or copy the skill folder (.claude/skills/new-cli-action in phantom/phantom-connect-sdk) into .claude/skills/new-cli-action in your project. Claude Code loads it when a task matches its description.

How do I install New CLI Action in Codex?

Run `npx skills add phantom/phantom-connect-sdk --skill new-cli-action -a codex`. Or copy the skill folder (.claude/skills/new-cli-action in phantom/phantom-connect-sdk) into .agents/skills/new-cli-action in your project. Codex loads it when a task matches its description.

Can I use New CLI Action in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add phantom/phantom-connect-sdk --skill new-cli-action -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/new-cli-action, .gemini/skills/new-cli-action, .github/skills/new-cli-action and .opencode/skills/new-cli-action in your project.

What does New CLI Action need to run?

Going by SKILL.md and its folder, New CLI Action needs the command-line tools its instructions call (npx). Our summary lists: Node.js. Its frontmatter pre-approves these tools: Read, Write, Edit, Bash, Agent.

Does New CLI Action access the network?

SKILL.md names 1 domain. As links in the text: github.com. This is read from the text; nothing was executed.

Is New CLI Action safe to install?

Our automated static check of SKILL.md found notes only (pre-approves every shell command (allowed-tools: bash)), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does New CLI Action use?

New CLI Action is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does New CLI Action use?

About 3k tokens (SKILL.md is roughly 12k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to New CLI Action?

Skills that share tags, products or a category with New CLI Action: MCP Server Builder (anthropics/skills, 180k stars), MCP Server Builder (shareAI-lab/learn-claude-code, 78k stars), MCP Integration for Plugins (anthropics/claude-plugins-official, 37k stars) and Fastmcp Client CLI (PrefectHQ/fastmcp, 28k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains New CLI Action?

phantom (a GitHub organization) maintains it in phantom/phantom-connect-sdk, which has 162 GitHub stars. The repository holds 2 skills in this directory. The repository was last updated on October 5, 2026.

Source: phantom/phantom-connect-sdk on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.