Agent Skillsnixopus/nixopus › rollback-strategy

rollback-strategy

GitHub

提供部署失败后的回滚决策指南,涵盖重试与回滚判断、状态保留、执行验证及数据库迁移风险评估,用于快速恢复服务稳定性。

api/skills/rollback-strategy/SKILL.md nixopus/nixopus

Trigger Scenarios

部署失败 应用不可达 容器崩溃循环 用户请求回滚

Install

npx skills add nixopus/nixopus --skill rollback-strategy -g -y
More Options

Non-standard path

npx skills add https://github.com/nixopus/nixopus/tree/master/api/skills/rollback-strategy -g -y

Use without installing

npx skills use nixopus/nixopus@rollback-strategy

指定 Agent (Claude Code)

npx skills add nixopus/nixopus --skill rollback-strategy -a claude-code -g -y

安装 repo 全部 skill

npx skills add nixopus/nixopus --all -g -y

预览 repo 内 skill

npx skills add nixopus/nixopus --list

SKILL.md

Frontmatter
{
    "name": "rollback-strategy",
    "metadata": {
        "version": "1.0"
    },
    "description": "Guide rollback decisions after failed deployments — when to rollback vs retry, verification after rollback, and state preservation. Use when a deployment fails repeatedly, the app is unreachable after deploy, or the user requests a rollback."
}

Rollback Strategy

When to Rollback

Situation Action Reason
Build failed, fix is obvious (typo, missing dep) Retry with fix Faster than rollback + fix + redeploy
Build failed 3+ times Rollback Deeper issue needs investigation without production down
Container crash loop after deploy Rollback Previous version was stable; fix in development
App unreachable after deploy (port/proxy issue) Investigate first May be config issue fixable without rollback
Database migration failed Rollback with caution See migration rollback section
User explicitly requests rollback Rollback User decision takes priority

Rollback Procedure

1. Preserve state before rolling back

Before executing rollback, capture:

  • get_deployment_logs for the failed deployment — save the deployment ID and error
  • get_container_logs if the container existed — last 100 lines
  • get_application to note current env vars and config
  • Record what changed between the working version and the failed one

2. Execute rollback

  • rollback_deployment with the application ID
  • This redeploys the last successful deployment's image

3. Verify rollback succeeded

After rollback completes, run the post-deploy-verification checks:

  • Container is running and not restart-looping
  • App is reachable internally and externally
  • Healthcheck endpoint returns healthy
  • No error patterns in logs

If verification fails after rollback: the previous version may also be broken (database schema change, expired credentials, infrastructure issue). Escalate to user.

4. Report to user

Include in the rollback report:

  • What was deployed (commit/image that failed)
  • Why it failed (root cause from diagnosis)
  • What was rolled back to (previous deployment ID)
  • Current status (verified healthy or still unhealthy)
  • Recommended next steps (fix the issue, then redeploy)

Database Migration Rollback

Migrations make rollbacks risky because the database schema may have changed:

Migration type Rollback safe? Action
Additive only (new columns, new tables) Yes Old code ignores new columns
Column rename or removal No Old code references old column name
Data transformation No Transformed data may not work with old code
Index changes only Yes Old code unaffected

If the migration is not rollback-safe:

  1. Do NOT auto-rollback — notify user with the risk
  2. Suggest: fix forward (deploy a corrected version) rather than rollback
  3. If rollback is essential: include the reverse migration in the rollback

Anti-Patterns

  • Rolling back repeatedly without investigating: Each rollback buys time but doesn't fix the issue
  • Rolling back past multiple versions: Only rollback to the immediately previous successful deployment
  • Rolling back infrastructure changes: If the failure is DNS, proxy, or server-level, rollback won't help — the app code didn't change
  • Rolling back during active database migration: Can corrupt data if migration is partially applied

Related Skills

  • post-deploy-verification — Run after rollback to confirm the previous version is healthy
  • failure-diagnosis — Diagnose the root cause before deciding to rollback
  • database-migration — Safe migration strategies that reduce rollback risk

Version History

  • cf05d97 Current 2026-08-20 14:52

Same Skill Collection

api/skills/api-catalog/SKILL.md
api/skills/caddyfile-generation/SKILL.md
api/skills/compose-setup/SKILL.md
api/skills/container-resource-tuning/SKILL.md
api/skills/cpp-deploy/SKILL.md
api/skills/database-migration/SKILL.md
api/skills/deno-deploy/SKILL.md
api/skills/deploy-delegation/SKILL.md
api/skills/deploy-flow/SKILL.md
api/skills/deployment-analysis/SKILL.md
api/skills/diagnostic-workflow/SKILL.md
api/skills/dockerfile-generation/SKILL.md
api/skills/dockerignore-generation/SKILL.md
api/skills/domain-attachment/SKILL.md
api/skills/domain-tls-routing/SKILL.md
api/skills/dotnet-deploy/SKILL.md
api/skills/elixir-deploy/SKILL.md
api/skills/failure-diagnosis/SKILL.md
api/skills/github-onboarding/SKILL.md
api/skills/github-workflow/SKILL.md
api/skills/gleam-deploy/SKILL.md
api/skills/go-deploy/SKILL.md
api/skills/incident-response/SKILL.md
api/skills/java-deploy/SKILL.md
api/skills/machine-ops/SKILL.md
api/skills/mcp-integrations/SKILL.md
api/skills/monorepo-strategy/SKILL.md
api/skills/nixopus-docs/SKILL.md
api/skills/node-deploy/SKILL.md
api/skills/onboarding/SKILL.md
api/skills/php-deploy/SKILL.md
api/skills/post-deploy-verification/SKILL.md
api/skills/pre-deploy-checklist/SKILL.md
api/skills/python-deploy/SKILL.md
api/skills/ruby-deploy/SKILL.md
api/skills/rust-deploy/SKILL.md
api/skills/self-heal/SKILL.md
api/skills/shell-deploy/SKILL.md
api/skills/static-deploy/SKILL.md

Metadata

Files
0
Version
cf05d97
Hash
32f70935
Indexed
2026-08-20 14:52

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-29 23:16
浙ICP备14020137号-1 $방문자$