Token导航 LogoToken导航TokenDH.com
研究检索敏感数据github未标认证来源可访问许可证需确认审计异常

chezmoi-config切兹莫伊配置

Agent Skill

chezmoi-config 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

1,273

周安装

52

GitHub Stars

公开资料未说明

下载量

408
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:chezmoi-config(切兹莫伊配置)
来源仓库:https://github.com/faintghost/skills
仓库路径:skills/chezmoi-config
安装命令:
npx skills add https://github.com/faintghost/skills --skill chezmoi-config
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/faintghost/skills --skill chezmoi-config

简介

chezmoi-config 提供 chezmoi dotfile 的综合配置管理指南。

  • 涵盖模板、脚本、外部资源和高级设置。
  • 仅读验证,禁止直接修改环境。
  • 需确认是否允许查看系统文件和运行只读检查。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Chezmoi Configuration Management

Comprehensive guide for managing chezmoi dotfiles with templates, scripts, external resources, and advanced configurations.

⚠️ Safety Constraints

This skill is READ-ONLY and validation-only. It MUST NOT modify your actual environment.

Forbidden Operations

NEVER execute these commands - they will modify your system:

  • chezmoi apply - Applies changes to your home directory
  • chezmoi apply --force - Forcefully applies changes
  • chezmoi update - Updates source state and may change managed files
  • Any operations that directly execute scripts (scripts run automatically during chezmoi apply)

Allowed Safe Operations

ONLY use these read-only validation commands:

  • chezmoi diff - Preview what would change (safe)
  • chezmoi apply --dry-run - Simulate changes without applying (safe)
  • chezmoi doctor - Check configuration validity (safe)
  • chezmoi data - Display template data variables (safe)
  • chezmoi managed - List files currently managed by chezmoi (read-only, safe)
  • chezmoi unmanaged - List files currently unmanaged by chezmoi (read-only, safe)
  • chezmoi ignored - List files ignored by chezmoi (read-only, safe)
  • chezmoi execute-template < file.tmpl - Preview expanded template output (safe)
  • chezmoi state dump - View script execution state (safe)
  • chezmoi verify - Verify source state integrity (safe)
  • chezmoi cd - Enter source directory (safe)
  • chezmoi source-path - Show source directory path (safe)

User Responsibility

This skill helps you create and validate chezmoi configurations. To apply changes, you must manually run chezmoi apply in your terminal after reviewing the output.

Quick Start

Creating a New Template

  1. Add existing file as template: chezmoi add --template ~/.gitconfig
  2. Or create manually: chezmoi cd $EDITOR dot_gitconfig.tmpl
  3. Use Go template syntax: [user] name = {{.name}} {{- if eq.chezmoi.os "darwin"}} [credential] helper = osxkeychain {{- end}}

Managing External Resources

Create .chezmoiexternal.toml.tmpl:

[".oh-my-zsh"]
    type = "archive"
    url = "https://github.com/ohmyzsh/ohmyzsh/archive/master.tar.gz"
    exact = true
    stripComponents = 1

Writing Scripts

Create run_onchange_install-packages.sh.tmpl:

{{ if eq .chezmoi.os "darwin" -}}
#!/bin/bash
brew install git vim ripgrep
{{ end -}}

Reference Documentation

This skill includes comprehensive reference documentation. Consult these guides for detailed information:

Common Tasks

1. Create Platform-Specific Configuration

Template file (dot_gitconfig.tmpl):

[user]
    name = {{ .name }}
    email = {{ .email }}

{{- if eq .chezmoi.os "darwin" }}
[credential]
    helper = osxkeychain
{{- else if eq .chezmoi.os "linux" }}
[credential]
    helper = cache
{{- end }}

Configuration (chezmoi.toml):

[data]
    name = "John Doe"
    email = "john@example.com"

2. Manage Secrets with Password Managers

{{- if (bitwarden "github") }}
[github]
    token = {{ (bitwarden "github").login.password }}
{{- end }}

3. Install Packages Conditionally

run_onchange_install-packages.sh.tmpl:

{{ if eq .chezmoi.os "darwin" -}}
#!/bin/bash
brew bundle --file=/dev/stdin <<EOF
{{ range .packages.darwin.brews -}}
brew "{{ . }}"
{{ end -}}
EOF
{{ else if eq .chezmoi.os "linux" -}}
#!/bin/bash
sudo apt install -y {{ range .packages.linux }}{{ . }} {{ end }}
{{ end -}}

.chezmoidata/packages.yaml:

darwin:
  brews:
    - git
    - vim
    - ripgrep

linux:
  - git
  - vim
  - ripgrep
  - fd-find

4. Include External Resources

.chezmoiexternal.toml.tmpl:

[".vim/autoload/plug.vim"]
    type = "file"
    url = "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim"

[".oh-my-zsh"]
    type = "archive"
    url = "https://github.com/ohmyzsh/ohmyzsh/archive/master.tar.gz"
    exact = true
    stripComponents = 1
    refreshPeriod = "168h"

[".local/bin/age"]
    type = "archive-file"
    url = "https://github.com/FiloSottile/age/releases/download/v1.1.1/age-v1.1.1-{{ .chezmoi.os }}-{{ .chezmoi.arch }}.tar.gz"
    path = "age/age"
    executable = true

5. Configure Interactive Prompts

.chezmoi.toml.tmpl:

{{- $editor := promptChoice "favorite editor" ["vim" "neovim" "vscode"] -}}
[data]
    name = "{{ promptString "your name" }}"
    email = "{{ promptString "your email" }}"
    editor = {{ $editor }}

{{ if promptBool "enable work config?" -}}
[data.work]
    enabled = true
    work_email = "{{ promptString "work email" }}"
{{ end }}

6. Ignore Files Conditionally

.chezmoiignore (template-aware):

README.md
*.log

{{- if ne .chezmoi.hostname "work-laptop" }}
.work
{{- end }}

{{- if eq .chezmoi.os "windows" }}
Documents/*
!Documents/*PowerShell/
{{- end }}

7. Interpret chezmoi managed / chezmoi unmanaged Output (Config Files)

When reviewing chezmoi unmanaged, note that the *destination* config file is ~/.config/chezmoi/chezmoi.toml, while the *source* is typically managed as a template such as dot_config/chezmoi/chezmoi.toml.tmpl (or private_dot_config/chezmoi/chezmoi.toml.tmpl) in the chezmoi source state.

If ~/.config/chezmoi appears as unmanaged:

  • First check chezmoi managed to confirm whether the config file is already managed in source.
  • If it is not managed, add it as a template and manage it in source (recommended when you maintain machine-specific values in chezmoi.toml).

8. Manage run_once Scripts

run_once_000-bootstrap.sh.tmpl:

#!/bin/bash
{{ if eq .chezmoi.os "darwin" -}}
if ! command -v brew &> /dev/null; then
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
{{ end -}}

Reset run_once state:

# Clear all run_once script state
chezmoi state delete-bucket --bucket=scriptState

Built-in Variables

Commonly used chezmoi variables available in all templates:

VariableDescriptionExample
.chezmoi.osOperating systemlinux, darwin, windows
.chezmoi.archArchitectureamd64, arm64
.chezmoi.hostnameMachine hostnamemy-laptop
.chezmoi.usernameCurrent userjohn
.chezmoi.homeDirHome directory/home/john
.chezmoi.sourceDirSource state directory/home/john/.local/share/chezmoi
.chezmoi.env.VAREnvironment variables.chezmoi.env.EDITOR

Template Syntax Reference

Conditionals

{{ if eq .chezmoi.os "darwin" }}
# macOS-specific
{{ else if eq .chezmoi.os "linux" }}
# Linux-specific
{{ end }}

Loops

{{ range .packages.darwin.brews -}}
brew "{{ . }}"
{{ end -}}

String Operations

{{ .name | quote }}          # Add quotes
{{ .chezmoi.homeDir }}        # No trimming
{{- "content" -}}            # Trim whitespace

Best Practices

  1. Use templates for cross-platform configs - Leverage .chezmoi.os, .chezmoi.arch
  2. Store secrets in password managers - Never hardcode sensitive data
  3. Make scripts idempotent - Safe to run multiple times
  4. Use descriptive filenames - run_once_000-bootstrap.sh.tmpl
  5. Test templates locally - Use chezmoi execute-template < file.tmpl
  6. Organize.chezmoidata - Separate concerns into multiple files
  7. Document dependencies - Comment complex configurations
  8. Use appropriate refresh periods - Balance freshness and bandwidth

Consulting Latest Documentation

This skill can consult the latest chezmoi documentation via Context7 to ensure accuracy:

# When in doubt, ask for the latest docs
"Check the chezmoi documentation for [topic]"

If the question involves .tmpl behavior (especially .chezmoiignore{,.tmpl}), prefer checking the official docs first.

Useful Commands

# ⚠️ FORBIDDEN - Apply all changes (must run manually)
chezmoi apply

# Dry run (preview changes) - SAFE
chezmoi apply --dry-run

# ⚠️ FORBIDDEN - Update source state (may change managed files)
chezmoi update

# Edit source state - SAFE
chezmoi cd

# Add file as template - SAFE
chezmoi add --template ~/.config/file

# Verify configuration - SAFE
chezmoi doctor

# View all template data - SAFE
chezmoi data

# List ignored files - SAFE
chezmoi ignored

# Test template (preview output) - SAFE
chezmoi execute-template < ~/.local/share/chezmoi/dot_file.tmpl

# View run_once state - SAFE
chezmoi state dump

# Clear run_once script state (use with caution) - SAFE
chezmoi state delete-bucket --bucket=scriptState

# Clear run_onchange script state (use with caution) - SAFE
chezmoi state delete-bucket --bucket=entryState

# See what would change - SAFE
chezmoi diff

# Verify files match expected state - SAFE
chezmoi verify

File Structure

Standard chezmoi source state structure:

~/.local/share/chezmoi/
├── .chezmoi.toml.tmpl          # Main configuration (optional)
├── .chezmoiexternal.toml.tmpl   # External resources (optional)
├── .chezmoiignore.tmpl          # Ignore rules (template-aware, optional)
├── .chezmoidata/
│   ├── packages.yaml            # Custom data
│   └── work.yaml
├── dot_gitconfig.tmpl           # Regular templates
├── dot_zshrc.tmpl
├── run_once_000-bootstrap.sh.tmpl
├── run_onchange_install-packages.sh.tmpl
└── run_after_dot_vimrc.sh.tmpl

Debugging

注意:调试时也不要执行 chezmoi update,如需检查变更请用 chezmoi diffchezmoi apply --dry-run

Verbose output:

chezmoi apply --verbose

Check what would change:

chezmoi diff

Validate configuration:

chezmoi doctor

See expanded template:

chezmoi execute-template < template-file

When to Use This Skill

Use this skill whenever you're:

  • Creating new chezmoi templates with Go syntax
  • Modifying existing.chezmoi configuration files
  • Managing.chezmoiignore/.chezmoiignore.tmpl rules
  • Setting up.chezmoiexternal for external resources
  • Writing run_once/run_onchange scripts
  • Integrating password managers for secrets
  • Managing cross-platform dotfiles
  • Debugging template issues
  • Organizing.chezmoidata files

For specific concerns, refer to the detailed reference documentation listed above.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

33.85%
按下载量换算138

Claude

31.2%
按下载量换算127

Cursor

17.62%
按下载量换算72

Gemini CLI

9.64%
按下载量换算39

安全审计

Gen Agent Trust Hub

未通过

Socket

通过

Snyk

可疑

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills