backup-strategy

backup-strategy is a skill for Claude Code, Codex from chaterm/terminal-skills. It costs 8 tokens per session (1,596 once invoked), scanned C, original, Apache-2.0.

A guide for designing backup systems around the 3-2-1 rule: three copies of data, on two types of storage, with one copy kept elsewhere.

In plain words
What is it for?
Use it to plan full, incremental, and differential backups, retention schedules such as daily/weekly/monthly/yearly copies, and backup verification.
Why use it?
It helps reduce the chance that one hardware failure, incident, or storage location destroys every copy of the data.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: positional $N argument.

Good fit Use it to plan full, incremental, and differential backups, retention schedules such as daily/weekly/monthly/yearly copies, and backup verification.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/chaterm/terminal-skills/backup-strategy
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add chaterm/terminal-skills --skill backup-strategy
Clone the repo
git clone --depth 1 https://github.com/chaterm/terminal-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for backup-strategy

README.md
[![agentmods](https://agentmods.dev/badge/skills/chaterm/terminal-skills/backup-strategy/github.svg)](https://agentmods.dev/skills/chaterm/terminal-skills/backup-strategy)
Your own site
<a href="https://agentmods.dev/skills/chaterm/terminal-skills/backup-strategy"><img src="https://agentmods.dev/badge/skills/chaterm/terminal-skills/backup-strategy/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for backup-strategy

Your own site · 80×15
<a href="https://agentmods.dev/skills/chaterm/terminal-skills/backup-strategy"><img src="https://agentmods.dev/badge/skills/chaterm/terminal-skills/backup-strategy.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 8 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,596 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00008 $0.01596
Opus 5 $0.00004 $0.00798
Sonnet 5 $0.00002 $0.00319
Haiku 4.5 $0.00001 $0.00160

Measured 11d ago against content hash 012c96471fc5, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade C, and why

backup-strategy scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

rm -rf $TEST_DIR
backup/backup-strategy/SKILL.md · 232 lines

How it starts

The opening of the file, as written. The whole thing — 232 lines — stays where its author put it; the contents beside it link to each section on GitHub.

备份策略设计

概述

3-2-1 策略、备份验证、保留策略设计技能。

3-2-1 备份策略

核心原则

3 - 至少保留 3 份数据副本
2 - 存储在 2 种不同介质上
1 - 至少 1 份异地存储

扩展 3-2-1-1-0:
3 份副本
2 种介质
1 份异地
1 份离线/不可变
0 个错误(验证通过)

实施示例

# 本地备份(副本 1)
tar -czvf /backup/local/data_$(date +%Y%m%d).tar.gz /data

# NAS 备份(副本 2,不同介质)
rsync -avz /backup/local/ nas:/backup/

# 云备份(副本 3,异地)
aws s3 sync /backup/local/ s3://backup-bucket/

备份类型

完整备份

# 每周完整备份
tar -czvf /backup/full_$(date +%Y%m%d).tar.gz /data

增量备份

# 基于时间戳
tar -czvf /backup/incr_$(date +%Y%m%d).tar.gz \
    --newer-mtime="1 day ago" /data

# 基于快照文件
tar -czvf /backup/incr.tar.gz -g /backup/snapshot.snar /data

差异备份

# 基于完整备份时间
tar -czvf /backup/diff_$(date +%Y%m%d).tar.gz \
    --newer-mtime="$(cat /backup/last_full_date)" /data

保留策略

GFS 策略

# Grandfather-Father-Son
# 日备份:保留 7 天
# 周备份:保留 4 周
# 月备份:保留 12 个月
# 年备份:保留 7 年

#!/bin/bash
BACKUP_DIR="/backup"
DATE=$(date +%Y%m%d)
DOW=$(date +%u)  # 1-7
DOM=$(date +%d)  # 01-31

# 日备份
tar -czvf ${BACKUP_DIR}/daily/backup_${DATE}.tar.gz /data

# 周备份(周日)
if [ "$DOW" -eq 7 ]; then
    cp ${BACKUP_DIR}/daily/backup_${DATE}.tar.gz ${BACKUP_DIR}/weekly/
fi

# 月备份(1号)
if [ "$DOM" -eq "01" ]; then
    cp ${BACKUP_DIR}/daily/backup_${DATE}.tar.gz ${BACKUP_DIR}/monthly/
fi

# 清理
find ${BACKUP_DIR}/daily -mtime +7 -delete
find ${BACKUP_DIR}/weekly -mtime +28 -delete
find ${BACKUP_DIR}/monthly -mtime +365 -delete

滚动保留

#!/bin/bash
# 保留最近 N 个备份
BACKUP_DIR="/backup"
KEEP=10

ls -1t ${BACKUP_DIR}/*.tar.gz | tail -n +$((KEEP+1)) | xargs -r rm

备份验证

完整性检查

# 校验和验证
md5sum backup.tar.gz > backup.md5
md5sum -c backup.md5

# tar 测试
tar -tzvf backup.tar.gz > /dev/null

# gzip 测试
gzip -t backup.tar.gz

恢复测试

#!/bin/bash
# 定期恢复测试
TEST_DIR="/tmp/restore_test"
mkdir -p $TEST_DIR

# 解压测试
tar -xzvf /backup/latest.tar.gz -C $TEST_DIR

# 验证文件数量
ORIG_COUNT=$(find /data -type f | wc -l)
REST_COUNT=$(find $TEST_DIR -type f | wc -l)

if [ "$ORIG_COUNT" -eq "$REST_COUNT" ]; then
    echo "验证通过"
else
    echo "验证失败:文件数量不匹配"
fi

rm -rf $TEST_DIR

Read the full file on GitHub · 232 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 232 lines · 8 tokens per session scan C 012c96471fc5

Subscribe to this mod's changes

backup-strategy is a skill published in the GitHub repository chaterm/terminal-skills (59 stars, last pushed 6mo ago), licensed Apache-2.0. It adds 8 tokens to every session and 1,596 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.