This connects Claude to your Crypto.com account for live trading and balance checks. It handles the full flow: quote a trade (buy, sell, or swap), get a countdown timer, confirm within 15 seconds. Ships with TypeScript scripts that sign requests with HMAC, so you never touch curl or raw API calls. Supports 200+ tokens across fiat and crypto wallets, plus deposit/withdrawal management. The two-step quote-confirm pattern is mandatory for trades, though you can toggle off the confirmation prompt if you trust the bot to execute immediately. Needs CDC_API_KEY and CDC_API_SECRET set as environment variables before it works.
npx -y skills add crypto-com/crypto-agent-trading --skill crypto-com-app --agent claude-codeInstalls into .claude/skills of the current project.
This skill requires your agent platform to support the following capabilities. If your platform lacks any required capability, the skill will not function.
| Capability | Required | Details |
|---|---|---|
| Shell command execution | Yes | Must be able to run npx tsx ./scripts/... and capture stdout |
| Environment variables | Yes | Must read CDC_API_KEY and CDC_API_SECRET from the shell environment |
| JSON parsing | Yes | Must parse structured JSON from script stdout to extract fields |
| Multi-turn conversation | Yes | Trading uses a quote → confirm flow that spans multiple user turns |
| Persistent memory | No | Used for confirmation_required preference. If unsupported, default to always confirming trades |
| Elapsed-time awareness | No | Used to check quote expiry (countdown field). If unsupported, always attempt confirmation and handle invalid_quotation errors gracefully |
You MUST use the TypeScript scripts for ALL API interactions. NEVER call the API directly with curl, fetch, or any other HTTP method.
The scripts handle request signing, error handling, and response formatting. If you bypass them:
For every user request, find the matching command below and run it via npx tsx. Read the JSON output. Act on it.
https://wapi.crypto.com{{env.CDC_API_KEY}}{{env.CDC_API_SECRET}}{{memory.confirmation_required}} (Default: true)SKILL.md file. Resolve it from the path you loaded this file from (e.g. if you read /home/user/skills/crypto-com-app/SKILL.md, then SKILL_DIR is /home/user/skills/crypto-com-app).Both CDC_API_KEY and CDC_API_SECRET must be set as environment variables before use.
Before running any script, check whether both variables are set by running:
echo "CDC_API_KEY=${CDC_API_KEY:+set}" "CDC_API_SECRET=${CDC_API_SECRET:+set}"
If either prints empty instead of set, prompt the user:
"Your API credentials are not configured. Please set them in your terminal before I can proceed:
export CDC_API_KEY="your-api-key" export CDC_API_SECRET="your-api-secret"You can generate an API key at https://help.crypto.com/en/articles/13843786-api-key-management. Let me know once you've set them."
Then stop and wait for the user to confirm before retrying.
If a script returns a MISSING_ENV error, treat it the same way: prompt the user to set the variables and wait.
ALL API interactions MUST go through these scripts. They handle signing, execution, filtering, and error formatting. Run the appropriate command below via shell, then parse the JSON output.
Prerequisite: npx tsx (Node.js 18+ required; tsx is fetched automatically by npx).
Important: All script paths below use $SKILL_DIR as a placeholder for this skill's root directory. Resolve it from the path you loaded this SKILL.md from, or cd into the skill directory and use ./scripts/... as the path. Either approach works.
# Filtered non-zero balances (scope: fiat | crypto | all)
npx tsx $SKILL_DIR/scripts/account.ts balances [fiat|crypto|all]
# Single token balance lookup
npx tsx $SKILL_DIR/scripts/account.ts balance <SYMBOL>
# Weekly trading limit
npx tsx $SKILL_DIR/scripts/account.ts trading-limit
# Find funded source wallets for a trade type
npx tsx $SKILL_DIR/scripts/account.ts resolve-source <purchase|sale|exchange>
# Kill switch — revoke API key
npx tsx $SKILL_DIR/scripts/account.ts revoke-key
Trading follows a two-step flow: get a quotation first, then confirm the order.
# Step 1 — Get quotation (type: purchase | sale | exchange)
npx tsx $SKILL_DIR/scripts/trade.ts quote <type> '<json-params>'
# Returns: {"ok": true, "data": {"id": "<quotation-id>", "from_amount": {...}, "to_amount": {...}, "countdown": 15, ...}}
# Step 2 — Confirm order: pass the data.id from Step 1 as <quotation-id>
npx tsx $SKILL_DIR/scripts/trade.ts confirm <type> <quotation-id>
# View recent transactions
npx tsx $SKILL_DIR/scripts/trade.ts history
How to map user intent to trade type:
| User says | Trade type | From | To |
|---|---|---|---|
| "Buy CRO with 100 USD" | purchase | USD (fiat) | CRO (crypto) |
| "Sell 0.1 BTC" | sale | BTC (crypto) | USD (fiat) |
| "Swap 0.1 BTC to ETH" | exchange | BTC (crypto) | ETH (crypto) |
Quotation JSON params by trade type:
| Type | JSON fields |
|---|---|
| purchase | {"from_currency":"USD","to_currency":"CRO","from_amount":"100"} or use to_amount instead |
| sale | {"from_currency":"BTC","to_currency":"USD","from_amount":"0.1","fixed_side":"from"} |
| exchange | {"from_currency":"BTC","to_currency":"ETH","from_amount":"0.1","side":"buy"} |
Example — "Buy CRO with 100 USD":
npx tsx $SKILL_DIR/scripts/trade.ts quote purchase '{"from_currency":"USD","to_currency":"CRO","from_amount":"100"}'data.id, data.from_amount, data.to_amount, data.countdown from the response.npx tsx $SKILL_DIR/scripts/trade.ts confirm purchase <data.id>memory.confirmation_required is false): Skip asking and immediately run npx tsx $SKILL_DIR/scripts/trade.ts confirm purchase <data.id>Opt-in / Opt-out: Users can say "stop asking for confirmation" to auto-execute trades, or "require confirmation" to re-enable the prompt. See Section 3 below.
# Search coins
npx tsx $SKILL_DIR/scripts/coins.ts search '{"keyword":"BTC","sort_by":"rank","sort_direction":"asc","native_currency":"USD","page_size":10}'
Required JSON parameters:
| Parameter | Type | Allowed values |
|---|---|---|
sort_by | string | rank, market_cap, alphabetical, volume, performance |
sort_direction | string | asc, desc |
native_currency | string | Uppercase currency code (e.g. USD) |
keyword | string | Search string, 1–100 chars; matches coin name and symbol only |
page_size | integer | Number of results per page |
Optional: page_token — opaque token for fetching the next page (see pagination below).
Pagination: The response includes a pagination object with has_more (boolean) and next_page_token (string). When has_more is true, pass next_page_token as page_token in the next request to fetch the next page.
Key response fields per coin: rails_id (identical to currency_id / currency in trade and account APIs — use this to cross-reference), price_native, price_usd, percent_change_*_native (price performance over past timeframes, e.g. percent_change_24h_native).
Cash commands handle deposits, withdrawals, and bank account management.
# Cash overview — balances + available payment networks per currency
npx tsx $SKILL_DIR/scripts/fiat.ts discover
# Payment networks for a currency
npx tsx $SKILL_DIR/scripts/fiat.ts payment-networks <CURRENCY>
# Deposit method details (bank routing info)
npx tsx $SKILL_DIR/scripts/fiat.ts deposit-methods <CURRENCY> <DEPOSIT_METHOD>
# Email deposit instructions to user
npx tsx $SKILL_DIR/scripts/fiat.ts email-deposit-info <CURRENCY> <VIBAN_TYPE>
# Withdrawal details (quotas, fees, minimums)
npx tsx $SKILL_DIR/scripts/fiat.ts withdrawal-details <CURRENCY> <VIBAN_TYPE>
# Create withdrawal order (returns order with fees + receivable amount)
npx tsx $SKILL_DIR/scripts/fiat.ts create-withdrawal-order '<json-params>'
# Execute withdrawal (may prompt for TOTP authenticator code)
npx tsx $SKILL_DIR/scripts/fiat.ts create-withdrawal <ORDER_ID>
# List linked bank accounts
npx tsx $SKILL_DIR/scripts/fiat.ts bank-accounts [CURRENCY]
Key parameters:
| Parameter | Description | Example values |
|---|---|---|
CURRENCY | Uppercase currency code | USD, EUR, GBP, AUD |
DEPOSIT_METHOD | Network ID from payment-networks | us_ach, sepa, uk_fps |
VIBAN_TYPE | Same as deposit method / withdrawal network | us_ach, sepa, uk_fps |
Withdrawal order JSON params:
| Field | Required | Description |
|---|---|---|
currency | Yes | Currency code (e.g. "USD") |
amount | Yes | Amount as string (e.g. "500.00") |
viban_type | Yes | Payment network (e.g. "us_ach") |
bank_account_id | No | Specific bank account ID |
Example — "How do I deposit USD?":
npx tsx $SKILL_DIR/scripts/fiat.ts payment-networks USDdata array — each entry has deposit_push_payment_networks (e.g. ["us_ach", "us_wire_transfer"])npx tsx $SKILL_DIR/scripts/fiat.ts deposit-methods USD us_achdata array — contains bank_details with routing number, account number, etc.Example — "Withdraw 500 USD via ACH":
npx tsx $SKILL_DIR/scripts/fiat.ts withdrawal-details USD us_ach — check quotas and feesnpx tsx $SKILL_DIR/scripts/fiat.ts create-withdrawal-order '{"currency":"USD","amount":"500","viban_type":"us_ach"}'data.id (order ID), data.fee, data.receivable_amount from responsenpx tsx $SKILL_DIR/scripts/fiat.ts create-withdrawal <order-id>Every script prints structured JSON to stdout:
Success:
{"ok": true, "data": { ... }}
Error:
{"ok": false, "error": "ERROR_CODE", "error_message": "Human-readable message"}
ok: true in the script output.countdown field in the quotation data.RATE_LIMITED error): wait 60 seconds before retrying the same request. Inform the user: "Rate limit reached — please wait 60 seconds before trying again."All scripts return structured errors. Parse the error field to determine the appropriate response.
These are the error values in the script's JSON output. They tell you what category of failure occurred.
| Error Code | Meaning | Agent Response |
|---|---|---|
MISSING_ENV | CDC_API_KEY or CDC_API_SECRET not set | Tell user to set env vars via terminal |
API_ERROR | API returned non-200 or ok !== true | Report: "Transaction failed: {error_message}" |
INVALID_ARGS | Bad command-line arguments | Show correct usage from the error_message |
QUOTATION_FAILED | Quotation request rejected by API | Report the error_message to user (see API errors below) |
EXECUTION_FAILED | Order confirmation failed | Report and suggest: "Check order status with 'Show recent trades'" |
API_KEY_NOT_FOUND | Key already revoked or does not exist | "API key not found — it may have already been revoked." |
RATE_LIMITED | Too many requests (HTTP 429) | "Rate limit reached — please wait 60 seconds before trying again." |
UNKNOWN | Unexpected error | Report the raw error_message |
Rule: When ok is false in the output, stop the current operation and report the error to the user using the guidance above. Never proceed to the next step after a failure.
These are the specific API error codes that appear inside the error_message of QUOTATION_FAILED, EXECUTION_FAILED, or API_ERROR responses. They tell you why the API rejected the request.
error | Meaning | Recovery |
|---|---|---|
not_enough_balance | Insufficient funds | Check balances, reduce trade amount |
invalid_currency | Currency code not recognized | Verify via coin search |
invalid_quotation | Quote expired or already used | Request a new quotation |
failed_to_create_quotation | Quotation engine error | Retry shortly |
not_eligible_for_prime | Not eligible for Prime benefits | Proceed without Prime |
unauthorized | Account not approved for trading | Contact support |
restricted_feature | Feature restricted on account | Report error_message to user |
existing_currency_order_error | An existing order is in progress | Wait or cancel existing order |
viban_purchase_not_enabled | Fiat-to-crypto not enabled | Account feature not available |
crypto_viban_not_enabled | Crypto-to-fiat not enabled | Account feature not available |
bank_transfer_not_enabled | Bank transfer not enabled | Account feature not available |
missing_parameter | Required parameter missing | Script bug — report it |
failed_to_create_transaction | Transaction creation failed | Retry or contact support |
key_not_active | API key revoked or expired | Generate a new API key, update env vars |
api_key_not_found | Key doesn't exist or belongs to another user | Verify correct key is set in CDC_API_KEY |
totp_required | Withdrawal needs 2FA code | Script handles automatically — prompts user for authenticator code |
withdrawal_limit_exceeded | Daily/monthly quota exceeded | Show limits via withdrawal-details, reduce amount |
invalid_bank_account | Bank account not eligible | Check bank-accounts for valid accounts with status: completed |
withdrawal_cooling_off | Recently changed withdrawal settings | Wait for cooling-off period, report error_message to user |
email_cooldown | Too many deposit info emails | Wait for cooldown period (shown in error), try again later |
For dynamic errors (limit exceeded, currency disabled, cooling-off, etc.), report the error and error_message directly to the user. For full details, see references/errors.md.
Determine the trade type first:
Then resolve the source wallet:
npx tsx $SKILL_DIR/scripts/account.ts resolve-source purchase. The script returns only funded fiat entries.npx tsx $SKILL_DIR/scripts/account.ts resolve-source sale (or exchange). The script returns only funded crypto entries.Result (from data.status):
SELECTED → auto-select data.currency.AMBIGUOUS → prompt user to choose from data.options.EMPTY → inform user "No funded wallets found" and stop."Sell All" Scenario: If user says "Sell all [TOKEN]", run npx tsx $SKILL_DIR/scripts/account.ts balance [TOKEN]. Use the data.available amount (or data.balance) as from_amount for the quotation.
When the user asks to buy, sell, or swap crypto, always follow this three-step flow:
Step A — Get Quotation: Build the JSON params from the user's request (see the "Quotation JSON params" table in Trade Commands) and run:
npx tsx $SKILL_DIR/scripts/trade.ts quote <type> '<json-params>'
Read data.id, data.from_amount, data.to_amount, and data.countdown from the response.
Step B — Ask User to Confirm:
memory.confirmation_required is true (or unset):
countdown seconds have elapsed, reject: "Transaction rejected: The quotation rate has expired. Please request a new quote."Step C — Execute Order: Run: npx tsx $SKILL_DIR/scripts/trade.ts confirm <type> <data.id> using the id from Step A.
memory.confirmation_required to false.memory.confirmation_required to true.{{memory.*}}, treat confirmation_required as always true (safest default).ok field. Success is defined ONLY as ok: true.ok is false, read error and respond per the Error Handling table above.npx tsx $SKILL_DIR/scripts/trade.ts history — display the entries from data.npx tsx $SKILL_DIR/scripts/account.ts trading-limit — display as: "📊 Weekly Trading Limit: {data.used} / {data.limit} USD (Remaining: {data.remaining} USD)".npx tsx $SKILL_DIR/scripts/account.ts balances fiat (shows all fiat balances) or npx tsx $SKILL_DIR/scripts/fiat.ts discover (shows balances + payment networks). Never use balance <SYMBOL> for fiat currencies — it queries the crypto wallet and will always return 0.npx tsx $SKILL_DIR/scripts/account.ts balance <SYMBOL>.npx tsx $SKILL_DIR/scripts/account.ts balances all to show both fiat and crypto.npx tsx $SKILL_DIR/scripts/account.ts balances fiat.npx tsx $SKILL_DIR/scripts/account.ts balances crypto.npx tsx $SKILL_DIR/scripts/account.ts balances all. Crucial: Display Fiat category first, followed by Crypto balances below.data.crypto) contain a note field ("available for trading") and a wallets array. Always clarify to the user that these amounts are what's available for trading — total holdings across all products may be higher.portfolio_allocation array — each entry has a product name and price_native (USD value). Display this as a summary of the user's asset distribution across products (e.g. Crypto Wallet, Exchange, Earn, Staking, etc.).balance <SYMBOL>) output may include a product_allocation object — keys are product names (e.g. crypto_earn, staking, supercharger, crypto_basket, airdrop_arena) and values are the token amounts held in each. Only non-zero products are included. Summarize these allocations to the user alongside the available-for-trading amount so they see the full picture of where their tokens are held.memory.confirmation_required:
npx tsx $SKILL_DIR/scripts/account.ts revoke-key.ok: true): Notify: "🛑 Kill switch activated. API key has been revoked. All trading is disabled. Generate a new API key and update your environment variables to resume."API_KEY_NOT_FOUND error: Notify: "API key not found — it may have already been revoked or does not exist."Terminology: Use "cash" (not "fiat") in user-facing messages. Say "your cash balance" not "your fiat balance".
Currency disambiguation: If the user doesn't specify a currency, run discover first.
Deposit flow:
discover to show the user their cash currencies and available networksdeposit-methods to get bank detailsemail-deposit-info to email instructions to the useremail-deposit-info is limited to 5 requests per 30 minutes. On cooldown error, inform user and show the cooldown_in_seconds value.Withdrawal flow:
bank-accounts <currency> to list eligible accounts (filter to status: "completed" only)
withdrawal-details to check quotas, fees, and minimumscreate-withdrawal-order with amount, network, and bank_account_id from step 1 — returns order with feesmemory.confirmation_required):
create-withdrawal with the order IDtotp_required, the script prompts for a 6-digit authenticator code on stderr. The agent should tell the user: "Please enter your 6-digit authenticator code when prompted." Never try to generate or bypass the TOTP.Bank accounts:
bank-accounts to list linked accounts. Filter by currency if specified.status: "completed" are eligible for withdrawals.withdrawal_payment_networks — use these as valid viban_type values.Deposit methods — vendor selection:
deposit-methods returns a vendor_list array. Each vendor has a status field.status: "created" (active). Ignore "uncreated" vendors.Cash commands quick reference:
| User says | Commands to run |
|---|---|
| "How do I deposit USD?" | payment-networks USD then deposit-methods USD <network> |
| "Email me deposit instructions" | email-deposit-info <currency> <viban_type> |
| "Show my bank accounts" | bank-accounts |
| "What are my withdrawal limits?" | withdrawal-details <currency> <viban_type> |
| "Withdraw 500 USD" | withdrawal-details -> create-withdrawal-order -> confirm -> create-withdrawal |
| "What currencies can I deposit?" | discover |
sickn33/antigravity-awesome-skills
moizibnyousaf/ai-agent-skills
github/awesome-copilot