home / skills / tdhopper / dotfiles2.0 / managing-work-dotfiles

managing-work-dotfiles skill

/.claude/skills/managing-work-dotfiles

This skill helps you manage work-specific dotfiles with a dedicated bare repository, enabling safe pulling, committing, and pushing of changes.

npx playbooks add skill tdhopper/dotfiles2.0 --skill managing-work-dotfiles

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

Files (1)
SKILL.md
3.9 KB
---
name: managing-work-dotfiles
description: Use this skill when working with work-specific dotfiles managed by yadm-work. This includes pulling remote changes, committing and pushing work dotfile changes, modifying work configuration files, viewing tracked work files, resolving merge conflicts, and maintaining the work dotfiles repository at Spotify GHE. Triggers on "work dotfiles", "yadm-work", "spotify dotfiles", or work-related config management.
---

# Managing Work Dotfiles

This skill manages work-specific dotfiles using a separate git bare repo, keeping them isolated from personal dotfiles.

## Repository Info

- **Remote**: `[email protected]:thopper/dotfiles.git`
- **Work tree**: `$HOME`
- **Git directory**: `~/.local/share/yadm-work/repo.git`
- **Function**: `yadm-work` (defined in `~/.config/fish/fish-work.fish`)

## Key Principle: Use yadm-work

The `yadm-work` function wraps git with the correct directories:

```bash
yadm-work status
yadm-work add <file>
yadm-work commit -m "message"
yadm-work push
```

This is equivalent to:
```bash
git --git-dir="$HOME/.local/share/yadm-work/repo.git" --work-tree="$HOME" <command>
```

## Initial Setup

If not yet initialized on a new machine:

```bash
# Create the directory
mkdir -p ~/.local/share/yadm-work

# Clone as bare repo
git clone --bare [email protected]:thopper/dotfiles.git ~/.local/share/yadm-work/repo.git

# Checkout files to home directory
yadm-work checkout
```

## Getting Current State

```bash
yadm-work status          # Show modified/staged files
yadm-work ls-files        # List all tracked work files
yadm-work diff            # Show unstaged changes
yadm-work remote -v       # Verify remote is Spotify GHE
```

## Core Operations

### Pull from Remote

```bash
yadm-work pull
```

If merge conflicts occur:
1. Run `yadm-work status` to see conflicted files
2. Edit files to resolve conflicts
3. Stage resolved files: `yadm-work add <file>`
4. Complete the merge: `yadm-work commit`

### Commit and Push Changes

```bash
yadm-work add <file>           # Stage specific file
yadm-work add -u               # Stage all modified tracked files
yadm-work commit -m "message"  # Commit with message
yadm-work push                 # Push to Spotify GHE
```

### Modify Configuration Files

1. Find the relevant file: `yadm-work ls-files | grep -i <pattern>`
2. Read and understand the current config
3. Make the requested changes
4. Stage, commit, and push:
   ```bash
   yadm-work add <modified-file>
   yadm-work commit -m "Update <config> to <what was changed>"
   yadm-work push
   ```

## Adding/Removing Files

### Add a new file to tracking

```bash
yadm-work add <new-file>
yadm-work commit -m "Add <file> to work dotfiles"
yadm-work push
```

**Important**: When adding new files under `~/.claude/`, also update `~/.claude/README.md` to document them:

```bash
# After adding new .claude files, update the README
yadm-work add ~/.claude/README.md
yadm-work commit -m "Update README with new <item>"
yadm-work push
```

### Stop tracking a file (without deleting it)

```bash
yadm-work rm --cached <file>
yadm-work commit -m "Stop tracking <file>"
yadm-work push
```

## Avoiding Conflicts with Personal Dotfiles

**Critical**: Never track the same file in both personal (`yadm`) and work (`yadm-work`) repos.

Check before adding:
```bash
# Check if file is in personal dotfiles
yadm ls-files | grep <filename>

# Check if file is in work dotfiles
yadm-work ls-files | grep <filename>
```

## Currently Tracked Files

```
~/.claude/README.md
~/.claude/skills/add-knowledge/
~/.claude/skills/investigating-pagerduty-incidents/
~/.claude/skills/managing-work-dotfiles/
~/.claude/skills/monitor-deploy/
```

## Useful Commands

```bash
yadm-work log --oneline -10    # Recent commits
yadm-work show HEAD            # Last commit details
yadm-work stash                # Stash changes temporarily
yadm-work stash pop            # Restore stashed changes
```

Overview

This skill manages work-specific dotfiles stored in a separate bare Git repository and operated via a yadm-work wrapper. It keeps work configuration isolated from personal dotfiles, enabling safe pulls, commits, pushes, and conflict resolution against the Spotify GHE remote. Use it to inspect tracked files, update configs, and maintain the work dotfiles repository reliably.

How this skill works

yadm-work is a small wrapper that runs git with a dedicated --git-dir and --work-tree pointing at ~/.local/share/yadm-work/repo.git and your $HOME respectively. The skill exposes common operations: clone as a bare repo, checkout files into your home, list tracked files, inspect status/diffs, and perform add/commit/push and merge conflict workflows. It also documents repository-specific rules like keeping README updates for ~/.claude files.

When to use it

  • Setting up work dotfiles on a new machine
  • Pulling remote changes from Spotify GHE and handling merges
  • Committing, staging, and pushing work dotfile edits
  • Adding or stopping tracking of work-specific files
  • Searching or listing work-tracked configuration files

Best practices

  • Always use yadm-work (or git with the repo and work-tree flags) to avoid operating on the wrong repo
  • Check both personal yadm and yadm-work lists before tracking a file to avoid duplicate tracking
  • When adding items under ~/.claude/, update ~/.claude/README.md to document them
  • Stage resolved files before finishing merges: yadm-work add <file> then yadm-work commit
  • Use yadm-work stash for temporary edits and stash pop to restore

Example use cases

  • Initialize work dotfiles on a fresh laptop: create ~/.local/share/yadm-work, clone the bare repo, then yadm-work checkout
  • Update a work tool config: find file with yadm-work ls-files | grep, edit, yadm-work add, commit, and push
  • Resolve a pull conflict: yadm-work pull, edit conflicted files shown by yadm-work status, stage resolved files, commit
  • Stop tracking a machine-specific file without deleting it: yadm-work rm --cached <file> then commit and push

FAQ

How do I initialize work dotfiles on a new machine?

Create ~/.local/share/yadm-work, clone the bare Spotify GHE repo into ~/.local/share/yadm-work/repo.git, then run yadm-work checkout to populate your home.

What if a file is tracked in both personal and work repos?

Never track the same file in both. Check with yadm ls-files and yadm-work ls-files before adding. Remove tracking from one repo using yadm rm --cached or yadm-work rm --cached as appropriate.