backup-snapshot
Skill0 starsChanged 49 days agoMITView on GitHub
Create git snapshots before risky operations. Tag backups with timestamp, stash changes, document recovery steps. Trigger on 'backup', 'snapshot', 'before', 'risky', 'undo', 'save state'.
- Deletes or force-pushes
- Commits and pushes
In this repository20 other files it gives its agents.
- examples/CLAUDE.mdCLAUDE.md
- Anti-Hallucination VerificationSkill
- Multi-Agent BrainstormSkill
- Browser UATSkill
- ci-cd-builderSkill
- Code Patterns ReferenceSkill
- Conventional Commits WorkflowSkill
- Context Curator AdministrationSkill
- email-composerSkill
- git-detectiveSkill
- imap-emailSkill
- ollama-model-managerSkill
- Ollama Code VerificationSkill
- project-bootstrapperSkill
- prompt-engineerSkill
- refactor-analyzerSkill
- release-managerSkill
- scheduleSkill
- skill-creatorSkill
- Work LogSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 6 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
Create safe restore points before dangerous operations (large refactorings, risky merges, breaking changes) using git snapshots and tags.
- Distinctive: line 37
If uncommitted work exists, preserve it:
- Distinctive: line 79
Document what was backed up:
- Distinctive: line 242
Use clear, descriptive names
- Very specific: line 249
Keep BACKUP_LOG.md updated
- Distinctive: line 254
Delete old backups after 1 month
- Distinctive: line 255
Keep only recent 5-10 per operation type
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Backup Snapshot Skill
Overview
Create safe restore points before dangerous operations (large refactorings, risky merges, breaking changes) using git snapshots and tags.
Phase 1: CHECK STATUS
Verify Clean State
git status
# No uncommitted changes should exist
# If dirty: stash or commit firstCurrent Branch & Commits
git branch --show-current
# Current: feature/my-feature
git log -1 --oneline
# abc1234 (HEAD) feat: add new featureRemote Status
git status -sb
# On branch main, up-to-date with origin/mainPhase 2: STASH OR WIP COMMIT
If uncommitted work exists, preserve it:
Option A: Stash (temporary)
git stash push -m "WIP: [description]"
# Save current changes without committingLater restore:
git stash pop
# or: git stash apply stash@{0}Option B: WIP Commit (clearer history)
git add -A
git commit -m "WIP: [description of work in progress]"
# Commit as WIP, can amend or squash laterPhase 3: CREATE BACKUP TAG
Tag the current state with timestamp:
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
git tag -a "backup/$TIMESTAMP" -m "Backup before [operation description]"
# Example: backup/20260308-143022
# For specific branch:
git tag -a "backup/$BRANCH/$TIMESTAMP" -m "Backup of $BRANCH before risky operation"
# Example: backup/feature-x/20260308-143022Tag Naming Convention
backup/YYYY-MM-DD-HHMMSS— timestamp-basedbackup/branch-name/YYYY-MM-DD-HHMMSS— branch-specificbackup/before-refactor/YYYY-MM-DD-HHMMSS— operation-specific
Phase 4: LOG BACKUP
Document what was backed up:
cat > BACKUP_LOG.md << EOF
# Backup Log
## Backup: backup/20260308-143022
- **Date**: $(date)
- **Branch**: $(git branch --show-current)
- **Commit**: $(git rev-parse HEAD)
- **Message**: $(git log -1 --pretty=%B)
### Reason for Backup
Backup created before [describe risky operation]
### What's included
- All committed changes
- Project state: [describe state]
### Recovery Instructions
\`\`\`bash
git checkout backup/20260308-143022
# Or reset branch to this backup:
git reset --hard backup/20260308-143022
\`\`\`
---
EOFPhase 5: RESTORE INSTRUCTIONS
Provide clear recovery steps:
View All Backups
git tag -l "backup/*"
# Lists all backup tagsView Backup Details
git show backup/20260308-143022
# Shows commit message and diffRestore to Backup
# Option 1: Checkout backup (detached HEAD)
git checkout backup/20260308-143022
# Option 2: Reset current branch to backup (DESTRUCTIVE)
git reset --hard backup/20260308-143022
# Option 3: Create new branch from backup
git checkout -b restore-20260308 backup/20260308-143022Restore Specific File
# Get file as it was at backup
git show backup/20260308-143022:path/to/file.py > file.pyPhase 6: LIST SNAPSHOTS
Show existing backups:
List All Backups
git tag -l "backup/*" -n --sort=-version:refname
# Output:
# backup/20260308-143022 Backup before large refactoring
# backup/feature-x/20260308-141500 Backup of feature-x branch
# backup/20260307-160000 Backup before risky mergeShow Recent Backups
git tag -l "backup/*" -n --sort=-version:refname | head -10Cleanup Old Backups
# Keep recent 10, delete older ones
git tag -l "backup/*" --sort=-version:refname | tail -n +11 | xargs -r git tag -dPhase 7: OPERATIONS WORKFLOW
Large Refactoring
# 1. Create backup
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
git tag -a "backup/before-refactor-$TIMESTAMP" -m "Before large refactoring"
# 2. Perform refactoring
# 3. Test thoroughly
pytest tests/
# 4. If something breaks, restore:
git reset --hard backup/before-refactor-$TIMESTAMP
# Then retry with different approachRisky Merge
# Backup both branches
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
git tag -a "backup/before-merge-$TIMESTAMP" -m "Before merging develop into main"
# Perform merge
git merge develop
# If conflicts or issues, restore:
git reset --hard backup/before-merge-$TIMESTAMP
# Then resolve conflicts before retryingBreaking API Change
# Backup before changes
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
git tag -a "backup/api-v2-$TIMESTAMP" -m "Before API v2 breaking changes"
# Make breaking changes
# Run tests
uv run pytest
# If tests fail and unfixable, revert:
git reset --hard backup/api-v2-$TIMESTAMPMajor Dependency Update
# Before updating critical dependency
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
git tag -a "backup/before-upgrade-$TIMESTAMP" -m "Before upgrading FastAPI from v0.100 to v1.0"
# Update dependency
uv add fastapi@latest
# Run full test suite
uv run pytest --cov
# If major issues:
git reset --hard backup/before-upgrade-$TIMESTAMP
# Revert, then update incrementallyPhase 8: BEST PRACTICES
When to Create Backups
- ✓ Large refactorings (>50 files changed)
- ✓ Risky merges (long-lived branches)
- ✓ Breaking changes (API, dependencies)
- ✓ Experimental features (uncertain outcome)
- ✓ Before database migrations
- ✗ Small bug fixes (use git revert instead)
- ✗ Regular commits (not needed, git history is backup)
Tag Naming
- Use clear, descriptive names
- Include operation type:
backup/before-[operation] - Include timestamp:
YYYYMMDD-HHMMSS - Keep under 50 characters
Documentation
- Log why backup was created
- Keep BACKUP_LOG.md updated
- Include recovery instructions
Cleanup
- Backups take disk space
- Delete old backups after 1 month
- Keep only recent 5-10 per operation type
Share Across Team
# Push backups to remote so team can access
git push origin "refs/tags/backup/*"
# Only backups, not all tags:
git push origin "refs/tags/backup/*:refs/tags/backup/*"Example Backup Workflow
# Step 1: Prepare
git status # Must be clean
# Branch: main, all changes committed
# Step 2: Create backup
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
git tag -a "backup/refactor-parser-$TIMESTAMP" \
-m "Backup before refactoring parser module"
# Step 3: Perform risky operation
# ... make changes, refactor code ...
# Step 4: Test
pytest tests/ -v
# Step 5a: Success? Commit and delete backup
git commit -am "refactor: simplify parser module"
git tag -d "backup/refactor-parser-$TIMESTAMP"
# Step 5b: Failure? Restore from backup
git reset --hard "backup/refactor-parser-$TIMESTAMP"
# Then try different approachDoes 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
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.

