Refactor high-complexity React components in Dify frontend. Use when `pnpm analyze-component...
npx skills add kemeny/railway-moltbot
Or install specific skill: npx add-skill https://github.com/kemeny/railway-moltbot
# Description
Deploy Moltbot to Railway with Telegram integration. Use when user wants to set up moltbot, deploy moltbot to railway, create a remote moltbot instance, or run an AI assistant on Railway with Telegram. Handles complete setup from scratch including credential collection, GitHub repo creation, Railway deployment, and Telegram bot configuration.
# SKILL.md
name: railway-moltbot
description: Deploy Moltbot to Railway with Telegram integration. Use when user wants to set up moltbot, deploy moltbot to railway, create a remote moltbot instance, or run an AI assistant on Railway with Telegram. Handles complete setup from scratch including credential collection, GitHub repo creation, Railway deployment, and Telegram bot configuration.
Railway Moltbot Deployment
Deploy a fully functional Moltbot instance to Railway with Telegram integration. Works from a blank slate.
Step 1: Collect Credentials
Use AskUserQuestion to gather all required credentials. Ask for all three at once:
Question to ask:
"To deploy Moltbot to Railway, I need three things. Please provide them (or tell me which ones you need help creating):
- Railway Account Token - From https://railway.com/account/tokens
- Anthropic API Key - From https://console.anthropic.com/settings/keys
- Telegram Bot Token - From @BotFather on Telegram
Do you have all three ready?"
If user needs help creating any credential:
Railway Token
- Go to https://railway.com (create account if needed)
- Navigate to https://railway.com/account/tokens
- Click "Create Token"
- Name it (e.g., "moltbot-deploy")
- Copy the token immediately (only shown once)
- IMPORTANT: Must be an Account Token, NOT a Project Token
Anthropic API Key
- Go to https://console.anthropic.com (create account if needed)
- Navigate to Settings → API Keys
- Click "Create Key"
- Copy the key (starts with
sk-ant-)
Telegram Bot Token
- Open Telegram and search for @BotFather
- Send
/newbot - Choose a name (e.g., "My Moltbot")
- Choose a username (must end in
bot, e.g.,MyMoltbot_bot) - Copy the token (looks like
123456789:ABCdefGHI...)
Once user provides all three, store them in variables:
RAILWAY_TOKEN="<user provided>"
ANTHROPIC_API_KEY="<user provided>"
TELEGRAM_BOT_TOKEN="<user provided>"
Step 2: Verify Credentials
Test each credential before proceeding:
Test Railway Token
curl -s -X POST "https://backboard.railway.app/graphql/v2" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $RAILWAY_TOKEN" \
-d '{"query": "{ me { email } }"}'
Expected: {"data":{"me":{"email":"..."}}}
If error: Token is invalid or is a Project Token (needs Account Token)
Test Anthropic API Key
curl -s "https://api.anthropic.com/v1/messages" \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{"model":"claude-sonnet-4-20250514","max_tokens":1,"messages":[{"role":"user","content":"hi"}]}'
Expected: Response with content (or rate limit error - both mean key is valid)
If "invalid api key": Key is wrong
Test Telegram Bot Token
curl -s "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/getMe"
Expected: {"ok":true,"result":{"username":"..."}}
If error: Token is invalid
If any credential fails, ask user to provide correct one before continuing.
Step 3: Check Prerequisites
Verify GitHub CLI
gh auth status
If not authenticated: Tell user to run gh auth login first.
Get GitHub Username
gh api user --jq '.login'
Store as GITHUB_USERNAME.
Ask for Project Name
Ask user: "What would you like to name this project? (lowercase, no spaces, e.g., 'my-moltbot')"
Store as PROJECT_NAME.
Step 4: Create Project Files
Create a new directory and files:
mkdir -p ~/$PROJECT_NAME && cd ~/$PROJECT_NAME
Create Dockerfile
Copy from assets/Dockerfile to the project directory.
Create moltbot.json
Copy from assets/moltbot.json to the project directory.
Step 5: Create GitHub Repository
cd ~/$PROJECT_NAME
git init
git add Dockerfile moltbot.json
git commit -m "Initial moltbot deployment"
gh repo create $PROJECT_NAME --private --source=. --push
Step 6: Deploy to Railway
The Railway CLI has token auth issues - use GraphQL API directly.
6.1 Get Workspace ID
curl -s -X POST "https://backboard.railway.app/graphql/v2" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $RAILWAY_TOKEN" \
-d '{"query": "{ me { workspaces { id name } } }"}'
Extract and store WORKSPACE_ID from first workspace.
6.2 Create Project
curl -s -X POST "https://backboard.railway.app/graphql/v2" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $RAILWAY_TOKEN" \
-d "{\"query\": \"mutation { projectCreate(input: { name: \\\"$PROJECT_NAME\\\", teamId: \\\"$WORKSPACE_ID\\\" }) { id environments { edges { node { id name } } } } }\"}"
Extract PROJECT_ID and ENVIRONMENT_ID from response.
6.3 Create Service
curl -s -X POST "https://backboard.railway.app/graphql/v2" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $RAILWAY_TOKEN" \
-d "{\"query\": \"mutation { serviceCreate(input: { projectId: \\\"$PROJECT_ID\\\", name: \\\"moltbot\\\" }) { id } }\"}"
Extract SERVICE_ID.
6.4 Add Environment Variables
# ANTHROPIC_API_KEY
curl -s -X POST "https://backboard.railway.app/graphql/v2" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $RAILWAY_TOKEN" \
-d "{\"query\": \"mutation { variableUpsert(input: { projectId: \\\"$PROJECT_ID\\\", environmentId: \\\"$ENVIRONMENT_ID\\\", serviceId: \\\"$SERVICE_ID\\\", name: \\\"ANTHROPIC_API_KEY\\\", value: \\\"$ANTHROPIC_API_KEY\\\" }) }\"}"
# TELEGRAM_BOT_TOKEN
curl -s -X POST "https://backboard.railway.app/graphql/v2" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $RAILWAY_TOKEN" \
-d "{\"query\": \"mutation { variableUpsert(input: { projectId: \\\"$PROJECT_ID\\\", environmentId: \\\"$ENVIRONMENT_ID\\\", serviceId: \\\"$SERVICE_ID\\\", name: \\\"TELEGRAM_BOT_TOKEN\\\", value: \\\"$TELEGRAM_BOT_TOKEN\\\" }) }\"}"
6.5 Connect GitHub Repository
curl -s -X POST "https://backboard.railway.app/graphql/v2" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $RAILWAY_TOKEN" \
-d "{\"query\": \"mutation { serviceConnect(id: \\\"$SERVICE_ID\\\", input: { repo: \\\"$GITHUB_USERNAME/$PROJECT_NAME\\\", branch: \\\"main\\\" }) { id } }\"}"
If "User does not have access to the repo" error:
Tell user:
1. Go to https://railway.com/account
2. Under "Connected Accounts", click GitHub → Configure
3. Grant access to the repository
4. Come back and say "done"
Then retry the serviceConnect mutation.
Step 7: Monitor Deployment
Check Status (poll every 30s until SUCCESS/FAILED)
curl -s -X POST "https://backboard.railway.app/graphql/v2" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $RAILWAY_TOKEN" \
-d "{\"query\": \"{ service(id: \\\"$SERVICE_ID\\\") { deployments(first: 1) { edges { node { id status } } } } }\"}"
Status progression: BUILDING (3-5 min) → DEPLOYING (30s) → SUCCESS
If FAILED or CRASHED: Get build/deployment logs to diagnose.
Get Build Logs (if build fails)
curl -s -X POST "https://backboard.railway.app/graphql/v2" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $RAILWAY_TOKEN" \
-d "{\"query\": \"{ buildLogs(deploymentId: \\\"$DEPLOYMENT_ID\\\", limit: 100) { message } }\"}"
Get Runtime Logs
curl -s -X POST "https://backboard.railway.app/graphql/v2" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $RAILWAY_TOKEN" \
-d "{\"query\": \"{ deploymentLogs(deploymentId: \\\"$DEPLOYMENT_ID\\\", limit: 50) { message } }\"}"
Step 8: Verify Success
Check logs for these indicators:
- [gateway] listening on ws://127.0.0.1:18789 ✅
- [telegram] starting provider (@BOT_USERNAME) ✅
- [gateway] agent model: anthropic/claude-sonnet-4-20250514 ✅
Step 9: Final Message
Once successful, tell user:
🎉 Moltbot deployed successfully!
Your Telegram Bot: @BOT_USERNAME
Railway Dashboard: https://railway.com
To test: Open Telegram, search for @BOT_USERNAME, and send a message!
Project location: ~/$PROJECT_NAME
Troubleshooting
| Error | Solution |
|---|---|
| Railway "Unauthorized" | Token is Project Token, need Account Token from railway.com/account/tokens |
| "Unknown model" | Model name must be anthropic/claude-sonnet-4-20250514 (full name) |
| "Gateway auth token not configured" | moltbot.json needs gateway.auth.token set |
| "User does not have access to repo" | Connect GitHub at railway.com/account |
| Telegram "getUpdates conflict" | Another bot instance using same token - stop the other deployment |
| Build fails on npm install | Skill's Dockerfile builds from source with pnpm (should not happen) |
# README.md
Railway Moltbot Skill
Deploy Moltbot to Railway with Telegram integration in one shot.
Installation
npx skills add kemeny/railway-moltbot
Or for Claude Code:
/install kemeny/railway-moltbot
What This Skill Does
This skill guides Claude through deploying a fully functional Moltbot instance:
- Collects credentials - Railway token, Anthropic API key, Telegram bot token
- Verifies credentials - Tests each one before proceeding
- Creates project files - Dockerfile and moltbot.json with correct configuration
- Creates GitHub repo - Private repo for the deployment
- Deploys to Railway - Via GraphQL API (CLI has auth issues)
- Monitors deployment - Polls until SUCCESS
- Verifies bot is running - Checks logs for success indicators
Requirements
- Railway account (railway.com)
- Anthropic API key (console.anthropic.com)
- Telegram bot token (@BotFather)
- GitHub CLI authenticated (
gh auth login)
Key Learnings Baked In
This skill encodes solutions to common deployment issues:
| Issue | Solution |
|---|---|
| Railway CLI token auth fails | Uses GraphQL API directly |
| npm moltbot package broken | Builds from source with pnpm |
| Node 22 too old for moltbot | Uses Node 24 |
| Wrong model name format | Uses anthropic/claude-sonnet-4-20250514 |
Config dir .clawdbot outdated |
Uses .moltbot |
gateway.auth.mode: "none" invalid |
Sets gateway.auth.token |
| Telegram "not enabled" | Sets enabled: true + dmPolicy: open |
License
MIT
# Supported AI Coding Agents
This skill is compatible with the SKILL.md standard and works with all major AI coding agents:
Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.