chezmoi-reference

Guides editing, templating, and debugging of chezmoi-managed dotfiles source state.

1|Updated May 25, 2020
One-click install
npx skills add https://github.com/titaneric/dotfiles --skill chezmoi-reference-titaneric
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: chezmoi-reference
Source: https://github.com/titaneric/dotfiles/tree/main/.skills/chezmoi-reference
Command: npx skills add https://github.com/titaneric/dotfiles --skill chezmoi-reference-titaneric

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Managing dotfiles with chezmoi involves subtle source-state naming rules, template data handling, script ordering, and public-repo safety concerns that are easy to get wrong, leading to broken applies, leaked secrets, or permission drift. ## Core Features & Use Cases - Source-State Guidance: Explains attributes like dot_, private_, executable_, run_once_, and .tmpl so targets map correctly to home-directory files. - Template and Data Patterns: Covers .chezmoidata files, built-in variables like .chezmoi.os, and functions like toJson and dig for machine-specific configuration. - Safe Apply and Script Workflows: Provides command cheat sheets, script naming conventions, CI dry-run patterns, and acceptance criteria for validating changes. - Use Case: When adding a new machine-specific shell config, use this Skill to decide between a plain source file, a .tmpl template with local data, or an ignored .chezmoidata entry, then verify with chezmoi diff and chezmoi cat before applying. ## Quick Start Ask the assistant to help you add a new templated dotfile to your chezmoi source state and verify it renders correctly before applying.

Frequently Asked Questions about chezmoi-reference

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new dotfile to chezmoi source state?▼

Use `chezmoi add ~/.config/app/config.toml` to add an existing target, or create the source file directly with the `dot_` prefix such as `dot_gitconfig`. Verify the mapping with `chezmoi status` and `chezmoi diff` before applying.

How do I make chezmoi templates machine-specific?▼

Add a `.tmpl` suffix to the source file and use variables like `.chezmoi.os` or values from `.chezmoidata/*.toml` files. Validate rendering with `chezmoi execute-template --file <source>` and `chezmoi cat <target>`.

What is the difference between run_once and run_onchange scripts in chezmoi?▼

run_once_ scripts execute a single time per rendered contents, making them suitable for bootstraps. run_onchange_ scripts rerun whenever their rendered contents or name changes, which fits package installation tasks.

Does the private_ attribute hide file contents from git?▼

No, private_ only sets target file permissions by removing group and world access. File contents remain visible in the repository, so secrets must live in ignored `.chezmoidata/*.toml` files or password manager functions.

How do I test chezmoi changes safely in CI?▼

Run chezmoi with a fake destination such as `chezmoi --source "$PWD" --destination "$RUNNER_TEMP/home" apply --exclude scripts --force`. This renders and applies into a temporary home without touching the real environment or running scripts.

Why is my chezmoi template rendering wrong or failing?▼

Common causes include missing local data keys, incorrect attribute ordering in filenames, or hand-built JSON with comma errors. Debug with `chezmoi data`, `chezmoi execute-template --file`, and prefer `toJson` or `dig` with defaults for safe rendering.