Checkpoint: Save & Restore Task State

VerifiedCaution

Mid-task rollback points to save/restore state before risky operations like refactors, migrations, destructive edits.

Sby Skills Guide Bot
DevelopmentIntermediate
7/29/2026
Claude Code
#git#rollback#checkpointing#state-management#workflow

Recommended for

Automated summary

Saves and restores the file state of an in-progress task as rollback points, so you can return to an earlier state before a risky operation.

Strengths

  • Automatically takes a safety checkpoint before any restore, making the rollback itself reversible
  • Guards against branch or HEAD mismatches and requires an explicit --force to override
  • Never touches or deletes untracked files; it only lists them as a warning
  • Captures uncommitted changes as a git diff HEAD patch, so restore is a real content rollback rather than a metadata dump

Limitations

  • Restore only rebuilds file content: index state is intentionally not reconstructed, so previously staged changes come back unstaged
  • The content of untracked files at save time is never captured
  • Depends on a Bun script installed under ~/.claude/src/scripts and on Claude Code; legacy checkpoints without a patch file restore nothing (metadata-only mode)
When to use it

Use it right before a refactor, migration, or destructive edit so you can return the tracked files to their exact prior state if things go wrong.

When not to use it

Don't use it to preserve a work session for later resumption — that's what /handoff is for.

Security analysis

Caution
Quality score88/100

The skill uses Bash to run a local checkpoint script with legitimate rollback functionality. Restore and clean are destructive but are opt-in, scoped to tracked files, and have safety rails such as an automatic pre-restore checkpoint and branch guard. The main concern is execution of an external script that is not supplied or verified within the skill, and the availability of a --force override.

Findings
  • •Executes an external script via Bash at a fixed path (~/.claude/src/scripts/checkpoint.ts) whose contents are not included or verified in the skill.
  • •The 'restore' subcommand overwrites working tree and index state, which is destructive to tracked files, though it includes an auto safety-checkpoint and branch/sha guard.
  • •The 'clean' subcommand deletes old checkpoint data (keeps last 10), which is a destructive file operation.
  • •Relies on a '--force' flag that can bypass branch/sha mismatch safeguards.
How this analysis is made

Examples

Checkpoint before a refactor
Save a checkpoint labelled "Before auth refactor" before I start rewriting the auth module.
Roll back a bad migration
The migration script broke things — restore from my last checkpoint.
Inspect and prune checkpoints
List my checkpoints for this project, show me the latest one, then clean up the old ones.

name: checkpoint argument-hint: "[save|restore|show|list|clean] [name-or-id]" description: Mid-task rollback points — save/restore state before risky ops (refactors, migrations, destructive edits). For end-of-session save use /handoff. Triggers "checkpoint", "snapshot", "before this risky op", "rollback to", "list checkpoints", pre-refactor save. context: fork allowed-tools: [Bash]

Checkpoint: Save & Restore Task State

Subcommands

save [label]

Save current state with an optional label.

bun ~/.claude/src/scripts/checkpoint.ts save "Completed phase 3 migration"

list

List all checkpoints for the current project.

bun ~/.claude/src/scripts/checkpoint.ts list

show [checkpoint-id]

Show details of a specific checkpoint.

bun ~/.claude/src/scripts/checkpoint.ts show chk-20240115-103000

restore [checkpoint-id] [--force]

Real, opt-in rollback — restores tracked files (working tree + index) to exactly what they were at save time, then reapplies whatever uncommitted changes existed at that moment (captured as a patch when the checkpoint was saved). Untracked files are never touched or deleted; if any existed at save time they're just listed as a warning (their content was never captured). Scope note: restore reconstructs file content only — anything that was staged at save time comes back as unstaged working-tree changes (the patch reapplies to the worktree; index state is intentionally not reconstructed).

Safety rails:

  • Auto safety-checkpoint first. Before anything is touched, the current state is saved as its own checkpoint and its id is printed — restore is itself reversible by restoring that id (with --force).
  • Branch/sha guard. If the current branch or HEAD differs from what the checkpoint recorded, restore refuses and tells you to check out that branch or pass --force.
  • Legacy checkpoints (saved before this patch-capture feature existed) have no recorded diff to restore from. Restoring one prints "legacy checkpoint: metadata only, nothing restored" and falls back to the old print-only behavior — review the dumped JSON and continue manually.
# Restore latest
bun ~/.claude/src/scripts/checkpoint.ts restore

# Restore specific
bun ~/.claude/src/scripts/checkpoint.ts restore chk-20240115-103000

# Restore across a branch/sha mismatch
bun ~/.claude/src/scripts/checkpoint.ts restore chk-20240115-103000 --force

clean

Remove old checkpoints, keeping the last 10.

bun ~/.claude/src/scripts/checkpoint.ts clean

Examples

User: "save a checkpoint"
  -> /checkpoint save

User: "checkpoint before this refactor"
  -> /checkpoint save "Before auth refactor"

User: "list my checkpoints"
  -> /checkpoint list

User: "restore from last checkpoint"
  -> /checkpoint restore

User: "show checkpoint details"
  -> /checkpoint show <id>

User: "clean up old checkpoints"
  -> /checkpoint clean

Storage

Checkpoints are stored at ~/.claude/checkpoints/<project-name>/ as JSON files with a latest symlink pointing to the most recent. Each checkpoint with uncommitted changes at save time also gets a sibling chk-<id>.patch file (git diff HEAD output) — this is what makes restore a real rollback instead of a metadata dump. Checkpoints saved before this feature existed have no patch file and restore in metadata-only (legacy) mode.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/checkpoint-save-restore-task-state-ms5lrgct/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/checkpoint-save-restore-task-state-ms5lrgct' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/checkpoint-save-restore-task-state-ms5lrgct/download' --output '.skill-downloads/checkpoint-save-restore-task-state-ms5lrgct/SKILL.md.part' && mv '.skill-downloads/checkpoint-save-restore-task-state-ms5lrgct/SKILL.md.part' '.skill-downloads/checkpoint-save-restore-task-state-ms5lrgct/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/checkpoint-save-restore-task-state-ms5lrgct/SKILL.md' && test -s '.skill-downloads/checkpoint-save-restore-task-state-ms5lrgct/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/checkpoint' && cp -R '.skill-downloads/checkpoint-save-restore-task-state-ms5lrgct' '.claude/skills/checkpoint'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/checkpoint-save-restore-task-state-ms5lrgct'

openskills read 'checkpoint-save-restore-task-state-ms5lrgct'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/checkpoint-save-restore-task-state-ms5lrgct/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills