Use when user asks where to put configuration, skills, or learnings, or discusses sharing config across projects. Provides decision criteria for the three-tier architecture (global ~/.claude, plugin, project-local .claude) to prevent duplication and ensure reusability. Invoke before creating new skills or configuration to determine the correct tier and location.
Provides decision criteria for the three-tier configuration architecture (global, plugin, project-local) to prevent duplication and ensure reusability. Triggers when users ask where to put configuration, skills, or learnings, or discuss sharing config across projects.
/plugin marketplace add bbrowning/bbrowning-claude-marketplace/plugin install bbrowning-claude@bbrowning-marketplaceThis skill inherits all available tools. When active, it can use any tool Claude has access to.
When working across multiple repositories (e.g., your marketplace repo, vLLM, llama stack, etc.), you need a clear strategy for where to store configurations, learnings, and skills to ensure consistency without duplication.
Claude Code supports three tiers of configuration, each with specific use cases:
~/.claude/CLAUDE.md)Use for:
Benefits:
Example content:
# Python code style
- Always put imports at the top of the file, not within methods
- Use descriptive variable names over comments
# General preferences
- Prefer Edit tool over Write for existing files
- Keep commit messages concise and action-oriented
Use for:
Benefits:
When to use:
.claude/CLAUDE.md in project)Use for:
Benefits:
Example content:
# This Project's Patterns
- Authentication uses JWT tokens stored in httpOnly cookies
- All API routes go through middleware/auth.ts
- Database migrations use Prisma in prisma/migrations/
When deciding where to store configuration or learnings, ask:
Is this personal preference? → Global (~/.claude/CLAUDE.md)
Is this shareable domain knowledge? → Plugin Skill
Is this specific to one codebase? → Project-Local (.claude/CLAUDE.md)
To ensure consistency across all repositories:
Use ~/.claude/CLAUDE.md exclusively. This automatically applies everywhere you use Claude Code.
Create plugin skills in a marketplace repository:
Use project-local .claude/CLAUDE.md committed to that repository's version control.
/learn CommandA well-designed /learn command should:
~/.claude/CLAUDE.md.claude/CLAUDE.md in current repoThis ensures learnings are:
DON'T:
DO:
To verify your configuration architecture:
~/.claude/CLAUDE.md preferences apply in a new, unrelated repositorySituation: You learn a better way to write commit messages while working on vLLM.
Decision process:
Most likely: Global (~/.claude/CLAUDE.md) because commit message style is typically a personal preference that should apply everywhere you work.
When frequently context-switching between multiple PRs or bugs, git worktrees provide a better workflow than stashing or multiple clones.
Use worktrees when:
Benefits over alternatives:
.git repository (saves space vs multiple clones)# Create worktree for existing branch
git worktree add ../myrepo-feature-x feature-x
# Create worktree with new branch
git worktree add ../myrepo-bugfix -b bugfix/issue-123
# List all worktrees
git worktree list
# Remove worktree when done
git worktree remove ../myrepo-feature-x
Scenario 1: Team project where .claude/ is committed
No special setup needed! The .claude/CLAUDE.md file is in version control, so all worktrees automatically share the same configuration through git.
Scenario 2: Large OSS project where .claude/ cannot be committed
Use symlinks to share your project-local configuration across worktrees:
# In your main worktree (keep the real .claude directory here)
ls .claude/CLAUDE.md # Verify it exists
# In each additional worktree
cd ../myrepo-feature-x
rm -rf .claude # Remove if it exists
ln -s /full/path/to/main-worktree/.claude .claude
# Prevent accidental commits
echo ".claude" >> .git/info/exclude
Create a script to automate worktree creation with shared .claude/:
#!/bin/bash
# create-worktree.sh
PROJECT_NAME=$(basename $(git rev-parse --show-toplevel))
MAIN_WORKTREE=$(git rev-parse --show-toplevel)
BRANCH=$1
WORKTREE_DIR="../${PROJECT_NAME}-${BRANCH}"
# Create the worktree
git worktree add "$WORKTREE_DIR" -b "$BRANCH"
# Symlink .claude directory
cd "$WORKTREE_DIR"
rm -rf .claude
ln -s "${MAIN_WORKTREE}/.claude" .claude
# Exclude from git
echo ".claude" >> .git/info/exclude
echo "Worktree created at $WORKTREE_DIR with shared .claude config"
Usage:
./create-worktree.sh feature/new-optimization
With worktrees, your three-tier configuration works seamlessly:
Global (~/.claude/CLAUDE.md)
Plugin Skills (from marketplace)
Project-Local (.claude/CLAUDE.md)
DON'T:
.claude/ directories in each worktree (causes divergence).claude/ in OSS projectsDO:
.claude/ for OSS projects where you can't commit configuration.claude/ directory.claude to .git/info/exclude in OSS projectsPlugin skills are model-invoked based on description matching. For critical workflow information you want guaranteed in every session, use a hybrid approach.
When to use:
Implementation:
Brief essentials in global config (~/.claude/CLAUDE.md):
Comprehensive details in plugin skill:
Example:
# In ~/.claude/CLAUDE.md (always loaded)
# Claude Code Configuration
- Three tiers: Global (~/.claude/CLAUDE.md), Plugin Skills, Project-Local (.claude/CLAUDE.md)
- For detailed guidance, use the cross-repo-config skill
# Git Worktrees for Context-Switching
- Use git worktrees (not multiple clones) for frequent PR/bug switching
- In OSS projects: symlink .claude/ from main worktree
- For automation scripts, use the cross-repo-config skill
Benefits:
Don't:
Do:
~/.claude/CLAUDE.mdThis skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.