claude-code-operator

Operate and control Claude Code CLI from within Clawdbot. Allows spawning Claude Code processes, executing commands in Claude Code, managing sessions, and deploying projects using Claude Code's capabilities.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "claude-code-operator" with this command: npx skills add stvlynn/skills/stvlynn-skills-claude-code-operator

Claude Code Operator

This skill enables controlling Claude Code CLI programmatically from Clawdbot.

Overview

Claude Code is Anthropic's agentic coding tool that operates in the terminal. This skill provides workflows for:

  1. Spawning Claude Code processes - Start Claude Code with specific configurations
  2. Executing commands - Send natural language commands to Claude Code
  3. Managing sessions - Resume, continue, or start new sessions
  4. Deploying projects - Use Claude Code's MCP tools for deployment

Prerequisites

  • Claude Code must be installed: npm install -g @anthropic-ai/claude-code
  • For Zhipu/Chinese users: Configure with GLM API key
  • MCP servers configured in ~/.claude/mcp-settings.json

Configuration

Zhipu (智谱) Configuration

Set environment variables before running Claude Code:

export ANTHROPIC_AUTH_TOKEN="your-zhipu-api-key"
export ANTHROPIC_BASE_URL="https://open.bigmodel.cn/api/anthropic"
export API_TIMEOUT_MS="3000000"

Or configure in ~/.claude/settings.json:

{
  "env": {
    "ANTHROPIC_AUTH_TOKEN": "your-api-key",
    "ANTHROPIC_BASE_URL": "https://open.bigmodel.cn/api/anthropic",
    "API_TIMEOUT_MS": "3000000"
  }
}

MCP Server Configuration

Add to ~/.claude/mcp-settings.json:

{
  "mcpServers": {
    "edgeone-pages-mcp-server": {
      "url": "https://mcp-on-edge.edgeone.app/mcp-server"
    }
  }
}

CLI Commands

Basic Commands

CommandDescription
claudeStart Claude Code in current directory
claude --versionCheck installed version
claude --continueResume last session
claude --resume <name>Resume specific session
claude -p / claude --printPrint mode (non-interactive)
claude --debugDebug mode with detailed logs

Internal Commands (within Claude Code)

CommandDescription
/mcpList available MCP servers and tools
/helpShow available commands
/contextShow context window usage
/statusCheck current model and configuration
/loginRe-authenticate
/pluginManage plugins

Workflows

Workflow 1: Deploy HTML to EdgeOne Pages

Method 1: Using MCP directly (recommended)

# Call deploy-html tool directly
curl -X POST https://mcp-on-edge.edgeone.app/mcp-server \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "tools/call",
    "params": {
      "name": "deploy-html",
      "arguments": {
        "value": "HTML content here"
      }
    },
    "id": 1
  }'

Method 2: Using Claude Code in print mode

# Export environment variables first
export ANTHROPIC_AUTH_TOKEN="your-api-key"
export ANTHROPIC_BASE_URL="https://open.bigmodel.cn/api/anthropic"

# Deploy using Claude Code
cd /path/to/project
echo "Deploy index.html to EdgeOne Pages" | claude -p

Method 3: Interactive mode

claude
# Then type: Deploy index.html to EdgeOne Pages

Workflow 2: Execute Code Generation Task

# Start Claude Code with specific task
cd /path/to/project
claude -p << 'EOF'
Generate a React component for a todo list with the following features:
1. Add new todos
2. Mark todos as complete
3. Delete todos
4. Filter by status
EOF

Workflow 3: Check MCP Tools Available

# List all MCP tools
curl -s -X POST https://mcp-on-edge.edgeone.app/mcp-server \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "tools/list",
    "id": 1
  }' | jq '.result.tools'

Environment Setup Script

Create a setup script for Zhipu users:

#!/bin/bash
# setup_claude_code_env.sh

echo "🚀 Setting up Claude Code environment..."

# Check if Node.js is installed
if ! command -v node &> /dev/null; then
    echo "❌ Node.js not found. Please install Node.js 18+ first."
    exit 1
fi

# Check Node version
NODE_VERSION=$(node --version | cut -d'v' -f2 | cut -d'.' -f1)
if [ "$NODE_VERSION" -lt 18 ]; then
    echo "❌ Node.js version must be 18+. Current: $(node --version)"
    exit 1
fi

echo "✅ Node.js version: $(node --version)"

# Install Claude Code if not present
if ! command -v claude &> /dev/null; then
    echo "📦 Installing Claude Code..."
    npm install -g @anthropic-ai/claude-code
else
    echo "✅ Claude Code already installed: $(claude --version)"
fi

# Create config directory
mkdir -p ~/.claude

# Configure for Zhipu
echo "🔑 Configuring for Zhipu..."
cat > ~/.claude/settings.json << 'CONFIGEOF'
{
  "env": {
    "ANTHROPIC_AUTH_TOKEN": "YOUR_ZHIPU_API_KEY_HERE",
    "ANTHROPIC_BASE_URL": "https://open.bigmodel.cn/api/anthropic",
    "API_TIMEOUT_MS": "3000000",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": 1
  }
}
CONFIGEOF

echo ""
echo "✅ Configuration template created at ~/.claude/settings.json"
echo "⚠️  Please edit the file and replace YOUR_ZHIPU_API_KEY_HERE with your actual API key"
echo ""
echo "🎉 Setup complete! Run 'claude' to start using Claude Code."

Troubleshooting

Issue 1: "Invalid bearer token" or "Invalid API key"

Cause: API key not properly configured

Solution:

# Check if env vars are set
env | grep ANTHROPIC

# Or check config file
cat ~/.claude/settings.json

# Re-run setup script
bash setup_claude_code_env.sh

Issue 2: MCP tools not found

Cause: MCP server not configured

Solution:

# Check MCP config
cat ~/.claude/mcp-settings.json

# Restart Claude Code after config changes
claude

Issue 3: Claude Code hangs or timeouts

Cause: Network issues or API rate limits

Solution:

# Increase timeout
export API_TIMEOUT_MS="3000000"

# Or run in debug mode to see detailed logs
claude --debug

Common Use Cases

Use Case 1: Quick HTML Deployment

# Create HTML file
cat > demo.html << 'EOF'
<!DOCTYPE html>
<html>
<head><title>Demo</title></head>
<body><h1>Hello from Claude Code!</h1></body>
</html>
EOF

# Deploy using curl (fastest)
curl -X POST https://mcp-on-edge.edgeone.app/mcp-server \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "tools/call",
    "params": {
      "name": "deploy-html",
      "arguments": {
        "value": "'"$(cat demo.html | sed 's/"/\\"/g')"'"
      }
    }
  }'

Use Case 2: Batch Operations

# Process multiple files
for file in *.html; do
    echo "Processing $file..."
    # Send to Claude Code for processing
    cat "$file" | claude -p << 'EOF'
    Optimize this HTML for performance and accessibility
    EOF
done

Use Case 3: CI/CD Integration

# In a CI/CD pipeline
claude -p << 'EOF'
Review the recent changes in this repository and:
1. Check for any security issues
2. Suggest performance improvements
3. Generate a summary of changes
EOF

References

Notes

  • Claude Code requires interactive authentication on first run
  • For automated/scripted usage, prefer direct MCP API calls over Claude Code CLI
  • Environment variables take precedence over config file settings
  • Use --debug flag for troubleshooting connection issues

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

create-sticker

No summary provided by upstream source.

Repository SourceNeeds Review
General

searxng

No summary provided by upstream source.

Repository SourceNeeds Review
General

tsticker

No summary provided by upstream source.

Repository SourceNeeds Review