Skip to content

Commit 45ed450

Browse files
graysonhycclaude
andcommitted
feat(skills): consolidate 30 skills into single zerion skill + fix init.js
Onboarding pain: 30 separate skills polluted agentskills.io picker and scattered install counts. Now one `zerion` skill at the top, with progressive disclosure via nested `capabilities/*.md` (core: analyze, trading, sign, wallet, agent-management, swap-0x) and `partners/*.md` (Bankr, Li.Fi, Moonpay, Vaults.fyi, Trails, etc.). Same total content, loaded on demand — root SKILL.md stays ~150 lines. init.js fixes: - ensureGlobalInstall now short-circuits if `zerion --version` already resolves globally, even when npx temp dir hosts the binary (was re-installing on every run when CLI was already present). - installSkills auto-detects the user's coding agent (env fingerprints + ~/.<agent> dirs for claude-code, cursor, codex, gemini) and passes `-a <agent>` to `npx skills add` so the 55-agent multi-select picker doesn't open. ~70% of users are on Claude Code — this skips the manual checkbox dance evgen flagged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 6920b4b commit 45ed450

36 files changed

Lines changed: 192 additions & 685 deletions

README.md

Lines changed: 39 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -25,37 +25,43 @@ npm install -g zerion-cli
2525

2626
Requires Node.js 20 or later.
2727

28-
## Agent skills
29-
30-
All skills live under [`./skills/`](./skills/) and follow the [agentskills.io](https://agentskills.io) open standard — a single `skills/` tree powers every supported host.
31-
32-
### Core skills (Zerion)
33-
34-
| Skill | What it does |
35-
|-------|--------------|
36-
| [`zerion`](./skills/zerion/SKILL.md) | Umbrella: install, authentication, routing to specific skills, chains reference |
37-
| [`zerion-analyze`](./skills/zerion-analyze/SKILL.md) | Portfolio, positions, history, PnL, analyze, token search, watchlist (read-only; supports x402 / MPP) |
38-
| [`zerion-trading`](./skills/zerion-trading/SKILL.md) | Swap, bridge, send tokens (on-chain actions; needs API key + agent token) |
39-
| [`zerion-sign`](./skills/zerion-sign/SKILL.md) | Off-chain signing — sign-message (EIP-191 / raw), sign-typed-data (EIP-712) |
40-
| [`zerion-wallet`](./skills/zerion-wallet/SKILL.md) | Wallet management — create, import, list, fund, backup, delete, sync |
41-
| [`zerion-agent-management`](./skills/zerion-agent-management/SKILL.md) | Agent tokens + policies (the autonomous-trading primitives) |
42-
43-
### Partner skills
44-
45-
Skills contributed by ecosystem partners that combine their product with the Zerion CLI. See [`zerion-partner-skill-creator`](./skills/zerion-partner-skill-creator/SKILL.md) to contribute one.
46-
47-
| Skill | What it does | Partner |
48-
|-------|--------------|---------|
49-
| [`zerion-monad-addresses`](./skills/zerion-monad-addresses/SKILL.md) | Canonical Monad mainnet contract addresses for `zerion agent create-policy --allowlist` lockdown | [Monad](https://monad.xyz) |
50-
| [`zerion-moonpay-onramp`](./skills/zerion-moonpay-onramp/SKILL.md) | Buy crypto with card or bank transfer via MoonPay, then trade with Zerion | [MoonPay](https://moonpay.com) |
51-
| [`zerion-moonpay-iron`](./skills/zerion-moonpay-iron/SKILL.md) | USD bank-wire to Iron virtual account (IBAN/ACH) → USDC → DCA via Zerion | [MoonPay](https://moonpay.com) |
52-
| [`zerion-moonpay-predict`](./skills/zerion-moonpay-predict/SKILL.md) | Trade prediction markets (Polymarket, Kalshi) via MoonPay CLI | [MoonPay](https://moonpay.com) |
53-
| [`zerion-sendai-ideas`](./skills/zerion-sendai-ideas/SKILL.md) | Crypto idea discovery, validation, competitive landscape, DeFi TVL research | [SendAI](https://github.com/sendaifun/solana-new) (MIT) |
54-
| [`zerion-somnia-blockchain`](./skills/zerion-somnia-blockchain/SKILL.md) | Somnia L1 reference — network info, gas model, deployment guidance | [Somnia](https://somnia.network) |
55-
| [`zerion-somnia-reactivity`](./skills/zerion-somnia-reactivity/SKILL.md) | Somnia Reactivity — event-driven pub/sub, WebSocket + Solidity handlers | [Somnia](https://somnia.network) |
56-
| [`zerion-trails-crosschainswap`](./skills/zerion-trails-crosschainswap/SKILL.md) | Cross-chain swaps to/from Polygon via Trails SDK (Widget / Headless / API) | [Trails](https://docs.trails.build) |
57-
| [`zerion-trails-deposit`](./skills/zerion-trails-deposit/SKILL.md) | Bridge + DeFi vault deposit on Polygon in one intent (Aave, Morpho, ERC-4626) | [Trails](https://docs.trails.build) |
58-
| [`zerion-0x`](./skills/zerion-0x/SKILL.md) | Token swaps via 0x API v2 — AllowanceHolder, Permit2, and Gasless flows across 20+ EVM chains | [0x](https://0x.org) |
28+
## Agent skill
29+
30+
One skill, [`zerion`](./skills/zerion/SKILL.md), under [`./skills/zerion/`](./skills/zerion/) — follows the [agentskills.io](https://agentskills.io) open standard. All capabilities and partner integrations live as nested files that load on demand (progressive disclosure), so a single install + single picker entry exposes everything below.
31+
32+
### Capabilities (`skills/zerion/capabilities/`)
33+
34+
| File | What it covers |
35+
|------|----------------|
36+
| [`analyze.md`](./skills/zerion/capabilities/analyze.md) | Portfolio, positions, history, PnL, token search, watchlist (read-only; supports x402 / MPP) |
37+
| [`trading.md`](./skills/zerion/capabilities/trading.md) | Swap, bridge, send tokens (on-chain actions; needs API key + agent token) |
38+
| [`sign.md`](./skills/zerion/capabilities/sign.md) | Off-chain signing — sign-message (EIP-191 / raw), sign-typed-data (EIP-712) |
39+
| [`wallet.md`](./skills/zerion/capabilities/wallet.md) | Wallet management — create, import, list, fund, backup, delete, sync |
40+
| [`agent-management.md`](./skills/zerion/capabilities/agent-management.md) | Agent tokens + policies (the autonomous-trading primitives) |
41+
| [`swap-0x.md`](./skills/zerion/capabilities/swap-0x.md) | Token swaps via 0x API v2 — AllowanceHolder, Permit2, and Gasless flows across 20+ EVM chains |
42+
43+
### Partner integrations (`skills/zerion/partners/`)
44+
45+
Ecosystem partners that combine their product with the Zerion CLI. See [`partner-skill-creator.md`](./skills/zerion/partner-skill-creator.md) to contribute one. Loaded only when the user names the partner.
46+
47+
| File | What it covers | Partner |
48+
|------|----------------|---------|
49+
| [`bankr.md`](./skills/zerion/partners/bankr.md) | Twitter/X-native trading bot patterns | [Bankr](https://bankr.bot) |
50+
| [`lifi-earn.md`](./skills/zerion/partners/lifi-earn.md) | Cross-chain yield routing | [Li.Fi](https://li.fi) |
51+
| [`monad-addresses.md`](./skills/zerion/partners/monad-addresses.md) | Canonical Monad mainnet contract addresses for `zerion agent create-policy --allowlist` lockdown | [Monad](https://monad.xyz) |
52+
| [`moonpay-onramp.md`](./skills/zerion/partners/moonpay-onramp.md) | Buy crypto with card or bank transfer via MoonPay, then trade with Zerion | [MoonPay](https://moonpay.com) |
53+
| [`moonpay-iron.md`](./skills/zerion/partners/moonpay-iron.md) | USD bank-wire to Iron virtual account (IBAN/ACH) → USDC → DCA via Zerion | [MoonPay](https://moonpay.com) |
54+
| [`moonpay-predict.md`](./skills/zerion/partners/moonpay-predict.md) | Trade prediction markets (Polymarket, Kalshi) via MoonPay CLI | [MoonPay](https://moonpay.com) |
55+
| [`sendai-ideas.md`](./skills/zerion/partners/sendai-ideas.md) | Crypto idea discovery, validation, competitive landscape, DeFi TVL research | [SendAI](https://github.com/sendaifun/solana-new) (MIT) |
56+
| [`somnia-blockchain.md`](./skills/zerion/partners/somnia-blockchain.md) | Somnia L1 reference — network info, gas model, deployment guidance | [Somnia](https://somnia.network) |
57+
| [`somnia-reactivity.md`](./skills/zerion/partners/somnia-reactivity.md) | Somnia Reactivity — event-driven pub/sub, WebSocket + Solidity handlers | [Somnia](https://somnia.network) |
58+
| [`trails-crosschainswap.md`](./skills/zerion/partners/trails-crosschainswap.md) | Cross-chain swaps to/from Polygon via Trails SDK (Widget / Headless / API) | [Trails](https://docs.trails.build) |
59+
| [`trails-deposit.md`](./skills/zerion/partners/trails-deposit.md) | Bridge + DeFi vault deposit on Polygon in one intent (Aave, Morpho, ERC-4626) | [Trails](https://docs.trails.build) |
60+
| [`umbra-privatetxn.md`](./skills/zerion/partners/umbra-privatetxn.md) | Private (stealth-address) transfers | [Umbra](https://umbra.cash) |
61+
| [`uniswap-lp.md`](./skills/zerion/partners/uniswap-lp.md) | Liquidity position management | [Uniswap](https://uniswap.org) |
62+
| [`uniswap-x402.md`](./skills/zerion/partners/uniswap-x402.md) | Swap with x402 pay-per-call | [Uniswap](https://uniswap.org) |
63+
| [`vaultsfyi-*.md`](./skills/zerion/partners/) | Deposit, market intel, rebalance, risk monitor, strategist, watchlist, yield optimizer | [Vaults.fyi](https://vaults.fyi) |
64+
| [`consolidate.md`](./skills/zerion/partners/consolidate.md) | Sweep all tokens on a chain into one target | Zerion |
5965

6066
### Install via zerion CLI (recommended)
6167

@@ -126,13 +132,13 @@ After install, ask the agent in natural language.
126132

127133
> Sign the EIP-712 message in `typed.json` using my `bot-1` wallet.
128134
129-
The agent reaches for the right skill (e.g. `zerion-analyze` for "what's in this wallet", `zerion-trading` for swap/bridge/send) and invokes the underlying `zerion` CLI commands. Skills load only when relevant — agentskills.io's progressive disclosure keeps your context window clean. Multiple skills compose at runtime: a "create wallet, set up agent token, then swap" flow loads `zerion-wallet``zerion-agent-management``zerion-trading` in sequence.
135+
The agent reaches for the `zerion` skill, which routes by task to the right nested file under `capabilities/` or `partners/`. Progressive disclosure means only the matching capability doc loads — context stays clean. A "create wallet, set up agent token, then swap" flow Reads `capabilities/wallet.md``capabilities/agent-management.md``capabilities/trading.md` in sequence.
130136

131137
## Manual setup, agent execution
132138

133139
Zerion CLI splits into two surfaces, by design.
134140

135-
- **Wallet management and agent token setup are manual.** `wallet create`, `import`, `backup`, and `delete` all prompt for a passphrase. `wallet sync` emits a QR code you scan with the Zerion app. `agent create-token` mints a scoped trading credential bound to a specific wallet, and `agent create-policy` attaches the rules it has to obey — allowed chains, expiry, transfer/approval gates, contract allowlists. The sibling admin commands (`agent list-tokens`, `use-token`, `revoke-token`, `list-policies`, `show-policy`, `delete-policy`) are also gestures you make yourself. No key material moves and no spending credential widens without you in the loop. For CI and headless servers, `agent create-token` accepts `--passphrase-file <path>` (file must be mode `0600`) so token issuance can be scripted without an interactive TTY — see the `zerion-agent-management` skill.
141+
- **Wallet management and agent token setup are manual.** `wallet create`, `import`, `backup`, and `delete` all prompt for a passphrase. `wallet sync` emits a QR code you scan with the Zerion app. `agent create-token` mints a scoped trading credential bound to a specific wallet, and `agent create-policy` attaches the rules it has to obey — allowed chains, expiry, transfer/approval gates, contract allowlists. The sibling admin commands (`agent list-tokens`, `use-token`, `revoke-token`, `list-policies`, `show-policy`, `delete-policy`) are also gestures you make yourself. No key material moves and no spending credential widens without you in the loop. For CI and headless servers, `agent create-token` accepts `--passphrase-file <path>` (file must be mode `0600`) so token issuance can be scripted without an interactive TTY — see [`capabilities/agent-management.md`](./skills/zerion/capabilities/agent-management.md).
136142
- **Analysis, signing, trading, and discovery are for agents.** `analyze`, `portfolio`, `positions`, `history`, `pnl`, `sign-message`, `sign-typed-data`, `swap`, `bridge`, `send`, `swap tokens`, `search`, `chains`, `wallet list`, `wallet fund`, and `watch list` emit JSON to stdout, structured errors to stderr, and skip confirmation dialogs. Once an agent token is configured, signing and trading fire immediately — the token authorizes operations on behalf of the wallet without a passphrase prompt.
137143

138144
Setup gestures (`init`, `setup skills`, `config set/unset/list`, `watch` add/remove) are one-time configuration steps you run yourself before automation takes over.

cli/commands/init.js

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import { spawnSync } from "node:child_process";
2+
import { existsSync } from "node:fs";
3+
import { homedir } from "node:os";
4+
import { join } from "node:path";
25
import { print, printError } from "../utils/common/output.js";
36
import { readSecret } from "../utils/common/prompt.js";
47
import { getApiKey, setConfigValue } from "../utils/config.js";
@@ -35,6 +38,28 @@ function isNpxTempInvocation() {
3538
return path.includes("/_npx/") || path.includes("\\_npx\\");
3639
}
3740

41+
function hasGlobalZerion() {
42+
const res = spawnSync("zerion", ["--version"], { stdio: "ignore" });
43+
return res.status === 0;
44+
}
45+
46+
const AGENT_FINGERPRINTS = [
47+
{ name: "claude-code", env: ["CLAUDECODE", "CLAUDE_CODE"], dir: ".claude" },
48+
{ name: "cursor", env: ["CURSOR_TRACE_ID"], dir: ".cursor" },
49+
{ name: "codex", env: ["CODEX_HOME"], dir: ".codex" },
50+
{ name: "gemini", env: ["GEMINI_API_KEY"], dir: ".gemini" },
51+
];
52+
53+
function detectAgent() {
54+
for (const a of AGENT_FINGERPRINTS) {
55+
if (a.env.some((k) => process.env[k])) return a.name;
56+
}
57+
for (const a of AGENT_FINGERPRINTS) {
58+
if (existsSync(join(homedir(), a.dir))) return a.name;
59+
}
60+
return null;
61+
}
62+
3863
function openBrowser(url) {
3964
const cmd =
4065
process.platform === "darwin"
@@ -47,7 +72,10 @@ function openBrowser(url) {
4772
}
4873

4974
function ensureGlobalInstall() {
50-
if (!isNpxTempInvocation()) {
75+
// Two skip conditions:
76+
// 1. Running from a global install (not npx temp dir).
77+
// 2. Running from npx temp but `zerion` already resolves globally → don't re-install.
78+
if (!isNpxTempInvocation() || hasGlobalZerion()) {
5179
log(" ✓ CLI already installed globally");
5280
return { ok: true, skipped: true };
5381
}
@@ -103,21 +131,24 @@ function installSkills({ agent, yes }) {
103131
// can pick which Zerion skills to install. Only force non-interactive when
104132
// the caller explicitly passed --yes or stdin is not a TTY (CI / piped).
105133
const nonInteractive = yes || !process.stdin.isTTY;
134+
// Auto-pin agent if caller didn't pass one. Picker shows 55+ entries and
135+
// ~70% of users are on Claude Code — detect and skip the multi-select.
136+
const targetAgent = agent || detectAgent();
106137
const npxArgs = ["-y", "skills", "add", ZERION_AGENT_REPO, "-g"];
107138
if (nonInteractive) npxArgs.push("--yes");
108-
if (agent) npxArgs.push("-a", agent);
139+
if (targetAgent) npxArgs.push("-a", targetAgent);
109140

110141
log(
111142
nonInteractive
112-
? " Installing all Zerion skills for AI coding agents..."
113-
: " Pick which Zerion skills to install (space to toggle, enter to confirm)..."
143+
? ` Installing Zerion skills${targetAgent ? ` for ${targetAgent}` : ""}...`
144+
: ` Pick which Zerion skills to install${targetAgent ? ` (${targetAgent} pre-selected)` : ""}...`
114145
);
115146
const res = spawnSync("npx", npxArgs, { stdio: "inherit" });
116147
if (res.status !== 0) {
117148
return { ok: false, exitCode: res.status };
118149
}
119150
log(" ✓ Skills installed");
120-
return { ok: true, interactive: !nonInteractive };
151+
return { ok: true, interactive: !nonInteractive, agent: targetAgent };
121152
}
122153

123154
function printSuccessSummary() {

skills/zerion-moonpay-iron/SKILL.md

Lines changed: 0 additions & 104 deletions
This file was deleted.

skills/zerion-moonpay-onramp/SKILL.md

Lines changed: 0 additions & 92 deletions
This file was deleted.

0 commit comments

Comments
 (0)