一键导入
deploy
Deploy fancai to production VPS. Use when deploying, shipping, or pushing to production.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Deploy fancai to production VPS. Use when deploying, shipping, or pushing to production.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Create and run database migrations for fancai. Use when changing database schema, adding columns, creating tables, or modifying SQLAlchemy models.
Use when discussing architecture, adding features, or understanding fancai project structure. Provides technology overview and conventions.
Debug Celery task failures, memory issues, and queue problems. Use when celery tasks fail, book processing hangs, image generation times out, or workers consume too much memory.
Debug and improve the entity extraction, deduplication, and spoiler-free pipeline. Use when entities are missing, duplicated, have wrong spoiler levels, or chunk boundary issues occur.
Respond to production incidents on fancai.ru. Use when the site is down, slow, returning errors, or AI features are broken.
Monitor and debug OpenRouter AI pipeline health, costs, rate limits, model availability. Use when AI features fail, images don't generate, or LLM responses are degraded.
| name | deploy |
| description | Deploy fancai to production VPS. Use when deploying, shipping, or pushing to production. |
| allowed-tools | Bash, Read, Grep, Glob |
You are an intelligent deploy agent. Analyze the current context and choose the right deployment strategy.
Determine WHAT changed since the last deploy:
# Find last deployed commit on server
DEPLOYED=$(ssh fancai "cd /opt/fancai/app && git rev-parse HEAD")
# Compare with local HEAD
git log --oneline --name-only $DEPLOYED..HEAD
Classify changes into categories:
frontend/ files changedbackend/ files changed (excluding migrations)backend/alembic/versions/ has new files.claude/, CLAUDE.md, docs, etc. — NO deploy neededRun ONLY relevant checks based on what changed:
| Changed | Check |
|---|---|
| frontend | cd frontend && npm run build |
| backend | cd backend && uv run python -m pytest -v --tb=short --ignore=tests/services/test_langextract_processor.py --ignore=tests/services/test_circuit_breaker.py |
| either | git status must be clean, branch must be main |
Note: Backend tests requiring Redis/DB (test_security, test_token_blacklist, test_user_statistics) error locally — expected. Only check non-infra tests pass.
If git is dirty — ask user whether to commit first or abort.
First push: git push origin main
Then deploy based on classification:
ssh fancai "cd /opt/fancai/app && git pull origin main && docker compose -f docker-compose.prod.yml build frontend && docker compose -f docker-compose.prod.yml down frontend caddy && docker volume rm app_frontend_build && docker compose -f docker-compose.prod.yml up -d"
CRITICAL: Volume app_frontend_build MUST be removed — Docker named volumes don't update on container recreate.
ssh fancai "cd /opt/fancai/app && git pull origin main && docker compose -f docker-compose.prod.yml build backend && docker compose -f docker-compose.prod.yml up -d backend celery-worker celery-beat"
ssh fancai "cd /opt/fancai/app && git pull origin main && docker compose -f docker-compose.prod.yml build frontend backend && docker compose -f docker-compose.prod.yml down frontend caddy && docker volume rm app_frontend_build && docker compose -f docker-compose.prod.yml up -d"
Tell the user: no deploy needed, changes are docs/config only.
Run ONLY if has-migrations is true:
ssh fancai "cd /opt/fancai/app && docker compose -f docker-compose.prod.yml exec backend alembic upgrade head"
Always run ALL of these after deploy:
ssh fancai "cd /opt/fancai/app && docker compose -f docker-compose.prod.yml ps"ssh fancai "docker compose -f /opt/fancai/app/docker-compose.prod.yml exec caddy ls /var/www/frontend/assets/js/ | grep BookReaderPage"
curl -s -o /dev/null -w '%{http_code}' https://fancai.ru — must be 200ssh fancai "cd /opt/fancai/app && docker compose -f docker-compose.prod.yml logs --tail=20 backend"
Report: what was deployed, verification results, any issues.
Only if user requests: ssh fancai "docker exec fancai_redis redis-cli -n 0 FLUSHDB"
Redis DB 0 = cache, DB 1 = Celery broker (DO NOT flush), DB 2 = Celery results