Claude-skill-registry deploy-bot
Safe deployment of Polymarket trading bot with regression tests and active trade protection
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/deploy-bot" ~/.claude/skills/majiayu000-claude-skill-registry-deploy-bot && rm -rf "$T"
manifest:
skills/data/deploy-bot/SKILL.mdsource content
Deploy Polymarket Bot
WARNING: ALWAYS USE THIS SKILL when deploying changes. Never use manual docker commands.
Safe deployment workflow for the Polymarket arbitrage trading bot that:
- Runs regression tests to catch bugs before deployment
- Checks for active trades to prevent interrupting pending positions
Why This Matters
The bot executes real-money arbitrage trades on Polymarket. Deploying broken code or restarting during active trades can cause:
- Bugs: Untested code can break execution, tracking, or settlement
- Lost visibility: Restarting during active trades loses pending position data
- Missed resolutions: Container restart can miss market resolution events
- Financial losses: All of the above can result in real money losses
Quick Deploy
# From the polyjuiced repo root ./agents/skills/deploy-bot/deploy.sh # Skip tests only (still checks active trades) ./agents/skills/deploy-bot/deploy.sh --skip-tests # Force deploy (DANGEROUS - skips ALL safety checks) ./agents/skills/deploy-bot/deploy.sh --force
What the Script Does
-
Run Regression Tests (Step 0)
- Builds a fresh container with latest code
- Runs
to verify all tests passpytest tests/ -v - Blocks deployment if any tests fail
- Exit code 3 = tests failed
-
Check Active Trades (Step 1)
- Runs
in the containerscripts/check_active_trades.py - Queries the database for unresolved real trades
- Checks if market has resolved (safe) vs still active (danger)
- Blocks deployment if active trades exist
- Exit code 1 = active trades
- Runs
-
Deploy (Steps 2-4)
- Git push + pull to sync code
- Docker compose rebuild and restart
-
Verify (Step 5)
- Shows startup logs to confirm success
Manual Pre-Checks
Run the checks independently:
# Run regression tests locally docker compose run --rm --build polymarket-bot python3 -m pytest tests/ -v # Check active trades (requires running container) docker exec polymarket-bot python3 /app/scripts/check_active_trades.py # Exit codes: # 0 = Safe to deploy # 1 = Active trades exist (don't deploy) # 2 = Error checking # 3 = Tests failed
When to Skip Tests
Use
--skip-tests when:
- You've already run tests manually
- Making config-only changes (.env)
- Urgent fix with verified minimal change
When to Force Deploy
Only use
--force when:
- The bot is crashed/hung and needs restart
- You're certain any active trades are already lost
- Emergency security fix is needed
- User explicitly approves the risk
Trade Lifecycle
Trade Executed → status='pending' → Market Resolves → status='won'/'lost' ↑ ↓ ⚠️ DANGER ZONE Safe to deploy
Troubleshooting
"Regression tests failed"
Fix the failing tests before deploying:
docker compose run --rm --build polymarket-bot python3 -m pytest tests/ -v --tb=long
"Container may not be running"
The pre-check failed because the bot isn't running. This is safe to deploy.
Stuck in "not safe" state
If trades are stuck as pending after market resolution:
# Check database state docker exec polymarket-bot python3 -c " import asyncio import aiosqlite async def check(): async with aiosqlite.connect('/app/data/gabagool.db') as db: db.row_factory = aiosqlite.Row async with db.execute('SELECT id, asset, status, market_end_time FROM trades WHERE dry_run=0 ORDER BY created_at DESC LIMIT 5') as cur: for row in await cur.fetchall(): print(dict(row)) asyncio.run(check()) "
Related Files
- Regression test suitetests/
- Pre-deployment trade checkscripts/check_active_trades.py
- Database schemasrc/persistence.py
- Trading logicsrc/strategies/gabagool.py