This skill helps manage dotfiles with chezmoi, sync configurations, and automate ansible playbooks to your dotfiles repository.
npx playbooks add skill trentshaines/dotfiles --skill trent-chezmoi
Chezmoi manages dotfiles and system configuration, syncing them to a Git repository for version control and portability across machines. This includes ansible playbooks for system package installation.
/Users/trent/.local/share/chezmoi/https://github.com/trentshaines/dotfiles.git~/ (managed files)~/.config/ (managed files)~/ansible/ (managed via chezmoi)Important files tracked by chezmoi (in source directory):
dot_zshrc → ~/.zshrcdot_tmux.conf → ~/.tmux.confdot_gitconfig → ~/.gitconfigdot_gitignore_global → ~/.gitignore_globaldot_fzf.zsh → ~/.fzf.zshdot_ideavimrc → ~/.ideavimrcdot_aerospace.toml → ~/.aerospace.tomldot_config/ → ~/.config/ (includes tmuxinator, gh, etc.)dot_claude/ → ~/.claude/ (skills, settings, etc.)dot_cursor/ → ~/.cursor/dot_local/ → ~/.local/ansible/ → ~/ansible/ (ansible playbooks for package installation)private_Documents/ → ~/Documents/ (private, encrypted)private_Library/ → ~/Library/ (private, encrypted)cadd # chezmoi re-add (sync changes back to source)
capply # chezmoi apply (apply changes from source to home)
add vs re-addThis is the most important distinction:
chezmoi add <file> - Add a NEW file that's NOT YET managed by chezmoichezmoi re-add <file> - Update an EXISTING file that's ALREADY managedchezmoi re-add <directory> - Update directory AND pick up new files within itHow to know which to use:
chezmoi managed | grep filename # If it shows up → use re-add
# If it doesn't → use add
SHORTCUT for managed directories:
If the parent directory is already managed, re-add on the directory picks up new files!
# These directories are ALREADY managed:
chezmoi re-add ~/.claude/skills/ # Picks up new AND modified skills
chezmoi re-add ~/.config/tmuxinator/ # Picks up new AND modified templates
# So you DON'T need 'add' for new skills or templates - just re-add the directory!
IMPORTANT: chezmoi re-add with NO arguments
Running chezmoi re-add without any arguments will re-add ALL modified managed files:
chezmoi re-add # Re-add everything that changed
When to use this:
⚠️ CRITICAL: Always check what changed before committing!
chezmoi re-add # Re-add all changes
cd ~/.local/share/chezmoi
git status # See what files changed
git diff # Review the actual changes
Why this matters:
# Sync changes FROM home TO chezmoi source
chezmoi add ~/.new-file # Add NEW file (first time)
chezmoi re-add ~/.zshrc # Re-add EXISTING managed file
chezmoi re-add ~/.config/tmuxinator/admin.yml # Re-add EXISTING config
chezmoi re-add # Re-add ALL modified managed files (no args!)
# Apply changes FROM chezmoi source TO home
chezmoi apply # Apply all changes
chezmoi apply ~/.zshrc # Apply specific file
# View changes
chezmoi diff # See what would change
chezmoi status # See modified files
chezmoi managed # List all managed files
# Git operations (in chezmoi source)
chezmoi cd # cd to source directory
chezmoi git -- status # Git status
chezmoi git -- add . # Git add
chezmoi git -- commit -m "msg" # Git commit
chezmoi git -- push # Git push
exit # Exit chezmoi source directory
When you modify or create config files, use this workflow:
# Step 1: Re-add managed directories or files
chezmoi re-add ~/.claude/skills/ # For skills (new OR modified)
chezmoi re-add ~/.config/tmuxinator/ # For tmuxinator (new OR modified)
chezmoi re-add ~/.zshrc # For individual files
# Step 2: Work directly in the chezmoi source directory
cd ~/.local/share/chezmoi
# Step 3: Use git commands directly
git add . # Stage everything
git status # Review what's changed
git commit -m "Descriptive message" # Commit
git push # Push to GitHub
# Step 4: Return to previous directory
cd -
Key insight: For ~/.claude/skills/ and ~/.config/tmuxinator/, just use re-add on the directory - it picks up new AND modified files!
Even simpler alternative (when unsure):
# Just work directly in the chezmoi source!
cd ~/.local/share/chezmoi
git add .
git status # See what changed
git commit -m "Update configs"
git push
cd -
This avoids confusion about add vs re-add since git will show you exactly what changed.
When Claude (or the user) modifies a config file like ~/.zshrc, ~/.config/tmuxinator/admin.yml, or any other managed file:
# For NEW files (not yet managed):
chezmoi add ~/.config/tmuxinator/config.yml
# For EXISTING managed files:
chezmoi re-add ~/.zshrc
chezmoi re-add ~/.config/tmuxinator/admin.yml
cd ~/.local/share/chezmoi
git status # ⚠️ ALWAYS check what files changed
git diff # Review the actual changes (optional but recommended)
git add .
git commit -m "Description of changes"
git push
cd -
⚠️ IMPORTANT: Always run git status before committing to catch:
IMPORTANT: After making ANY configuration changes to managed files, Claude should:
I've updated ~/.zshrc. Would you like me to sync this to your dotfiles repo?
This involves:
1. chezmoi re-add ~/.zshrc
2. Commit and push to github.com/trentshaines/dotfiles
Ask: "Would you like to run chezmoi re-add (no args) to sync ALL modified managed files?"
This is useful because:
cd ~/.local/share/chezmoi
git status # Show user what files changed
git diffAfter modifying a config file:
Updated: ~/.config/tmuxinator/admin.yml
Would you like to sync this change to your dotfiles repo?
- Run: chezmoi re-add ~/.config/tmuxinator/admin.yml
- Commit and push to github.com/trentshaines/dotfiles.git
Chezmoi uses special prefixes in the source directory:
dot_ → . (hidden files)dot_zshrc → ~/.zshrcdot_config/ → ~/.config/private_ → Private files (can be encrypted)private_Documents/ → ~/Documents/private_dot_ → Private hidden filesprivate_dot_ssh/ → ~/.ssh/chezmoi managed # List all managed files
chezmoi managed | grep tmux # Find tmux-related managed files
Ansible playbooks in ~/ansible/ define system package installation and configuration. These are managed by chezmoi and synced to the dotfiles repo.
~/ansible/playbooks/packages.yml - Main package installation playbookcd ~/ansible
ansible-playbook playbooks/packages.yml
# Option 1: Re-add ansible directory
chezmoi re-add ~/ansible/
# Option 2: Re-add specific playbook
chezmoi re-add ~/ansible/playbooks/packages.yml
# Then commit and push
cd ~/.local/share/chezmoi
git add ansible/
git commit -m "Update ansible packages playbook"
git push
cd -
name: list under Install brew formulaename: list under Install brew casksname: list under Add brew tapschezmoi re-add ~/.zshrc # Re-add existing managed file
cd ~/.local/share/chezmoi
git add .
git commit -m "Update zshrc: describe changes"
git push
cd -
# EASY: Just re-add the directory (it's already managed!)
chezmoi re-add ~/.config/tmuxinator/
cd ~/.local/share/chezmoi
git add .
git commit -m "Add new tmuxinator template: newtemplate"
git push
cd -
# EASY: Just re-add the directory (it's already managed!)
chezmoi re-add ~/.claude/skills/
cd ~/.local/share/chezmoi
git add .
git status # Verify the new files
git commit -m "Add my-skill Claude skill"
git push
cd -
chezmoi re-add # Re-add all changed managed files
cd ~/.local/share/chezmoi
git add .
git status # Review all changes
git commit -m "Update multiple configs"
git push
cd -
# Re-add managed directories (picks up new AND modified files)
chezmoi re-add ~/.claude/skills/
chezmoi re-add ~/.config/tmuxinator/
# Re-add individual modified files
chezmoi re-add ~/.zshrc
# Then commit everything
cd ~/.local/share/chezmoi
git add .
git status # Review everything
git commit -m "Add new skills and update existing configs"
git push
cd -
chezmoi re-add ~/ansible/playbooks/packages.yml
cd ~/.local/share/chezmoi
git add ansible/
git commit -m "Add fd, btop, oh-my-zsh, TPM, and Claude Code to ansible"
git push
cd -
chezmoi diff # See what would change
cd ~/.local/share/chezmoi && git status # See what's uncommitted
Some config files are NOT tracked (check .chezmoiignore):
chezmoi re-add <file> after modifying managed fileschezmoi diff before applying to see what will changechezmoi managed | grep filename.chezmoiignore for exclusionschezmoi re-add after editingchezmoi diff # See differences
chezmoi apply -v # Apply with verbose output
chezmoi re-add # Or re-add to update source
~/.local/share/chezmoi/chezmoi cd && git log~/.config/tmuxinator/ are managed~/.claude/skills/ are managed via dot_claude/.zshrc is managed as dot_zshrc.gitconfig is managed as dot_gitconfigprivate_ prefixWeekly roundup of top Claude Code skills, MCP servers, and AI coding tips.