跳到正文
cccskills
免费在 GitHub 公开中文介绍

Dotfiles

用私有 GitHub 仓库管理指定的 Shell、编辑器和终端配置,可比较差异、拉取、同步、备份或从带时间戳的备份恢复。推送前会检查仓库隐私状态并扫描机密信息。

原文查看原文说明

Manage ~/.zshrc and a chosen set of ~/.config/ directories (you name them in Config.md) against a private GitHub dotfiles repo. Intents: Push (verify private remote, scan secrets), Pull (clone/diff), Sync, Restore (timestamped backup), Status, Backup (local timestamped copy). Security scan blocks .env, secrets, tokens before push. NEVER commits to public repos. USE WHEN dotfiles, push/pull/sync dotfiles, zshrc, restore config, backup config, new machine setup. NOT FOR app configs unrelated to shell/editor/terminal.

danielmiessler/LifeOS星标 19,635(GitHub 19,635 + cccskills 0)
集成工具GitHub

实测评分 未实测

查看安装方法

适用场景

  • 将配置迁移到新设备
  • 查看发生变化的配置
  • 从备份恢复配置
  • 将编辑后的配置推送到仓库

中文介绍

功能

使用私有 GitHub 仓库管理 ~/.zshrc 和 Config.md 中指定的 ~/.config/ 目录。可以推送或拉取配置、查看本地与远端差异、双向同步、检查状态、创建本地备份,也可以从带时间戳的备份恢复。推送前会确认远端仓库为私有,并用 gitleaks 扫描已暂存的更改和未推送的提交。扫描失败或未安装 gitleaks 时,操作会停止。

适用场景

将 Shell 配置迁移到新设备,或在多个环境中保持配置一致时可以使用。也可用于查看指定配置有哪些差异,或在恢复前先备份。管理范围是 Shell、编辑器和终端相关配置。

使用示例

  • “检查我的 dotfiles 状态。”
  • “把修改后的配置推送到私有仓库。”
  • “在新设备上拉取这些配置。”
  • “从指定备份恢复配置。”

注意事项

首次使用需要在 Config.md 中设置仓库、备份位置和目标目录。使用 GitHub CLI 检查仓库是否私有,并在推送前用 gitleaks 扫描机密信息。恢复会覆盖本地文件,因此会先创建备份并要求用户确认。

本介绍由 AI(OpenAI Codex)根据公开的 SKILL.md 撰写。准确的规格请查看下方原文。

文档检查

AI 根据 SKILL.md 的内容检查了需要注意的操作和使用前提。评分只依据实际运行的结果(实测对比)。

安全性发送数据、删除文件、执行命令等是否有说明
A良好推送前检查隐私状态和机密扫描,恢复前备份并要求确认。
安装难易度所需工具和 API 密钥是否少且有说明
B部分不足需要多个 Config.md 配置项、GitHub CLI 和 gitleaks,并说明了设置位置。

不计入评分。 由 AI(OpenAI Codex)于 2026年10月28日 评估。仅供参考,安装前请同时查看原文。

如果您认为评估有误,请申请复核

请写明哪一项有误以及原因。无需登录。我们会对照 SKILL.md 重新评估,并在此处更新结果。

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

包含的文件(9)

  • SKILL.md10.6 KB
  • Intents/Backup.md4.4 KB
  • Intents/Pull.md3.1 KB
  • Intents/Push.md7.6 KB
  • Intents/Restore.md7.4 KB
  • Intents/Status.md4.0 KB
  • Intents/Sync.md4.0 KB
  • Setup.md3.7 KB
  • Tools/Config.ts3.2 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

System Dotfiles Management Skill

Contents: Ideal State · Intent Routing · Data & Config · Tool contract · Gotchas · Examples

Manages ~/.zshrc and ~/.config/ against a private GitHub dotfiles repo; the directories under ~/.config that Backup and Restore copy are the ones you list in Config.md (DOTFILES_CONFIG_DIRS). Push local config up, pull it down, sync two-way, restore from a timestamped backup, or check status — with a gitleaks content scan of the staged diff and of every unpushed commit that stops the push on any secret, or when gitleaks is not installed.

The working clone lives at $DOTFILES_DIR and tracks the private remote $DOTFILES_REPO. Push is the default intent; Pull, Sync and Status only compare, Restore is the one intent that overwrites local files, and Backup makes a local copy that never leaves the machine.

Ideal State

  • Every push lands only in $DOTFILES_REPO, after GitHub reported it private (gh repo view --json isPrivate printed true) both before any other Push step and again just before the push, and after gitleaks exited 0 on the staged diff and on every unpushed commit; any failed check, or gitleaks missing, stopped the run before a commit or push.
  • Only configs enter the repo or a backup: Push copies and stages the files the repo already tracks, a new config enters by name, every local backup (Backup, and Restore's backup before it overwrites) copies the DOTFILES_CONFIG_DIRS directories with secret files excluded, and Restore's also copies every tracked .config file it will overwrite, and the whole ~/.config is never copied or staged.
  • Every comparison of local and repo (Pull, Sync, Status, and Restore's check after it copies) covers .zshrc and the files git ls-files .config lists, so a report names only real dotfile differences and a clean machine reports none.
  • No local file is overwritten before a timestamped backup exists in $DOTFILES_BACKUPS and the user confirmed; Pull, Sync and Status leave every local file unchanged.
  • Every run reports the files it changed, the repository it verified, the security check result, the commit hash when it committed, and the next intent to run.

Intent Routing

IntentTriggerFile
Push"push dotfiles", "update dotfiles" (default)Intents/Push.md
Pull"pull dotfiles", new machine setupIntents/Pull.md
Sync"sync dotfiles", unsure of directionIntents/Sync.md
Restore"restore dotfiles", recover configIntents/Restore.md
Status"check dotfiles status", "dotfiles status"Intents/Status.md
Backup"backup dotfiles", local timestamped copyIntents/Backup.md
FileRead when
Setup.mdfirst-time setup, or Tools/Config.ts stopped on a missing Config.md or key

Data & Config

This skill ships no personal data. All private values live in the USER tree at <configRoot>/LIFEOS/USER/CUSTOMIZATIONS/SKILLS/Dotfiles/Config.md (configRoot is $CLAUDE_CONFIG_DIR when set, else ~/.claude): the keys DOTFILES_DIR, DOTFILES_BACKUPS, DOTFILES_REPO, DOTFILES_REPO_SLUG and DOTFILES_CONFIG_DIRS. Every intent opens with this Config command, which runs Tools/Config.ts, exports those keys and exits non-zero (stopping the intent) when the file or a required key is missing. Nothing has a built-in default. First-time setup: Setup.md.

DOTFILES_ENV="$(bun ~/.claude/skills/Dotfiles/Tools/Config.ts)" || exit 1; eval "$DOTFILES_ENV"   # exports DOTFILES_DIR, DOTFILES_BACKUPS, DOTFILES_REPO, DOTFILES_REPO_SLUG, DOTFILES_CONFIG_DIRS

Tool contract

Recipes two or more intents share. Each runs after the Config command.

Remote check — the remote is the configured repo AND GitHub says it is private

Push runs it before any other step and again before the push. Status runs it inside a subshell, ( … ), so a STOP line becomes the report's remote warning and the rest of the report still runs. In Push, any STOP line ends the intent: no pull, no commit, no push.

cd "$DOTFILES_DIR" || { echo "STOP: no dotfiles clone at $DOTFILES_DIR"; exit 1; }
REMOTE=$(git remote get-url origin) || { echo "STOP: the clone has no origin remote"; exit 1; }
[ "$REMOTE" = "$DOTFILES_REPO" ] || { echo "STOP: origin is $REMOTE, expected $DOTFILES_REPO"; exit 1; }
PRIVATE=$(gh repo view "$REMOTE" --json isPrivate -q .isPrivate) || { echo "STOP: cannot read the repo's visibility from GitHub (gh auth status?)"; exit 1; }
[ "$PRIVATE" = "true" ] || { echo "STOP: $REMOTE is not private (isPrivate=$PRIVATE)"; exit 1; }
echo "OK: origin is $REMOTE, private"

The visibility check is the one that matters: the equality line only proves origin matches the configured URL, not that the repo is private. gh repo view accepts the SSH, HTTPS, or OWNER/REPO form of the remote.

Compare local and repo — tracked files only

Run from $DOTFILES_DIR. Prints one line per .zshrc or tracked .config file that is missing at home or differs from the clone; no output means they match. Never diff -qr ~/.config/ .config/: the repo tracks a subset, so a whole-directory diff lists every app's data and never comes back clean.

{ echo .zshrc; git ls-files .config; } | while IFS= read -r f; do
  if [ ! -e "$HOME/$f" ]; then echo "missing locally: $f"
  elif ! cmp -s "$HOME/$f" "$f"; then echo "differs: $f"; fi
done

Backup copy — Backup, and Restore before it overwrites

Sets $timestamp and $backup_dir, copies ~/.zshrc and the DOTFILES_CONFIG_DIRS directories, and leaves secret files out. It sets $backup_ok to 1 only when every copy succeeded; Restore overwrites nothing unless $backup_ok is 1.

timestamp=$(date +%Y%m%d_%H%M%S)
backup_dir=$DOTFILES_BACKUPS/$timestamp
backup_ok=1
mkdir -p "$backup_dir/.config" || backup_ok=0
if [ -f ~/.zshrc ]; then
    if cp ~/.zshrc "$backup_dir/.zshrc"; then echo "✅ Backed up .zshrc"; else echo "❌ .zshrc backup failed"; backup_ok=0; fi
fi
# Backup the directories named in Config.md (not entire .config to save space).
# $(printf ...) word-splits in zsh and bash alike; a bare $DOTFILES_CONFIG_DIRS is one word in zsh.
for dir in $(printf '%s' "$DOTFILES_CONFIG_DIRS"); do
    if [ -d ~/.config/$dir ]; then
        # No secrets in a backup: a tool's directory can hold its own .env or token
        # files, and every backup would be another plaintext copy.
        rsync -a --exclude='.env' --exclude='.env.*' --exclude='*.oauth' --exclude='*oauth*.json' \
            --exclude='*token*.json' --exclude='client_secret*.json' --exclude='credentials*' \
            --exclude='auth.json' ~/.config/$dir "$backup_dir/.config/" \
            && echo "✅ Backed up .config/$dir" || { echo "❌ .config/$dir backup failed"; backup_ok=0; }
    fi
done
if [ "$backup_ok" = 1 ]; then echo "Backup complete at: $backup_dir"; else echo "❌ Backup INCOMPLETE at: $backup_dir. Do not restore or overwrite anything."; fi

Restore from a backup — rollback

The one rollback recipe; Restore and Backup point here. It overwrites local files, so it follows the same rule as Restore: a fresh backup of the current files first, then the user's yes.

  1. Pick the backup to roll back to, before taking the fresh one (which becomes the newest):
ls -lt "$DOTFILES_BACKUPS"/
backup=$DOTFILES_BACKUPS/YYYYMMDD_HHMMSS   # the chosen timestamp
[ -d "$backup" ] || { echo "STOP: no backup at $backup"; exit 1; }
  1. Run the Backup copy above, so the current files can be recovered from $backup_dir.
  2. Show the user $backup (the source), $backup_dir (the fresh backup) and the files that will be overwritten (.zshrc and each DOTFILES_CONFIG_DIRS directory present under $backup/.config), and wait for their yes.
  3. Only after that yes:
[ "$backup_ok" = 1 ] || { echo "STOP: the fresh backup is incomplete; nothing restored"; exit 1; }
[ -f "$backup/.zshrc" ] && cp "$backup/.zshrc" ~/.zshrc
# Only the configured directories: the fresh backup covers those and nothing else.
for dir in $(printf '%s' "$DOTFILES_CONFIG_DIRS"); do
    [ -d "$backup/.config/$dir" ] && cp -R "$backup/.config/$dir" ~/.config/
done
echo "Rolled back from $backup; previous files saved at $backup_dir"

Reloading in the agent's shell changes nothing for the user. Tell them to run exec zsh (or source ~/.zshrc) in their own terminal.

Gotchas

  • Dotfiles holds configs only, and the repo's tracked list decides what counts. Push copies tracked files and stages tracked files; a new config is added by name. The config directory can also hold application data and credentials, so never stage or copy it whole; ignore data and credential directories in .config/.gitignore.

Examples

Example 1: Push dotfiles after config changes

User: "push dotfiles"
→ Verifies private repo, checks for sensitive files
→ Copies .zshrc and the tracked .config/ files to repo
→ Stages tracked files only, commits, pushes to GitHub

Example 2: Set up a new machine

User: "pull dotfiles"
→ Clones/pulls latest from private repo
→ Shows diff between local and repo versions; local files stay unchanged
→ Then the Restore intent copies them home, after a timestamped backup and the user's yes

Example 3: Check what's changed

User: "check dotfiles status"
→ Compares local .zshrc and .config/ with repo
→ Shows uncommitted changes and sync status
→ Verifies remote is correct private repo

Example 4: Unsure which direction to sync

User: "sync dotfiles"
→ Sync intent: shows the tracked files that differ and which side changed each one, changes nothing
→ Recommends Push or Restore

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

AnnualReports

免费有简介

按类别或厂商查找并获取网络安全报告,比较威胁、勒索软件、数据泄露、云安全和AI趋势。分析会注明每项数据的厂商、年份及报告,并分别呈现来源间的分歧。

  • 按类别查找威胁报告
  • 获取指定厂商的报告
  • 比较多家厂商的勒索软件趋势
danielmiessler/LifeOS2万2026年10月28日 更新

ApertureOscillation

免费有简介

通过三轮分析,对比单个功能或组件的设计需求与整个系统的目标,梳理两者的冲突、合适的实现范围,以及方案是否符合整体方向。

  • 判断服务或库是否应拆分
  • 比较功能需求与产品方向
  • 检查新组件是否符合现有系统
danielmiessler/LifeOS2万2026年10月28日 更新

Aphorisms

免费有简介

按文章主题寻找格言或引文,按相关程度排序,并附上作者和推荐理由。可添加带出处的引文、按主题研究思想家的言论、整理使用记录,帮助避免重复引用。

  • 为新闻简报寻找引文
  • 保存有出处且不重复的引文
  • 按主题研究思想家的言论
danielmiessler/LifeOS2万2026年10月28日 更新

Art

免费有简介

按用途选择制作流程,生成博客插图、技术图解、比较图、漫画和图标等视觉内容,并输出供预览的图像。

  • 制作博客标题图
  • 解释系统结构
  • 展示比较或时间线
danielmiessler/LifeOS2万2026年10月28日 更新

ArtDirection

免费有简介

依据简报和制作标准评估图片、影片、幻灯片及网站页面截图,由视觉评审给出评分和缺陷优先级,支持有限轮次的修改;通过评审后才能交付,并可记录人工评分供后续校准。

  • 按优先级整理图片修改项
  • 依标准评估影片或幻灯片
  • 发布前检查视觉效果
danielmiessler/LifeOS2万2026年10月28日 更新

ArXiv

免费有简介

按主题、研究领域或论文编号查找 arXiv 论文,并整理标题、作者、摘要和链接;查看新投稿,也可在有内容时获取 AlphaXiv 的人工智能生成概述。

  • 查看人工智能和机器学习新论文
  • 查找特定主题的论文
  • 按论文编号或 arXiv 网址查询
danielmiessler/LifeOS2万2026年10月28日 更新

查看 danielmiessler 的全部技能

报告此技能的问题