jpskill.com
🛠️ 開発・MCP コミュニティ

dotfiles

複数のPC間で設定ファイルを効率的に同期・管理し、シェル環境のバックアップや整理を自動化するSkill。

📜 元の英語説明(参考)

Dotfile management with stow, chezmoi, or git bare repo for configuration sync across machines. Use when user asks to "manage dotfiles", "sync configs", "setup dotfiles", "backup shell config", or organize configuration files.

🇯🇵 日本人クリエイター向け解説

一言でいうと

複数のPC間で設定ファイルを効率的に同期・管理し、シェル環境のバックアップや整理を自動化するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-17
取得日時
2026-05-17
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

[スキル名] dotfiles

Dotfiles

複数のマシン間で設定ファイルを管理・同期します。

GNU Stow (シンプル)

セットアップ

# インストール
brew install stow  # macOS
apt install stow   # Ubuntu

# dotfiles ディレクトリを作成
mkdir -p ~/dotfiles
cd ~/dotfiles

構造

~/dotfiles/
├── zsh/
│   └── .zshrc
├── git/
│   └── .gitconfig
├── nvim/
│   └── .config/
│       └── nvim/
│           └── init.lua
└── tmux/
    └── .tmux.conf

使用方法

cd ~/dotfiles

# 1つのパッケージをシンボリックリンク
stow zsh

# すべてをシンボリックリンク
stow */

# リンク解除
stow -D zsh

# 再リンク (更新)
stow -R zsh

# 異なるディレクトリをターゲットにする
stow -t ~ zsh

Chezmoi (高度)

セットアップ

# インストール
brew install chezmoi  # または sh -c "$(curl -fsLS get.chezmoi.io)"

# 初期化
chezmoi init

# または既存のリポジトリから
chezmoi init https://github.com/user/dotfiles.git

基本的な使用方法

# ファイルを追加
chezmoi add ~/.zshrc
chezmoi add ~/.config/nvim/init.lua

# 編集
chezmoi edit ~/.zshrc

# 変更を確認
chezmoi diff

# 変更を適用
chezmoi apply

# リポジトリから更新
chezmoi update

テンプレート

# ~/.local/share/chezmoi/dot_gitconfig.tmpl
[user]
    name = {{ .name }}
    email = {{ .email }}

# ~/.config/chezmoi/chezmoi.toml
[data]
    name = "John Doe"
    email = "john@example.com"

シークレット

# 1Password を使用
{{ onepasswordRead "op://Personal/GitHub/token" }}

# pass を使用
{{ pass "github/token" }}

# 値の入力を促す
{{ promptString "Enter API key" }}

Git Bare Repo

セットアップ

# 初期化
git init --bare $HOME/.dotfiles

# エイリアス
alias dotfiles='git --git-dir=$HOME/.dotfiles --work-tree=$HOME'

# トラッキングされていないファイルを無視
dotfiles config --local status.showUntrackedFiles no

使用方法

# ファイルを追加
dotfiles add ~/.zshrc
dotfiles commit -m "Add zshrc"
dotfiles push

# 新しいマシンにクローン
git clone --bare git@github.com:user/dotfiles.git $HOME/.dotfiles
alias dotfiles='git --git-dir=$HOME/.dotfiles --work-tree=$HOME'
dotfiles checkout

シェル設定

# ~/.zshrc または ~/.bashrc に追加
alias dotfiles='git --git-dir=$HOME/.dotfiles --work-tree=$HOME'

共通の Dotfiles

必須ファイル

~/.zshrc or ~/.bashrc    # シェル設定
~/.gitconfig             # Git 設定
~/.ssh/config            # SSH 設定
~/.tmux.conf             # Tmux 設定
~/.config/nvim/          # Neovim 設定
~/.config/starship.toml  # Starship プロンプト

.gitconfig

[user]
    name = Your Name
    email = your@email.com
[alias]
    co = checkout
    br = branch
    ci = commit
    st = status
    lg = log --oneline --graph
[core]
    editor = nvim
[init]
    defaultBranch = main
[pull]
    rebase = true

.zshrc の必須項目

# 履歴
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
setopt SHARE_HISTORY

# エイリアス
alias ll='ls -la'
alias g='git'
alias dc='docker compose'

# パス
export PATH="$HOME/.local/bin:$PATH"

# エディタ
export EDITOR='nvim'

ブートストラップスクリプト

#!/bin/bash
# bootstrap.sh

set -e

# 依存関係をインストール
if [[ "$OSTYPE" == "darwin"* ]]; then
    brew install stow git neovim
fi

# dotfiles をクローン
git clone https://github.com/user/dotfiles.git ~/dotfiles

# すべてを stow
cd ~/dotfiles
for dir in */; do
    stow "$dir"
done

echo "Dotfiles installed!"

ベストプラクティス

  1. バージョン管理: 常に git を使用してください。
  2. README: セットアップ手順を文書化してください。
  3. モジュール化: アプリケーションごとに分離してください。
  4. シークレット: シークレットをコミットしないでください。テンプレートまたはシークレットマネージャーを使用してください。
  5. ブートストラップ: 新しいマシン用のセットアップスクリプトを作成してください。
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Dotfiles

Manage and sync configuration files across machines.

GNU Stow (Simple)

Setup

# Install
brew install stow  # macOS
apt install stow   # Ubuntu

# Create dotfiles directory
mkdir -p ~/dotfiles
cd ~/dotfiles

Structure

~/dotfiles/
├── zsh/
│   └── .zshrc
├── git/
│   └── .gitconfig
├── nvim/
│   └── .config/
│       └── nvim/
│           └── init.lua
└── tmux/
    └── .tmux.conf

Usage

cd ~/dotfiles

# Symlink one package
stow zsh

# Symlink all
stow */

# Unlink
stow -D zsh

# Restow (update)
stow -R zsh

# Target different directory
stow -t ~ zsh

Chezmoi (Advanced)

Setup

# Install
brew install chezmoi  # or sh -c "$(curl -fsLS get.chezmoi.io)"

# Initialize
chezmoi init

# Or from existing repo
chezmoi init https://github.com/user/dotfiles.git

Basic Usage

# Add file
chezmoi add ~/.zshrc
chezmoi add ~/.config/nvim/init.lua

# Edit
chezmoi edit ~/.zshrc

# See changes
chezmoi diff

# Apply changes
chezmoi apply

# Update from repo
chezmoi update

Templates

# ~/.local/share/chezmoi/dot_gitconfig.tmpl
[user]
    name = {{ .name }}
    email = {{ .email }}

# ~/.config/chezmoi/chezmoi.toml
[data]
    name = "John Doe"
    email = "john@example.com"

Secrets

# Use 1Password
{{ onepasswordRead "op://Personal/GitHub/token" }}

# Use pass
{{ pass "github/token" }}

# Prompt for value
{{ promptString "Enter API key" }}

Git Bare Repo

Setup

# Initialize
git init --bare $HOME/.dotfiles

# Alias
alias dotfiles='git --git-dir=$HOME/.dotfiles --work-tree=$HOME'

# Ignore untracked
dotfiles config --local status.showUntrackedFiles no

Usage

# Add files
dotfiles add ~/.zshrc
dotfiles commit -m "Add zshrc"
dotfiles push

# Clone to new machine
git clone --bare git@github.com:user/dotfiles.git $HOME/.dotfiles
alias dotfiles='git --git-dir=$HOME/.dotfiles --work-tree=$HOME'
dotfiles checkout

Shell Config

# Add to ~/.zshrc or ~/.bashrc
alias dotfiles='git --git-dir=$HOME/.dotfiles --work-tree=$HOME'

Common Dotfiles

Essential Files

~/.zshrc or ~/.bashrc    # Shell config
~/.gitconfig             # Git config
~/.ssh/config            # SSH config
~/.tmux.conf             # Tmux config
~/.config/nvim/          # Neovim config
~/.config/starship.toml  # Starship prompt

.gitconfig

[user]
    name = Your Name
    email = your@email.com
[alias]
    co = checkout
    br = branch
    ci = commit
    st = status
    lg = log --oneline --graph
[core]
    editor = nvim
[init]
    defaultBranch = main
[pull]
    rebase = true

.zshrc Essentials

# History
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
setopt SHARE_HISTORY

# Aliases
alias ll='ls -la'
alias g='git'
alias dc='docker compose'

# Path
export PATH="$HOME/.local/bin:$PATH"

# Editor
export EDITOR='nvim'

Bootstrap Script

#!/bin/bash
# bootstrap.sh

set -e

# Install dependencies
if [[ "$OSTYPE" == "darwin"* ]]; then
    brew install stow git neovim
fi

# Clone dotfiles
git clone https://github.com/user/dotfiles.git ~/dotfiles

# Stow all
cd ~/dotfiles
for dir in */; do
    stow "$dir"
done

echo "Dotfiles installed!"

Best Practices

  1. Version control: Always use git
  2. README: Document setup steps
  3. Modular: Separate by application
  4. Secrets: Never commit secrets; use templates or secret managers
  5. Bootstrap: Create setup script for new machines