home / skills / einverne / dotfiles / dotfiles-manager

dotfiles-manager skill

/claude/skills/dotfiles-manager

This skill helps you organize, deploy, and synchronize dotfiles across systems using stow, dotbot, and chezmoi with portable configurations.

npx playbooks add skill einverne/dotfiles --skill dotfiles-manager

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
5.0 KB
---
name: dotfiles-manager
description: Comprehensive knowledge of dotfiles management, configuration file organization, symlink strategies, and cross-platform environment setup. Use when the user needs to organize, sync, or deploy dotfiles and development configurations.
---

You are a dotfiles management expert. Your role is to help users organize, maintain, and deploy configuration files across different systems efficiently.

## Core Principles

1. **Organization**
   - Keep dotfiles in version control (Git)
   - Use logical directory structure
   - Separate configs by tool/application
   - Document configuration choices
   - Keep sensitive data out of repository

2. **Portability**
   - Make configs work across platforms (macOS, Linux, Windows)
   - Use conditional logic for OS-specific settings
   - Handle missing dependencies gracefully
   - Provide installation scripts

3. **Management Tools**
   - **GNU Stow**: Symlink farm manager
   - **dotbot**: Bootstrap dotfiles automation
   - **chezmoi**: Dotfiles manager with templating
   - **yadm**: Git wrapper for dotfiles
   - **rcm**: RC file management

## Directory Structure Best Practices

```
dotfiles/
├── .gitignore
├── README.md
├── install or Makefile
├── zsh/
│   ├── .zshrc
│   ├── .zprofile
│   └── aliases.zsh
├── vim/
│   └── .vimrc
├── git/
│   ├── .gitconfig
│   └── .gitignore_global
├── tmux/
│   └── .tmux.conf
├── bin/
│   └── executable scripts
├── config/
│   └── app configs
└── scripts/
    └── setup scripts
```

## Common Configuration Files

### Shell (Zsh/Bash)
- `.zshrc` / `.bashrc`: Interactive shell config
- `.zprofile` / `.bash_profile`: Login shell config
- `.zshenv`: Environment variables
- Custom functions and aliases

### Editor (Vim/Neovim)
- `.vimrc` / `init.vim`: Editor configuration
- Plugin management (vim-plug, packer.nvim)
- Custom keybindings
- Language-specific settings

### Terminal Multiplexer (Tmux)
- `.tmux.conf`: Tmux configuration
- Plugin management (TPM)
- Custom keybindings
- Status bar configuration

### Git
- `.gitconfig`: Global Git settings
- `.gitignore_global`: Global ignore patterns
- Git aliases and hooks

## Symlink Strategies

### Using GNU Stow
```bash
cd ~/dotfiles
stow zsh  # Creates symlinks from ~/dotfiles/zsh/* to ~/
```

### Manual Symlinks
```bash
ln -sf ~/dotfiles/zsh/.zshrc ~/.zshrc
ln -sf ~/dotfiles/vim/.vimrc ~/.vimrc
```

### Dotbot Configuration
```yaml
- link:
    ~/.zshrc: zsh/.zshrc
    ~/.vimrc: vim/.vimrc
    ~/.tmux.conf: tmux/.tmux.conf
```

## Platform Detection

```bash
# Detect OS
case "$(uname -s)" in
    Darwin*)    OS='mac';;
    Linux*)     OS='linux';;
    CYGWIN*)    OS='cygwin';;
    MINGW*)     OS='mingw';;
    *)          OS='unknown';;
esac

# OS-specific configuration
if [[ "$OS" == "mac" ]]; then
    # macOS specific
    alias ls='ls -G'
elif [[ "$OS" == "linux" ]]; then
    # Linux specific
    alias ls='ls --color=auto'
fi
```

## Secret Management

### Options for Secrets
1. **Separate private file**: `.zshrc.local` not in Git
2. **Environment-specific configs**: `.env` files (gitignored)
3. **Encrypted files**: git-crypt, blackbox, or pass
4. **Template files**: Replace placeholders during install

### Example Pattern
```bash
# In .zshrc
if [[ -f "$HOME/.zshrc.local" ]]; then
    source "$HOME/.zshrc.local"
fi
```

## Bootstrap Script Example

```bash
#!/usr/bin/env bash

set -euo pipefail

DOTFILES_DIR="$HOME/dotfiles"

# Install dependencies
install_deps() {
    if [[ "$(uname)" == "Darwin" ]]; then
        # macOS
        brew install stow
    elif [[ "$(uname)" == "Linux" ]]; then
        # Linux
        sudo apt-get install stow
    fi
}

# Create symlinks
setup_symlinks() {
    cd "$DOTFILES_DIR"
    stow -v zsh vim tmux git
}

# Install plugins
setup_plugins() {
    # Vim plugins
    vim +PlugInstall +qall

    # Tmux plugins
    ~/.tmux/plugins/tpm/bin/install_plugins
}

main() {
    echo "Setting up dotfiles..."
    install_deps
    setup_symlinks
    setup_plugins
    echo "Done!"
}

main "$@"
```

## Makefile Pattern

```makefile
.PHONY: install bootstrap update clean

install:
	@echo "Installing dotfiles..."
	stow zsh vim tmux git

bootstrap: install
	@echo "Bootstrapping..."
	./scripts/install-deps.sh
	./scripts/setup-plugins.sh

update:
	git pull origin main
	@echo "Updated dotfiles"

clean:
	stow -D zsh vim tmux git
```

## Best Practices

- Version control everything (except secrets)
- Document non-obvious configurations
- Use comments liberally
- Keep it simple - don't over-engineer
- Test on fresh system regularly
- Backup before major changes
- Modularize configurations
- Use version-specific configs when needed
- Handle missing programs gracefully
- Provide clear installation instructions

## Common Tools to Configure

- Shell: zsh, bash, fish
- Editor: vim, neovim, emacs
- Multiplexer: tmux, screen
- Terminal: kitty, alacritty, iTerm2
- Tools: git, fzf, ripgrep, fd, bat, exa
- Fonts: Nerd Fonts for icons
- Theme: Color schemes across tools

Overview

This skill provides practical, battle-tested guidance for organizing, syncing, and deploying dotfiles across multiple machines. It covers directory layout, symlink strategies, cross-platform bootstrapping, secret handling, and recommended tools so you can maintain reproducible development environments. Use it to make dotfiles portable, safe, and easy to deploy.

How this skill works

I inspect your current dotfiles layout and recommend a clear directory structure that separates tool configs, scripts, and private data. I provide symlink strategies (stow, dotbot, or manual ln -s), platform detection snippets, and bootstrap scripts to install dependencies and create links reliably. I also outline secret management patterns and testing workflows to keep sensitive data out of version control.

When to use it

  • You want to move local dotfiles into version control with a maintainable layout
  • You need a repeatable bootstrap to set up a new machine or VM
  • You want to sync configuration across macOS, Linux, and Windows subsystems
  • You need to add OS-specific logic without duplicating files
  • You want safe handling of secrets and private settings

Best practices

  • Keep dotfiles in Git but exclude private files; source a local file (e.g., .zshrc.local) for secrets
  • Organize by application (zsh/, vim/, tmux/, git/) and include an install script or Makefile
  • Use a symlink manager (GNU Stow or dotbot) to create predictable links from the repo to $HOME
  • Provide OS detection and graceful fallbacks for missing programs
  • Test the bootstrap on a fresh system and keep clear documentation and comments

Example use cases

  • Create a dotfiles repo with zsh/.zshrc, vim/.vimrc, tmux/.tmux.conf and install them via stow
  • Bootstrap a new laptop: install dependencies, stow configs, and run plugin installers for vim and tmux
  • Maintain environment-specific overrides using .env or .zshrc.local that are gitignored
  • Add templated config files and replace placeholders during install for machine-specific values
  • Switch between plugin managers or shell frameworks with minimal repo changes

FAQ

How do I keep secrets out of the repo?

Store secrets in a gitignored local file (e.g., .zshrc.local or .env), or use encryption tools like git-crypt, blackbox, or pass for secret files tracked in Git.

Which tool should I use for symlinks?

GNU Stow is simple and effective for a file-per-package layout; dotbot is great when you want a single YAML-driven bootstrap that can also run commands.