Agent Skillsnyldn/claude-octopus › skill-rollback

skill-rollback

GitHub

提供Git版本回滚能力,支持列出检查点、验证存在性、预览变更及创建安全备份。核心流程包含显式确认机制以保障操作安全,防止误操作导致数据丢失。

.claude/skills/skill-rollback/SKILL.md nyldn/claude-octopus

Trigger Scenarios

需要撤销代码更改 恢复到之前的稳定版本 查询可用的Git检查点

Install

npx skills add nyldn/claude-octopus --skill skill-rollback -g -y
More Options

Non-standard path

npx skills add https://github.com/nyldn/claude-octopus/tree/main/.claude/skills/skill-rollback -g -y

Use without installing

npx skills use nyldn/claude-octopus@skill-rollback

指定 Agent (Claude Code)

npx skills add nyldn/claude-octopus --skill skill-rollback -a claude-code -g -y

安装 repo 全部 skill

npx skills add nyldn/claude-octopus --all -g -y

预览 repo 内 skill

npx skills add nyldn/claude-octopus --list

SKILL.md

Frontmatter
{
    "name": "skill-rollback",
    "trigger": "EXPLICITLY USE when user mentions:\n- \"rollback\" or \"revert\" or \"undo\"\n- \"go back to\" or \"restore checkpoint\"\n",
    "description": "Roll back to a previous checkpoint via git — use when a change went wrong and you need to revert",
    "argument-hint": "[list|<checkpoint-tag>]",
    "user-invocable": true,
    "disable-model-invocation": true
}

Checkpoint Rollback

Safely rollback to a previous checkpoint while preserving lessons learned.

Core principle: List checkpoints → Confirm explicitly → Create safety backup → Restore → Preserve lessons.


Subcommand Detection

Parse the user's request to determine mode:

User Request Mode Action
list, show checkpoints, no argument LIST Show available checkpoints
octo-checkpoint-* tag name ROLLBACK Rollback to specific checkpoint

Mode: LIST (Default)

Step 1: Fetch Available Checkpoints

# List all octo checkpoints with dates
git tag -l "octo-checkpoint-*" --sort=-creatordate --format='%(refname:short)|%(creatordate:short)|%(contents:subject)'

Step 2: Present Checkpoint Table

## Available Checkpoints

| Tag | Created | Description |
|-----|---------|-------------|
| octo-checkpoint-post-discover-20260203-143022 | 2026-02-03 | After Discover phase |
| octo-checkpoint-post-define-20260203-150145 | 2026-02-03 | After Define phase |

Usage: `/octo:rollback <tag-name>`

If no checkpoints found:

No checkpoints found. Checkpoints are created automatically after each Octopus phase.

To create a manual checkpoint:
  git tag -a octo-checkpoint-manual-$(date +%Y%m%d-%H%M%S) -m "Manual checkpoint"

Mode: ROLLBACK

Step 1: Validate Checkpoint Exists

# Check if tag exists
git tag -l "$CHECKPOINT_TAG" | grep -q . || echo "TAG_NOT_FOUND"

If tag not found:

Checkpoint '$CHECKPOINT_TAG' not found.

Available checkpoints:
[show list output]

STOP. Do not proceed.

Step 2: Show What Will Be Affected

# Get list of files that will be changed
git diff --name-status HEAD $CHECKPOINT_TAG

Present clearly:

## Rollback Preview

**Rolling back to:** `octo-checkpoint-post-discover-20260203-143022`
**Created:** 2026-02-03 14:30:22
**Description:** After Discover phase

### Files That Will Be Changed

| Status | File |
|--------|------|
| M | src/auth/login.ts |
| D | src/auth/oauth.ts |
| A | src/legacy/old-auth.ts |

Legend: M=Modified, D=Deleted, A=Added (relative to current state)

### Protected Files (Will NOT be changed)
- `.octo/LESSONS.md` - Lessons are always preserved

Step 3: Require Explicit Confirmation (MANDATORY)

To confirm this rollback, type ROLLBACK exactly.

Any other input will cancel.

Wait for exact confirmation: ROLLBACK

CRITICAL: Do NOT proceed without explicit "ROLLBACK" confirmation.

Step 4: Create Safety Checkpoint

Before any rollback, create a pre-rollback checkpoint:

# Generate timestamp
TIMESTAMP=$(date +%Y%m%d-%H%M%S)

# Create safety checkpoint
git tag -a "octo-checkpoint-pre-rollback-$TIMESTAMP" -m "Safety checkpoint before rollback to $CHECKPOINT_TAG"

Report:

Created safety checkpoint: octo-checkpoint-pre-rollback-$TIMESTAMP

You can return to current state with:
  /octo:rollback octo-checkpoint-pre-rollback-$TIMESTAMP

Step 5: Preserve LESSONS.md

# Save current LESSONS.md if it exists
if [ -f ".octo/LESSONS.md" ]; then
  cp .octo/LESSONS.md /tmp/LESSONS_PRESERVED.md
  LESSONS_PRESERVED=true
fi

Step 6: Execute Rollback

# Restore files from checkpoint (does NOT move HEAD)
git checkout $CHECKPOINT_TAG -- .

# Restore preserved LESSONS.md
if [ "$LESSONS_PRESERVED" = "true" ]; then
  cp /tmp/LESSONS_PRESERVED.md .octo/LESSONS.md
fi

Important: This uses git checkout <tag> -- . which:

  • Restores all files to checkpoint state
  • Does NOT move HEAD or change branch
  • Preserves current commit history
  • Allows immediate commit of the restored state

Step 7: Update STATE.md (If Exists)

if [ -f ".octo/STATE.md" ]; then
  # Append rollback entry to history
  echo "" >> .octo/STATE.md
  echo "## Rollback - $(date '+%Y-%m-%d %H:%M')" >> .octo/STATE.md
  echo "" >> .octo/STATE.md
  echo "- **Target:** $CHECKPOINT_TAG" >> .octo/STATE.md
  echo "- **Safety checkpoint:** octo-checkpoint-pre-rollback-$TIMESTAMP" >> .octo/STATE.md
  echo "- **Reason:** User requested rollback" >> .octo/STATE.md
fi

Step 8: Report Success

Rollback Complete

**Restored to:** `$CHECKPOINT_TAG`
**Files restored:** N files
**LESSONS.md:** Preserved (not rolled back)

**Safety checkpoint created:** `octo-checkpoint-pre-rollback-$TIMESTAMP`

### Next Steps

1. Review the restored files
2. Commit the rollback if satisfied:
   ```bash
   git add -A && git commit -m "chore: rollback to $CHECKPOINT_TAG"
  1. Or return to previous state:
    /octo:rollback octo-checkpoint-pre-rollback-$TIMESTAMP
    

---

## Safety Measures

| Measure | Implementation |
|---------|----------------|
| **Always create safety checkpoint** | Pre-rollback tag created BEFORE any file changes |
| **Preserve LESSONS.md** | Copy before rollback, restore after |
| **Require explicit confirmation** | Must type "ROLLBACK" exactly |
| **Show affected files first** | Preview before confirmation |
| **No history modification** | Uses checkout, not reset |

---

## Red Flags - Never Do

| Action | Why It's Dangerous |
|--------|-------------------|
| Rollback without confirmation | Loses work unexpectedly |
| Skip safety checkpoint | No recovery path |
| Rollback LESSONS.md | Loses accumulated knowledge |
| Use `git reset --hard` | Destroys commit history |
| Force push after rollback | Affects collaborators |
| Delete checkpoint tags | Removes recovery points |

---

## Checkpoint Tag Format

All Octopus checkpoints follow this format:

octo-checkpoint-{type}-{timestamp}

Where:

  • type: post-discover, post-define, post-develop, post-deliver, pre-rollback, manual
  • timestamp: YYYYMMDD-HHMMSS

Examples:
- `octo-checkpoint-post-discover-20260203-143022`
- `octo-checkpoint-post-define-20260203-150145`
- `octo-checkpoint-pre-rollback-20260203-161530`
- `octo-checkpoint-manual-20260203-170000`

---

## Quick Reference

| Command | Action |
|---------|--------|
| `/octo:rollback` | List available checkpoints |
| `/octo:rollback list` | List available checkpoints |
| `/octo:rollback <tag>` | Rollback to specific checkpoint |

---

## The Bottom Line

Rollback → Confirmation received AND safety checkpoint created Otherwise → Not executed


**Show preview. Require "ROLLBACK". Create safety tag. Preserve lessons. Execute safely.**

Version History

  • 242e51d Current 2026-08-20 09:30

Same Skill Collection

.claude/skills/extract-skill/SKILL.md
.claude/skills/flow-deliver/SKILL.md
.claude/skills/flow-parallel/SKILL.md
.claude/skills/flow-spec/SKILL.md
.claude/skills/skill-agent-topology/SKILL.md
.claude/skills/skill-architecture/SKILL.md
.claude/skills/skill-audit/SKILL.md
.claude/skills/skill-authoring/SKILL.md
.claude/skills/skill-claw/SKILL.md
.claude/skills/skill-code-review/SKILL.md
.claude/skills/skill-content-pipeline/SKILL.md
.claude/skills/skill-context-detection/SKILL.md
.claude/skills/skill-copilot-provider/SKILL.md
.claude/skills/skill-cost-projections/SKILL.md
.claude/skills/skill-coverage-audit/SKILL.md
.claude/skills/skill-debate/SKILL.md
.claude/skills/skill-debug/SKILL.md
.claude/skills/skill-decision-support/SKILL.md
.claude/skills/skill-deck/SKILL.md
.claude/skills/skill-deep-research/SKILL.md
.claude/skills/skill-design-lineage/SKILL.md
.claude/skills/skill-doc-delivery/SKILL.md
.claude/skills/skill-doc-sync/SKILL.md
.claude/skills/skill-doctor/SKILL.md
.claude/skills/skill-factory/SKILL.md
.claude/skills/skill-finish-branch/SKILL.md
.claude/skills/skill-intake/SKILL.md
.claude/skills/skill-intent-contract/SKILL.md
.claude/skills/skill-issues/SKILL.md
.claude/skills/skill-iterative-loop/SKILL.md
.claude/skills/skill-knowledge-work/SKILL.md
.claude/skills/skill-meta-prompt/SKILL.md
.claude/skills/skill-native-escalation-routing/SKILL.md
.claude/skills/skill-parallel-agents/SKILL.md
.claude/skills/skill-prd/SKILL.md
.claude/skills/skill-pressure-test/SKILL.md
.claude/skills/skill-quick/SKILL.md
.claude/skills/skill-resume/SKILL.md
.claude/skills/skill-review-response/SKILL.md
.claude/skills/skill-security-audit/SKILL.md
.claude/skills/skill-security-framing/SKILL.md
.claude/skills/skill-ship/SKILL.md
.claude/skills/skill-staged-review/SKILL.md
.claude/skills/skill-status/SKILL.md
.claude/skills/skill-task-management-v2/SKILL.md
.claude/skills/skill-tdd/SKILL.md
.claude/skills/skill-thought-partner/SKILL.md
.claude/skills/skill-ui-ux-design/SKILL.md
.claude/skills/skill-verification-gate/SKILL.md

Metadata

Files
0
Version
242e51d
Hash
9da76e22
Indexed
2026-08-20 09:30

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