Skip to content

Add global CLAUDE.md with personal AI agent preferences #3

Description

@DeadEnglish

Context

Claude Code automatically reads ~/.claude/CLAUDE.md on every session, injecting it into the system prompt before any project-level CLAUDE.md. This file currently only lists gstack skills — it has no personal preferences or rules. Each AI session starts without knowing the user's defaults, meaning the user repeats the same corrections (no em dashes, no co-author commits) across projects.

Adding a version-controlled CLAUDE.md to the dotfiles repo with a symlink ensures every Claude Code session, in any project, inherits the user's rules without needing project-level repetition. The global file is authoritative — projects cannot override.

Current State

  • ~/.claude/CLAUDE.md — exists (648 bytes, 41 lines), contains only gstack skill listings and the /browse routing rule. NOT version-controlled.
  • ~/.config/claude/ — does not exist. No Claude-specific config is tracked in dotfiles.
  • ~/.config/setup.sh — bootstraps machine (Xcode, Homebrew, zsh, git config) but has no Claude Code setup.
  • ~/.config/claude/voice.md — does not exist yet; user will create separately.

Proposed Change

Create ~/.config/claude/CLAUDE.md with global AI agent preferences, symlinked to ~/.claude/CLAUDE.md. Add symlink creation to setup.sh. The new file has two sections: global preferences (always applied) and gstack skills (existing content preserved).

Implementation Details

1. Create ~/.config/claude/CLAUDE.md — 8 global rules plus gstack skill listing:

  • No em dashes
  • Never modify autogenerated files (changelog.md, etc.)
  • Never co-author commits
  • One sentence per line in markdown
  • Don't over-weight development costs in technical decisions
  • Reproduce bugs in E2E before fixing
  • Fix lint and test failures even if not caused by current work
  • Commit incrementally when completing plans
  • Voice reference: "When writing in my voice, read ~/.config/claude/voice.md"

2. Update setup.sh — insert after existing git config block:

# Claude Code global config symlink
CLAUDE_CONFIG_DIR="$HOME/.config/claude"
CLAUDE_TARGET="$HOME/.claude/CLAUDE.md"

# Back up existing ~/.claude/CLAUDE.md if it's a real file (not already a symlink)
if [ -f "$CLAUDE_TARGET" ] && [ ! -L "$CLAUDE_TARGET" ]; then
  cp "$CLAUDE_TARGET" "$CLAUDE_TARGET.backup-$(date +%Y%m%d)"
fi

mkdir -p "$CLAUDE_CONFIG_DIR"
ln -sf "$CLAUDE_CONFIG_DIR/CLAUDE.md" "$CLAUDE_TARGET"

Acceptance Criteria

  1. ~/.config/claude/CLAUDE.md exists in the repo with the content specified above
  2. Running setup.sh creates ~/.claude/CLAUDE.md as a symlink pointing to ~/.config/claude/CLAUDE.md
  3. If ~/.claude/CLAUDE.md already exists as a real file, setup.sh backs it up before overwriting
  4. Re-running setup.sh is idempotent — symlink is recreated without errors
  5. After setup, cat ~/.claude/CLAUDE.md outputs the content from ~/.config/claude/CLAUDE.md
  6. An AI agent session in any project (including projects without their own CLAUDE.md) adheres to all 8 global rules
  7. The gstack skill listing is preserved and functional below the global preferences section

Testing Plan

Layer What Count
Manual Run setup.sh on a fresh checkout, verify symlink exists 1
Manual Modify ~/.claude/CLAUDE.md and verify cat matches source 1
Manual Re-run setup.sh, verify no double-backup or error 1
Manual Open Claude Code in a project with no CLAUDE.md, check adherence 1

No automated tests — this is a config file change in a dotfiles repo.

Rollback Plan

Remove the symlink and restore backup:

rm ~/.claude/CLAUDE.md
cp ~/.claude/CLAUDE.md.backup-YYYYMMDD ~/.claude/CLAUDE.md

Or revert the commit in the dotfiles repo and re-run setup.sh.

Effort Estimate

Component Effort
Create CLAUDE.md 15 min
Update setup.sh 10 min
Manual testing 15 min
Total ~40 min

Files Reference

File Change
claude/CLAUDE.md New file — global AI agent preferences + gstack
setup.sh:61 Add symlink creation block after git config

Out of Scope

  • Creating voice.md — user handles separately
  • Tool-specific config (MCP servers, hooks, permissions, settings.json)
  • Any project-level CLAUDE.md changes
  • Support for AI agents other than Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions