Rollback changes

From maslennikov-ig/claude-code-orchestrator-kit · View interactive version

Rollback changes is an AI agent skill from the GitHub repository maslennikov-ig/claude-code-orchestrator-kit. Automatically rollback changes from failed workflow phases using changes log files. Use when workflows fail and need to restore previous state, including file restoration, artifact cleanup, and command reversal. Use for error recovery after failed bug fixes, security patches, or refactoring operatio

How to use this skill

Skill file

Rollback Changes

Rollback failed workflow phases by reading changes log and reversing tracked modifications.

When to Use

Input

{
  "changes_log_path": ".bug-changes.json",
  "phase": "bug-fixing",
  "confirmation_required": true
}

Changes Log Format

{
  "phase": "bug-fixing",
  "timestamp": "2025-10-18T14:30:00Z",
  "files_modified": [{"path": "src/app.ts", "backup": ".rollback/src-app.ts.backup"}],
  "files_created": ["src/new-file.ts"],
  "commands_executed": ["pnpm install", "pnpm build"],
  "git_commits": ["abc123"],
  "artifacts": [".bug-fixing-plan.json"]
}

Process

1. Read & Parse Changes Log

Use Read tool to load JSON. Validate required fields: phase, timestamp, files_modified, files_created, commands_executed, git_commits.

2. Request Confirmation (if required)

Show summary of changes to revert. If user declines, return dry run result.

3. Restore Modified Files

cp "{backup}" "{path}"  # For each {path, backup} in files_modified

4. Delete Created Files

rm -f "{file}"  # For each file in files_created

5. Revert Commands

6. Revert Git Commits

git revert --no-edit {sha}  # In reverse order

7. Cleanup Artifacts

Remove plan files and temporary artifacts.

Output

{
  "success": true,
  "phase": "bug-fixing",
  "actions_taken": ["Restored src/app.ts", "Deleted src/new-file.ts", "Reverted abc123"],
  "files_restored": 1,
  "files_deleted": 1,
  "git_commits_reverted": 1,
  "errors": [],
  "warnings": ["Backup not found: .rollback/file.backup (skipped)"]
}

Error Handling

Safety Features

Worker Integration

Workers should track changes during operations:

  1. Create .{domain}-changes.json before modifications
  2. Create backups in .rollback/ for modified files
  3. Log all file creates, commands, and commits
  4. On failure: invoke rollback-changes with confirmation_required=false
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.