AGENT SKILL

dotfiles

Sync chezmoi-managed agent dotfiles between machines.

License 许可
MIT
最近更新
2026-10-14
Stars
★ 0
Forks
0

01 前言 Front Matter

name
dotfiles
description
Sync chezmoi-managed agent dotfiles between machines.
disable-model-invocation
true

02 资源文件 1

03 SKILL.md 正文

Dotfiles (chezmoi)

Shared config for AI coding agents (Claude Code, Codex CLI, pi) synced between machines with chezmoi.

Authority chain, where to edit

GitHub repo                                  ← shared truth between machines
  └─ chezmoi source  ~/.local/share/chezmoi/ ← local clone (source state)
       └─ ~/.agents/skills/                    ← applied skills (canonical on the machine)
            └─ ~/.claude/skills, ~/.codex/skills, ~/.pi/agent/skills ← symlinks into ~/.agents/
  • Never edit tool skill dirs (~/.claude/skills/...), they are symlinks.
  • There are deliberately no global agent instructions (AGENTS.md/CLAUDE.md).
  • A local change is not "real" until committed and pushed from the source repo, otherwise it never reaches the other machines.

Common operations

Task Commands
Pull changes made on another machine chezmoi update (git pull + apply in one)
Edit a managed file and share it chezmoi edit <target> → chezmoi apply → chezmoi cd → git add -A && git commit && git push
A tool (or you) edited the target file directly chezmoi re-add <file>; for templates use chezmoi merge <file>, re-add breaks templates
Check drift / preview chezmoi status, chezmoi diff

Adding a new canonical skill

  1. Create dot_agents/skills/<name>/SKILL.md (frontmatter: name, description) in the source: $(chezmoi source-path).
  2. Keep invocation metadata portable:
    • For an explicit-only skill, keep Claude Code's disable-model-invocation: true in SKILL.md and add policy.allow_implicit_invocation: false in agents/openai.yaml for Codex and ChatGPT.
    • Claude Code's user-invocable: false has no Codex equivalent. Preserve it for Claude Code; Codex may still expose the skill for explicit use.
  3. chezmoi apply materializes it to ~/.agents/skills/<name>/, instantly visible to all tools via their symlinks.
  4. Commit + push from chezmoi cd. Other machines pick it up with chezmoi update.

Bootstrap a new machine

sh -c "$(curl -fsLS get.chezmoi.io)" -- -b ~/.local/bin
~/.local/bin/chezmoi init --apply <repo-url>

Prereq: the agent tools themselves must be installed and logged in separately. This repo manages their config, not their auth.

Gotchas

  • Push or it didn't happen. The most common sync failure is an applied, committed-but-unpushed change sitting on one machine.
  • Template sources (.tmpl) must be edited via chezmoi edit/merge, never re-add, which would replace the template with its rendered output.
  • ~/.config/chezmoi/chezmoi.toml is per-machine local state and is never in the repo. Don't try to sync it.
  • Skills carrying disable-model-invocation: true register but stay slash-only. That is their config, not a broken link.

04 同仓库更多 Skills