agentleFS
pvnarppvnarp/agent-skills/skills/rollback/SKILL.md

rollback

Skill1 starsChanged 9 months agoMITView on GitHub

Executes safe rollbacks across code, database, config, and feature flags. Provides decision framework for roll-back vs fix-forward, execution playbooks, and verification steps. Use when a deployment needs to be reversed or when deciding between rollback and fix-forward.

  • Deletes or force-pushes
  • Commits and pushes

9 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use audit, status and 3 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • OpenAISkill

    audit

    Audit or critique a product flow, journey, workflow, funnel, onboarding path, checkout path, settings path, screen, or multi-step product experience by capturing screenshots first, then reporting UX, design, and accessibility findings inline from that evidence. Use Figma only when the user explicitly asks for a board. Use when the user asks to audit, review, critique, inspect, assess, analyze, evaluate, or give feedback on a product experience.

    Also in 5 projects that use this

  • AnthropicSkill

    status

    Case status summary by audience — client-facing (plain language), internal (for the professor), or court-ready (formal caption format per local rules). Same facts, different framing and depth. Use when a student needs to update the client, brief the professor, or prepare a court status report.

    Also in 3 projects that use this

  • BlockSkill

    plan

    Draft a TDD, PRD, or lightweight plan in the conversation without committing it.

    Also in 3 projects that use this

  • AWSSkill

    ship

    Finalize dev work on an issue branch — update docs, push, and open a PR.

    Also in 3 projects that use this

  • GoogleSkill

    code-review

    Adversarial systems, concurrency, memory-model, and architecture code review protocol. Use this skill whenever asked to review code, PRs, diffs, or branches in Filament.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

5 rules. 0 are common, 5 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 9 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Always write down migrations.

    line 77
  2. Distinctive:

    Never drop columns in the same deploy as the code change.

    line 78
  3. Distinctive:

    Before deploying irreversible migrations: take a snapshot/backup.

    line 80
  4. Distinctive:

    When bad code wrote wrong data:

    line 84
  5. Distinctive:

    When multiple services were deployed together:

    line 125

“Common” is measured: kept by at least 6 in 10 of the 9 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Rollback

The fastest way to end an incident is often to undo the change that caused it. But rollbacks have their own failure modes - especially when data has changed.

Decision: Rollback vs Fix Forward

Is the fix obvious and small (< 15 min)?
  YES → Fix forward (patch + deploy)
  NO  →
    Has data been mutated by the bad code?
      YES → Rollback is complex (see Data Rollback below)
      NO  → Rollback the deployment
        Were database migrations applied?
          YES → Assess if migration is reversible (see below)
          NO  → Clean code rollback - safest option

When to Rollback

  • Root cause is unclear
  • Fix will take > 15 minutes
  • Impact is severe and growing
  • Multiple systems are affected

When to Fix Forward

  • Root cause is identified and fix is small
  • Rollback would cause data issues
  • The deployed migration can't be reversed
  • The bad code hasn't reached all users yet (canary)

Code Rollback

Revert the Deployment

# Option 1: Redeploy the previous version
# (Best - deploys a known-good artifact)
deploy --version <previous-version>

# Option 2: Git revert + fast deploy
git revert <bad-commit-sha>
git push
# CI/CD deploys the revert

Verify After Rollback

  • Health checks passing
  • Error rate back to baseline
  • Key user flows working (smoke test)
  • No new error types appearing
  • Latency within normal range
  • Customer-facing issues resolved

Database Rollback

The hard one. Data changes aren't automatically reversible.

Schema Rollback

Migration TypeReversible?How
Add column (nullable)YesDrop the column
Add column (NOT NULL with default)YesDrop the column
Add indexYesDrop the index
Add tableYesDrop the table
Drop columnNOData is gone (restore from backup)
Drop tableNOData is gone (restore from backup)
Rename columnDependsRename back (if no code depends on new name yet)
Change column typeDependsChange back (if no data loss in conversion)
Data backfillDependsReverse backfill (if old values are known)

Rules:

  1. Always write down migrations. Test the down migration.
  2. Never drop columns in the same deploy as the code change.
  3. Separate schema migration from data migration.
  4. Before deploying irreversible migrations: take a snapshot/backup.

Data Rollback

When bad code wrote wrong data:

1. STOP THE BLEEDING - disable the code path (feature flag, rollback)
2. ASSESS DAMAGE - what records are affected? Query for anomalies.
3. DETERMINE CORRECT STATE - can you derive correct values from logs, events, or audit trail?
4. FIX DATA - scripted repair (never manual edits)
5. VERIFY - query to confirm all affected records are fixed
6. PREVENT - add validation to prevent bad data from being written again

Config Rollback

# If config is in environment variables:
# Revert the config change in your config management system

# If config is in a config file:
git revert <config-change-commit>

# If config is in a feature flag service:
# Toggle the flag off (instant, no deploy needed)

Config rollback should be the fastest of all - no build, no deploy.

Feature Flag Rollback

The safest rollback - no deployment needed.

1. Toggle the flag OFF in your flag management system
2. Effect is immediate for new requests
3. Verify: feature is disabled, baseline behavior restored
4. Investigate at leisure - the incident is over

This is why feature flags exist. If a feature is behind a flag, rollback is a button click.

Multi-Service Rollback

When multiple services were deployed together:

1. Identify which service(s) are actually broken
   (don't roll back everything - that causes more disruption)
2. Rollback in reverse deployment order
   (last deployed → first rolled back)
3. Check cross-service API compatibility at each step
   (old Service A + new Service B - does it work?)
4. Verify inter-service communication after each rollback

The safest approach: Services should be independently deployable. If they're not, that's tech debt to address.

Rollback Checklist

Before Deploying (Prepare)

  • Know the previous good version/SHA
  • Verify rollback mechanism works (have you tested it recently?)
  • Understand what data changes the deploy includes
  • Know if database migrations are reversible
  • Feature flags in place for risky features

During Rollback (Execute)

  • Communicate to team: "Rolling back deployment X"
  • Execute rollback (redeploy previous version)
  • Reverse database migration if applicable
  • Toggle feature flags if applicable
  • Monitor health checks and error rates

After Rollback (Verify)

  • Health checks green
  • Error rate at pre-deploy baseline
  • Key user flows verified
  • Data integrity checked (if data was affected)
  • Communicate: "Rollback complete, service restored"
  • Create post-mortem task

Anti-Patterns

Anti-PatternProblemFix
No rollback planPanic during incident, slow recoveryRequire rollback plan for every deploy
Rollback untestedRollback mechanism itself is brokenTest rollbacks regularly (in staging)
Rolling back everythingUnnecessary disruptionIdentify the broken service, roll back only that
Ignoring data impactRollback code but bad data persistsCheck for data side effects before rolling back
Fix forward under pressureBad fix causes second incidentDefault to rollback when stressed. Fix forward only when root cause is clear.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.