chezmoi-workflows
Dotfile backup and sync with chezmoi. TRIGGERS - chezmoi, dotfiles, sync dotfiles, backup configs, cross-machine sync.
What this skill does
# Chezmoi Workflows > **Self-Evolving Skill**: This skill improves through use. If instructions are wrong, parameters drifted, or a workaround was needed — fix this file immediately, don't defer. Only update for real, reproducible issues. ## When to Use This Skill Use this skill when: - Backing up dotfiles to Git repository - Syncing configuration files across machines - Tracking changes to shell configs, editor settings, or other dotfiles - Managing templated configurations with chezmoi - Troubleshooting dotfile drift between source and target ## Architecture | Component | Location | Purpose | | ---------- | -------------------------------- | ------------------------------------- | | **Source** | `$(chezmoi source-path)` | Git repository with dotfile templates | | **Target** | `~/` | Home directory (deployed files) | | **Remote** | GitHub (private recommended) | Cross-machine sync and backup | | **Config** | `~/.config/chezmoi/chezmoi.toml` | User preferences and settings | --- ## 1. Status Check ```bash chezmoi source-path # Show source directory chezmoi git -- remote -v # Show GitHub remote chezmoi status # Show drift between source and target chezmoi managed | wc -l # Count tracked files ``` --- ## 2. Track File Changes After editing a config file, add it to chezmoi: ```bash chezmoi status # 1. Verify file shows as modified chezmoi diff ~/.zshrc # 2. Review changes chezmoi add ~/.zshrc # 3. Add to source (auto-commits if configured) chezmoi git -- log -1 --oneline # 4. Verify commit created chezmoi git -- push # 5. Push to remote ``` --- ## 3. Track New File Add a previously untracked config file: ```bash chezmoi add ~/.config/app/config.toml # 1. Add file to source chezmoi managed | grep app # 2. Verify in managed list chezmoi git -- push # 3. Push to remote ``` --- ## 4. Sync from Remote Pull changes from GitHub and apply to home directory: ```bash chezmoi update # 1. Pull + apply (single command) chezmoi verify # 2. Verify all files match source chezmoi status # 3. Confirm no drift ``` --- ## 5. Push All Changes Bulk sync all modified tracked files to remote: ```bash chezmoi status # 1. Review all drift chezmoi re-add # 2. Re-add all managed files (auto-commits) chezmoi git -- push # 3. Push to remote ``` --- ## 6. First-Time Setup ### Install chezmoi ```bash brew install chezmoi # macOS ``` ### Initialize (fresh start) ```bash /usr/bin/env bash << 'CONFIG_EOF' chezmoi init # Create empty source chezmoi add ~/.zshrc ~/.gitconfig # Add first files gh repo create dotfiles --private --source="$(chezmoi source-path)" --push CONFIG_EOF ``` ### Initialize (clone existing) ```bash chezmoi init [email protected]:<user>/dotfiles.git chezmoi apply # Deploy to home directory ``` --- ## 7. Configure Source Directory Move source to custom location (e.g., for multi-account SSH): ```bash /usr/bin/env bash << 'SKILL_SCRIPT_EOF' mv "$(chezmoi source-path)" ~/path/to/dotfiles SKILL_SCRIPT_EOF ``` Edit `~/.config/chezmoi/chezmoi.toml`: ```toml sourceDir = "~/path/to/dotfiles" ``` Verify: ```bash chezmoi source-path # Should show new location ``` --- ## 8. Change Remote Switch to different GitHub account or repository: ```bash chezmoi git -- remote -v # View current chezmoi git -- remote set-url origin [email protected]:<user>/<repo>.git # Change chezmoi git -- push -u origin main # Push to new remote ``` --- ## 9. Resolve Merge Conflicts ```bash /usr/bin/env bash << 'GIT_EOF' chezmoi git -- status # 1. Identify conflicted files chezmoi git -- diff # 2. Review conflicts # Manually edit files in $(chezmoi source-path) chezmoi git -- add <resolved-files> # 3. Stage resolved files chezmoi git -- commit -m "Resolve merge conflict" chezmoi apply # 4. Apply to home directory chezmoi git -- push # 5. Push resolution GIT_EOF ``` --- ## 10. Validation (SLO) After major operations, verify system state: ```bash chezmoi verify # Exit 0 = all files match source chezmoi diff # Empty = no drift chezmoi managed # Lists all tracked files chezmoi git -- log --oneline -3 # Recent commit history ``` --- ## 11. Forget (Untrack) a File Stop tracking a file without deleting it from home directory: ```bash chezmoi managed | grep config.local # 1. Confirm file is tracked chezmoi forget --force ~/.config/app/config.local.toml # 2. Remove from source (--force skips TTY prompt) chezmoi git -- push # 3. Push removal to remote ls ~/.config/app/config.local.toml # 4. Verify file still exists in home ``` **When to use**: Machine-specific configs, files with secrets that shouldn't be synced, files accidentally added. --- ## 12. Template Management Create OS/architecture-conditional configs using Go templates: ### Convert existing file to template ```bash chezmoi add --template ~/.config/app/config.toml # 1. Add as template (creates .tmpl suffix in source) chezmoi edit ~/.config/app/config.toml # 2. Edit template in $EDITOR (helix) chezmoi diff ~/.config/app/config.toml # 3. Preview what would change chezmoi apply ~/.config/app/config.toml # 4. Apply rendered template to home ``` ### Common template patterns ``` # OS-conditional block {{ if eq .chezmoi.os "darwin" -}} export HOMEBREW_PREFIX="/opt/homebrew" {{ else if eq .chezmoi.os "linux" -}} export HOMEBREW_PREFIX="/home/linuxbrew/.linuxbrew" {{ end -}} # Architecture-conditional {{ if eq .chezmoi.arch "arm64" -}} ARCH="aarch64" {{ else -}} ARCH="x86_64" {{ end -}} # Custom data from chezmoi.toml [data] section git_name = "{{ .git.name }}" git_email = "{{ .git.email }}" # 1Password secret (requires op CLI) api_key = {{ onepasswordRead "op://Vault/Item/Field" }} ``` ### Verify template renders correctly ```bash chezmoi execute-template < "$(chezmoi source-path)/dot_config/app/config.toml.tmpl" chezmoi cat ~/.config/app/config.toml # Show rendered output without applying ``` --- ## 13. Safe Update (Diff Before Apply) Pull from remote with review step — safer than blind `chezmoi update`: ```bash chezmoi git -- pull # 1. Pull source changes only (no apply) chezmoi diff # 2. Review what WOULD change in home directory chezmoi apply --dry-run --verbose # 3. Dry run — shows actions without executing chezmoi apply # 4. Apply after review chezmoi status # 5. Confirm clean state ``` **When to use**: When pulling changes made on another machine, or after a long gap between syncs. Avoids surprise overwrites of local edits. --- ## 14. Doctor (Diagnostic) Troubleshoot chezmoi setup and environment: ```bash chezmoi doctor # Full diagnostic — checks all components ``` **Key fields to verify**: | Check | Expected | Meaning if failing | | ------------ | ---------------------------------------------- | ---------------------------------- | | config-file | `found ~/.config/chezmoi/chezmoi.toml` | Config missing or wrong path | | source-dir | `~/own/dotfiles is a git working tree (clean)` | Source dirty or not a git repo | | git-command | `found /opt/homebr
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.