|
| 1 | +--- |
| 2 | +name: metamask-agent-wallet |
| 3 | +description: Use when the user asks anything about blockchain wallets, transactions, signing, token transfers, supported chains, wallet balances, perpetual futures trading, prediction markets, token swaps, cross-chain bridges, market data, token discovery, or authentication via the MetaMask Agentic CLI. Single entry point for all mm-dev CLI operations. |
| 4 | +license: MIT |
| 5 | +metadata: |
| 6 | + author: metamask |
| 7 | + version: "1.0.0" |
| 8 | +--- |
| 9 | + |
| 10 | +# MetaMask Agentic CLI Skill |
| 11 | + |
| 12 | +This skill documents the `mm-dev` CLI surface for MetaMask Agent Wallet authentication, wallet lifecycle, balance queries, token transfers, message and typed-data signing, raw transactions, chain discovery, market data, token discovery, perpetual futures trading, prediction market trading, token swaps, and cross-chain bridges. |
| 13 | + |
| 14 | +Use the routing table to select the relevant reference file. CLI behavior lives in `references/`. Repeatable operational patterns live in `workflows/`. |
| 15 | + |
| 16 | +## Command Routing |
| 17 | + |
| 18 | +Match the user's intent to a command and reference file, then read the reference before constructing a command. If intent spans multiple domains, load them sequentially in dependency order. |
| 19 | + |
| 20 | +| User Intent | Command | Reference | |
| 21 | +| --- | --- | --- | |
| 22 | +| Check authentication status | `mm-dev auth status` | [auth.md](references/auth.md) | |
| 23 | +| Login in MetaMask Agentic CLI | `mm-dev login` | [auth.md](references/auth.md) | |
| 24 | +| Choose a wallet mode and set up policies | `mm-dev init` | [auth.md](references/auth.md) | |
| 25 | +| Sign in via QR code | `mm-dev login qr` | [auth.md](references/auth.md) | |
| 26 | +| Sign in via Google | `mm-dev login google` | [auth.md](references/auth.md) | |
| 27 | +| Sign in via email OTP | `mm-dev login email` | [auth.md](references/auth.md) | |
| 28 | +| Sign out | `mm-dev logout` | [auth.md](references/auth.md) | |
| 29 | +| Reset CLI session | `mm-dev reset` | [auth.md](references/auth.md) | |
| 30 | +| Interpret raw CLI error codes | `AuthError`, `ValidationError`, `WALLET_ERROR` | [errors.md](references/errors.md) | |
| 31 | +| Create a wallet | `mm-dev wallet create` | [wallet.md](references/wallet.md) | |
| 32 | +| List all wallets | `mm-dev wallet list` | [wallet.md](references/wallet.md) | |
| 33 | +| Switch active wallet | `mm-dev wallet select` | [wallet.md](references/wallet.md) | |
| 34 | +| Show active wallet details | `mm-dev wallet show` | [wallet.md](references/wallet.md) | |
| 35 | +| Show active wallet address | `mm-dev wallet address` | [wallet.md](references/wallet.md) | |
| 36 | +| Check the active wallet balance | `mm-dev wallet balance` | [wallet.md](references/wallet.md) | |
| 37 | +| Sign a plaintext message | `mm-dev wallet sign-message` | [signing.md](references/signing.md) | |
| 38 | +| Sign EIP-712 typed data | `mm-dev wallet sign-typed-data` | [signing.md](references/signing.md) | |
| 39 | +| Send a raw EVM transaction | `mm-dev wallet send-transaction` | [transaction.md](references/transaction.md) | |
| 40 | +| Transfer native tokens or ERC-20 tokens | `mm-dev transfer` | [transfer.md](references/transfer.md) | |
| 41 | +| List supported chains by the CLI | `mm-dev chains list` | [chain.md](references/chain.md) | |
| 42 | +| List pending wallet requests | `mm-dev wallet requests list` | [polling.md](references/polling.md) | |
| 43 | +| Watch a wallet polling id | `mm-dev wallet requests watch` | [polling.md](references/polling.md) | |
| 44 | +| Query spot or historical prices | `mm-dev price ...` | [market-data.md](references/market-data.md) | |
| 45 | +| Discover tokens, token networks, or token metadata | `mm-dev token ...` | [market-data.md](references/market-data.md) | |
| 46 | +| List perpetual markets | `mm-dev perps markets` | [perps.md](references/perps.md) | |
| 47 | +| Check perps account balance | `mm-dev perps balance` | [perps.md](references/perps.md) | |
| 48 | +| List open perpetual positions | `mm-dev perps positions` | [perps.md](references/perps.md) | |
| 49 | +| Get a quote for a perpetual order | `mm-dev perps quote` | [perps.md](references/perps.md) | |
| 50 | +| List resting perpetual orders | `mm-dev perps orders` | [perps.md](references/perps.md) | |
| 51 | +| Open a perpetual position | `mm-dev perps open` | [perps.md](references/perps.md) | |
| 52 | +| Close a perpetual position | `mm-dev perps close` | [perps.md](references/perps.md) | |
| 53 | +| Modify leverage, take-profit, or stop-loss | `mm-dev perps modify` | [perps.md](references/perps.md) | |
| 54 | +| Cancel a resting perps order | `mm-dev perps cancel` | [perps.md](references/perps.md) | |
| 55 | +| Deposit USDC into a perps venue | `mm-dev perps deposit` | [perps.md](references/perps.md) | |
| 56 | +| Withdraw USDC from a perps venue | `mm-dev perps withdraw` | [perps.md](references/perps.md) | |
| 57 | +| Set Predict trading mode | `mm-dev predict mode` | [predict.md](references/predict.md) | |
| 58 | +| One-time Predict setup | `mm-dev predict setup` | [predict.md](references/predict.md) | |
| 59 | +| Create or refresh Predict credentials | `mm-dev predict auth` | [predict.md](references/predict.md) | |
| 60 | +| Repair Predict approvals | `mm-dev predict approve` | [predict.md](references/predict.md) | |
| 61 | +| Check Predict back-end status | `mm-dev predict status` | [predict.md](references/predict.md) | |
| 62 | +| Search prediction markets | `mm-dev predict markets` | [predict.md](references/predict.md) | |
| 63 | +| Inspect a prediction market | `mm-dev predict market` | [predict.md](references/predict.md) | |
| 64 | +| Preview a prediction order cost | `mm-dev predict quote` | [predict.md](references/predict.md) | |
| 65 | +| Place a prediction market order | `mm-dev predict place` | [predict.md](references/predict.md) | |
| 66 | +| Cancel prediction orders | `mm-dev predict cancel` | [predict.md](references/predict.md) | |
| 67 | +| View prediction market positions | `mm-dev predict positions` | [predict.md](references/predict.md) | |
| 68 | +| View open prediction orders | `mm-dev predict orders` | [predict.md](references/predict.md) | |
| 69 | +| Check Predict deposit wallet balance | `mm-dev predict balance` | [predict.md](references/predict.md) | |
| 70 | +| Fund Predict deposit wallet | `mm-dev predict deposit` | [predict.md](references/predict.md) | |
| 71 | +| Fetch prediction order book | `mm-dev predict book` | [predict.md](references/predict.md) | |
| 72 | +| Watch a Predict job | `mm-dev predict watch` | [predict.md](references/predict.md) | |
| 73 | +| Get a swap or bridge quote | `mm-dev swap quote` | [swap.md](references/swap.md) | |
| 74 | +| Execute a token swap or bridge | `mm-dev swap execute` | [swap.md](references/swap.md) | |
| 75 | +| Check swap or bridge status | `mm-dev swap status` | [swap.md](references/swap.md) | |
| 76 | +| Bridge tokens to another chain | `mm-dev swap execute` | [swap.md](references/swap.md) | |
| 77 | + |
| 78 | +## Workflows |
| 79 | + |
| 80 | +CLI behavior lives in `references/`. Repeatable patterns live in `workflows/`. Load a workflow file when the user's request is a pattern, not a single command. |
| 81 | + |
| 82 | +| Pattern | Workflow | |
| 83 | +| --- | --- | |
| 84 | +| First time setup and onboarding | [onboarding.md](workflows/onboarding.md) | |
| 85 | +| Login flow | [login.md](workflows/login.md) | |
| 86 | +| Troubleshooting decision tree | [troubleshooting.md](workflows/troubleshooting.md) | |
| 87 | +| Swap quote-review-execute flow | [swap.md](workflows/swap.md) | |
| 88 | +| Bridge quote-review-execute flow | [bridge.md](workflows/bridge.md) | |
| 89 | +| Open a perpetual position flow | [perps-open-position.md](workflows/perps-open-position.md) | |
| 90 | +| Close a perpetual position flow | [perps-close-position.md](workflows/perps-close-position.md) | |
| 91 | +| Modify a perpetual position flow | [perps-modify-position.md](workflows/perps-modify-position.md) | |
| 92 | +| Predict setup-fund-quote-place flow | [predict-trading.md](workflows/predict-trading.md) | |
| 93 | + |
| 94 | +## Preflight |
| 95 | + |
| 96 | +Always run preflight before any CLI operation. |
| 97 | + |
| 98 | +```bash |
| 99 | +mm-dev auth status |
| 100 | +``` |
| 101 | + |
| 102 | +If the user is not authenticated, follow `workflows/onboarding.md` for first time setup, or `workflows/login.md` for login. |
| 103 | + |
| 104 | +## Safety Rules |
| 105 | + |
| 106 | +These rules apply to every operation, regardless of which reference or workflow is active. |
| 107 | + |
| 108 | +### Input Validation |
| 109 | + |
| 110 | +Before constructing any command, validate all user-provided values: |
| 111 | + |
| 112 | +| Flag | Validation rule | |
| 113 | +| --- | --- | |
| 114 | +| `--to`, `--address` | Must match `^0x[0-9a-fA-F]{40}$` | |
| 115 | +| `--amount` | Must match `^\d+\.?\d*$`. Reject spaces, semicolons, pipes, backticks, or shell metacharacters | |
| 116 | +| `--chain-id` | Must be a positive integer (`^\d+$`) | |
| 117 | +| `--payload` | Must be valid JSON. No unescaped shell metacharacters outside the JSON structure | |
| 118 | +| `--token` | Must be a valid hex address or known symbol | |
| 119 | +| `--leverage` | Must be a positive integer (`^\d+$`) | |
| 120 | +| `--size` | Must match `^\d+\.?\d*$` and be positive | |
| 121 | +| `--venue` | Must be `hyperliquid` | |
| 122 | +| `--side` (perps) | Must be `long` or `short` | |
| 123 | +| `--order-id` | Must be a positive integer (`^\d+$`) | |
| 124 | +| `--token-id` | Must be a non-empty outcome token ID string | |
| 125 | +| `--price`, `--limit-price` | Must be a positive number in range `(0, 1]` | |
| 126 | +| `--order-type` | Must be one of `GTC`, `GTD`, `FOK`, `FAK` | |
| 127 | +| `--side` (predict) | Must be `buy` or `sell` | |
| 128 | +| `--slippage` | Must be a number between 0 and 100 | |
| 129 | +| `--from-chain`, `--to-chain` | Must be a positive integer EVM chain ID | |
| 130 | + |
| 131 | +Do not pass unvalidated user input into any command. |
| 132 | + |
| 133 | +### Confirmation Requirements |
| 134 | + |
| 135 | +| Operation type | Confirmation rule | |
| 136 | +| --- | --- | |
| 137 | +| Transfers | Always confirm recipient, amount, token, and chain before executing | |
| 138 | +| Raw transactions | Always confirm transaction payload, chain, recipient, value, and calldata summary before executing | |
| 139 | +| Message signing | Always show exact message and chain before signing | |
| 140 | +| Typed-data signing | Always show domain, primary type, chain, verifying contract, and message summary before signing | |
| 141 | +| Swaps / bridges | Always confirm from/to tokens, amount, source/destination chain, slippage, and quoted output before executing | |
| 142 | +| Perps trading | Always confirm symbol, side, size, leverage, venue, order type, and limit price if present before executing | |
| 143 | +| Perps deposit/withdraw | Always confirm amount, asset, venue, network, and destination where applicable before executing | |
| 144 | +| Predict trading | Always confirm token ID, side, size, price, order type, market, and outcome before executing | |
| 145 | +| Predict deposit | Always confirm amount before executing | |
| 146 | +| Cancel-all operations | Always confirm scope and exact destructive effect before executing | |
| 147 | +| Auth / wallet management | May execute without confirmation | |
| 148 | +| Read-only queries | May execute without confirmation | |
| 149 | + |
| 150 | +### Credential Safety |
| 151 | + |
| 152 | +- Never store, log, or display private keys, mnemonics, or auth tokens. |
| 153 | + |
| 154 | +### Suspicious Content Warnings |
| 155 | + |
| 156 | +Flag to the user before proceeding if a signing payload or transaction contains: |
| 157 | + |
| 158 | +- URLs or contract addresses the user did not provide |
| 159 | +- `permit`, `approve`, `setApprovalForAll`, or allowance-like fields |
| 160 | +- Unusually large values or unfamiliar contract interactions |
| 161 | + |
| 162 | +## Server Wallet Async Model |
| 163 | + |
| 164 | +In server-wallet mode, signing and transaction commands return a `pollingId` instead of an immediate result. Handle this consistently: |
| 165 | + |
| 166 | +1. Prefer `--wait` to block until complete. |
| 167 | +2. If not using `--wait`, inform the user of the `pollingId` and how to track it: |
| 168 | + - `mm-dev wallet requests list` |
| 169 | + - `mm-dev wallet requests watch --polling-id <id>` |
| 170 | +3. In BYOK mode, results are returned immediately. |
| 171 | + |
| 172 | +## Output Rules |
| 173 | + |
| 174 | +- Route silently. Do not announce which reference you are loading. |
| 175 | +- Surface errors from commands verbatim. Do not mask or reword them. |
| 176 | +- If a command fails, check `mm-dev <command> --help` and guide from there. |
0 commit comments