AgentSkillsCN

sharpclaw-setup

自主Solana meme币交易机器人。当用户希望进行代币交易、查看投资组合/持仓/P&L、分析代币、管理观察列表,或控制自动交易时,可使用此技能。触发词包括:买入/卖出代币、查看余额、查看持仓、分析情绪、检查“地毯式”风险、查看投资组合状态、暂停/恢复交易、管理观察列表。

SKILL.md
--- frontmatter
name: sharpclaw-setup
description: >
  Deploy and configure the SharpClaw autonomous Solana meme-coin trading bot from scratch.
  Use this skill when the user wants to install, set up, deploy, configure, or update SharpClaw.
  Triggers: "set up sharpclaw", "install sharpclaw", "deploy trading bot", "configure sharpclaw",
  "update sharpclaw", "reinstall sharpclaw".
user-invocable: true
metadata:
  openclaw:
    emoji: "\U0001F527"
    requires:
      bins:
        - git

SharpClaw Setup

You are deploying SharpClaw, an autonomous Solana meme-coin trading bot. Follow these steps carefully. Ask the user for any required information you don't already have.

Step 1: Check Prerequisites

Run these checks and install anything missing:

bash
# Check for bun
which bun || (echo "Installing Bun..." && curl -fsSL https://bun.sh/install | bash && export PATH=$PATH:$HOME/.bun/bin)

# Check for git
which git || (echo "ERROR: git is required. Install it first." && exit 1)

# Verify
bun --version && git --version

Step 2: Clone or Update Repository

bash
if [ -d "$HOME/claw_trading" ]; then
  echo "SharpClaw directory exists. Updating..."
  cd $HOME/claw_trading && git pull
else
  echo "Cloning SharpClaw..."
  git clone https://github.com/anthropics/sharpclaw.git $HOME/claw_trading
  cd $HOME/claw_trading
fi

If the git clone fails (private repo or no access), ask the user for the repository URL or to provide the source files manually.

Step 3: Install Dependencies

bash
cd $HOME/claw_trading && bun install

Step 4: Configure Environment

Check if .env already exists:

bash
ls -la $HOME/claw_trading/.env 2>/dev/null

If .env does NOT exist, ask the user for the following values and create the file. Mark which ones are required vs optional:

REQUIRED - the bot cannot start without these:

VariableWhat to ask the user
WALLET_PRIVATE_KEY"What is your Solana wallet private key? (Base58 encoded)"
SOLANA_RPC_URL"What is your Solana RPC URL? (e.g., from Helius, QuickNode, or Alchemy)"

OPTIONAL - enhance signal quality:

VariableWhat to ask the user
ANTHROPIC_API_KEY"Do you have an Anthropic API key for AI arbitration? (optional, press enter to skip)"
XAI_API_KEY"Do you have an xAI API key for X social sentiment? (optional, press enter to skip)"
BIRDEYE_API_KEY"Do you have a Birdeye API key for OHLCV data? (optional, press enter to skip)"

OPTIONAL - notifications (Telegram push alerts):

VariableWhat to ask the user
TELEGRAM_BOT_TOKEN"Do you have a Telegram bot token for push notifications? (optional, press enter to skip)"
TELEGRAM_CHAT_ID"What is your Telegram chat ID? (only needed if you set a bot token)"

OPTIONAL - trading parameters (defaults are sensible):

VariableDefaultDescription
MAX_POSITION_SIZE_SOL0.5Max SOL per trade
MAX_TOTAL_EXPOSURE_PCT20Max % of wallet in positions
MAX_DAILY_LOSS_PCT5Daily loss limit
MAX_SLIPPAGE_BPS500Max slippage in basis points

Ask the user: "Do you want to customize trading parameters, or use the defaults? (defaults: max 0.5 SOL per trade, 20% max exposure, 5% daily loss limit)"

Write the .env file:

bash
cat > $HOME/claw_trading/.env << 'ENVEOF'
WALLET_PRIVATE_KEY=<value>
SOLANA_RPC_URL=<value>
ANTHROPIC_API_KEY=<value or empty>
XAI_API_KEY=<value or empty>
BIRDEYE_API_KEY=<value or empty>
TELEGRAM_BOT_TOKEN=<value or empty>
TELEGRAM_CHAT_ID=<value or empty>
MAX_POSITION_SIZE_SOL=<value or 0.5>
MAX_TOTAL_EXPOSURE_PCT=<value or 20>
MAX_DAILY_LOSS_PCT=<value or 5>
MAX_SLIPPAGE_BPS=<value or 500>
ENVEOF
chmod 600 $HOME/claw_trading/.env

If .env already exists, ask: "A .env file already exists. Do you want to keep it or reconfigure?"

Step 5: Create systemd Service

bash
cat > /etc/systemd/system/claw-trading.service << 'EOF'
[Unit]
Description=SharpClaw Trading Bot
After=network.target

[Service]
Type=simple
User=root
WorkingDirectory=/root/claw_trading
ExecStart=/root/.bun/bin/bun run src/index.ts
Restart=always
RestartSec=10
Environment=NODE_ENV=production

[Install]
WantedBy=multi-user.target
EOF

systemctl daemon-reload
systemctl enable claw-trading

If bun is installed elsewhere, find it first:

bash
BUNPATH=$(which bun)
sed -i "s|/root/.bun/bin/bun|$BUNPATH|g" /etc/systemd/system/claw-trading.service

Step 6: Start the Bot

bash
systemctl start claw-trading
sleep 3
systemctl status claw-trading --no-pager

Check the logs for any startup errors:

bash
journalctl -u claw-trading --no-pager -n 20

Expected healthy output includes:

  • "Database initialized"
  • "Starting position monitor"
  • "Starting Raydium pool monitor"
  • "All systems online"

If you see errors, diagnose and fix before continuing.

Step 7: Verify

Run these checks and report results to the user:

bash
# Check service is running
systemctl is-active claw-trading

# Check wallet balance
journalctl -u claw-trading --no-pager -n 5 | grep -i balance

Tell the user:

  1. Whether the bot started successfully
  2. Their wallet address (visible in logs)
  3. Their current SOL balance
  4. Remind them to fund the wallet with SOL before auto-trading will execute

Step 8: Install the SharpClaw Control Skill

Copy the control skill into the OpenClaw skills directory so you can interact with SharpClaw going forward:

bash
# Copy to OpenClaw managed skills
mkdir -p ~/.openclaw/workspace/skills/sharpclaw
cp $HOME/claw_trading/skills/sharpclaw/SKILL.md ~/.openclaw/workspace/skills/sharpclaw/SKILL.md
echo "SharpClaw control skill installed"

Tell the user: "SharpClaw is deployed! You can now say things like 'check my balance', 'analyze token XYZ', or 'buy 0.1 SOL of token ABC' and I'll handle it through SharpClaw."

Updating SharpClaw

If the user asks to update (not fresh install):

bash
cd $HOME/claw_trading
git pull
bun install
systemctl restart claw-trading
sleep 3
systemctl status claw-trading --no-pager

Troubleshooting

Bot won't start:

bash
journalctl -u claw-trading --no-pager -n 50

Common issues: missing env vars, wrong RPC URL, invalid wallet key.

"Very low SOL balance" warning:

  • This is expected on first setup. The wallet needs SOL funding before trading.
  • Tell the user their wallet address so they can send SOL to it.

Security Notes

  • The .env file contains sensitive credentials. It's set to chmod 600 (owner-only read).
  • NEVER display the full WALLET_PRIVATE_KEY back to the user after setup.
  • NEVER commit .env to git.
  • The wallet private key gives full control of the wallet. Advise the user to use a dedicated trading wallet, not their main wallet.