agentleFS
cosgrovebcosgroveb/chezmoi-skill/SKILL.md

chezmoi

Skill2 starsChanged 10 months agoMITView on GitHub

Manage dotfiles with chezmoi. Use when working with dotfiles, chezmoi templates, machine-specific configuration, syncing configs across machines, or when the user mentions chezmoi, dotfiles, or configuration management.

5 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions5 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 5

    1. fmind/dot★ 13same name
    2. fmind/dotfiles★ 13same name
    3. es6kr/skills★ 2same name
    4. hpehl/skills★ 1same name
    5. iiiburnyiii/agent-skills★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

The file

Show its rules and text

We split this skill into the rules it gives an agent

13 rules. About 0 are common, 3 are distinctive, and 10 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 10

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When the user asks about dotfiles or chezmoi operations, implement the changes directly using chezmoi commands rather than only suggesting …

    line 17
  2. Very specific:

    Always preview significant changes with chezmoi diff or chezmoi cat <file> before applying.

    line 19
  3. Very specific:

    When the target file itself uses {{ }} syntax (like mise, Jinja2, or Tera templates), escape the braces so chezmoi doesn't process them as …

    line 81
  4. Very specific:

    Use .chezmoiremove to clean up dotfiles that chezmoi should remove from your system:

    line 91
  5. Distinctive:

    When converting a static config to machine-specific template:

    line 136
  6. Distinctive:

    Read the current file to understand its contents

    line 138
  7. Very specific:

    Run chezmoi add --template <file> to add as template

    line 140
  8. Very specific:

    Removing managed files: Use .chezmoiremove to clean up files (see "Removing Files" section)

    line 147
  9. Very specific:

    Always preview: Run chezmoi cat <file> before applying templates

    line 148
  10. Very specific:

    Template errors: Use chezmoi execute-template '{{ .chezmoi.os }}' to test template snippets

    line 150
  11. Very specific:

    Template syntax errors: Test small snippets with chezmoi execute-template '{{ .chezmoi.os }}'

    line 154
  12. Very specific:

    File not applying: Check chezmoi status and chezmoi diff to see what changes are pending

    line 156
  13. Very specific:

    Permission errors: Verify file has correct prefix (private_ for 600, executable_ for 755)

    line 160

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Chezmoi Dotfiles Management

Action Guidance

When the user asks about dotfiles or chezmoi operations, implement the changes directly using chezmoi commands rather than only suggesting them. If the user says "make this work on macOS only" or "add my bashrc to chezmoi", proceed with implementation.

Always preview significant changes with chezmoi diff or chezmoi cat <file> before applying.

Commands

chezmoi add <file>           # Add file to chezmoi
chezmoi apply --refresh-externals --force  # Apply changes (always use these flags)
chezmoi diff                 # Preview what would change
chezmoi cat <file>           # Preview rendered template output
chezmoi data                 # Show available template variables
chezmoi edit <file>          # Edit source file
chezmoi edit ~/.local/share/chezmoi/.chezmoiremove  # Edit removal list

File Naming

Prefix/SuffixEffect
dot_Installed as . (dot_gitconfig → ~/.gitconfig)
private_Restrictive permissions (600)
executable_Executable permissions (755)
.tmplProcessed as Go template
symlink_Creates symlink

Machine-Specific Templates

Convert a static file to a template by renaming with .tmpl suffix, then use conditionals:

By OS

{{- if eq .chezmoi.os "darwin" }}
# macOS config
{{- end }}

{{- if eq .chezmoi.os "linux" }}
# Linux config
{{- end }}

By hostname

{{- if hasPrefix .chezmoi.hostname "work-" }}
# work machine config
{{- end }}

By environment variable

{{- if env "WORK_ENV" }}
# when WORK_ENV is set
{{- end }}

Combined conditions

{{- if or (eq .chezmoi.os "darwin") (env "WORK_ENV") }}
# macOS or when WORK_ENV is set
{{- end }}

Escaping Nested Templates

When the target file itself uses {{ }} syntax (like mise, Jinja2, or Tera templates), escape the braces so chezmoi doesn't process them as Go template syntax:

SOME_VAR = "{{ "{{" }}env.OTHER_VAR{{ "}}" }}"

This renders as SOME_VAR = "{{env.OTHER_VAR}}" in the output. The {{ "{{" }} and {{ "}}" }} are Go template expressions that output literal brace characters.

Removing Files

Use .chezmoiremove to clean up dotfiles that chezmoi should remove from your system:

# Create .chezmoiremove file listing targets to remove
cat > ~/.local/share/chezmoi/.chezmoiremove << 'EOF'
~/.old-config
~/.deprecated-rc
EOF

# Preview what would be removed
chezmoi diff

# Apply to remove the files
chezmoi apply --refresh-externals --force

Template-based removal (.chezmoiremove.tmpl)

Conditionally remove files based on system variables:

{{- if eq .chezmoi.os "darwin" }}
~/.linux-only-config
{{- end }}

{{- if not (env "WORK_ENV") }}
~/.work-config
{{- end }}

The file is always processed as a template, even without the .tmpl extension.

External Dependencies

Manage external git repos in .chezmoiexternal.toml:

[".zsh/plugins/some-plugin"]
    type = "git-repo"
    url = "https://github.com/user/some-plugin.git"
    refreshPeriod = "168h"

Workflow: Converting Static File to Template

When converting a static config to machine-specific template:

  1. Read the current file to understand its contents
  2. Identify machine-specific values (paths, hostnames, environment-specific settings)
  3. Run chezmoi add --template <file> to add as template
  4. Edit the template source to add conditionals (see "Machine-Specific Templates")
  5. Preview with chezmoi cat <file> to verify rendering on this machine
  6. Apply with chezmoi apply --refresh-externals --force

Gotchas

  1. Removing managed files: Use .chezmoiremove to clean up files (see "Removing Files" section)
  2. Always preview: Run chezmoi cat <file> before applying templates
  3. Always use --refresh-externals --force flags: Critical because --refresh-externals ensures external git repos and archives update, and --force prevents interactive TTY prompts that would block execution (Claude cannot respond to interactive prompts)
  4. Template errors: Use chezmoi execute-template '{{ .chezmoi.os }}' to test template snippets

Troubleshooting

Template syntax errors: Test small snippets with chezmoi execute-template '{{ .chezmoi.os }}'

File not applying: Check chezmoi status and chezmoi diff to see what changes are pending

External not refreshing: The refresh period might not have elapsed; use --refresh-externals flag to force refresh

Permission errors: Verify file has correct prefix (private_ for 600, executable_ for 755)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.