A template repository for managing Claude Code guidelines across multiple projects using version control, DRY principles, and on-demand skills.
- 🔄 DRY Guidelines: Write once in
common/, reuse across projects - 📦 Skills System: Extract detailed workflows to on-demand skills (reduces baseline context)
- 🎯 Project Overrides: Customize common patterns per project
- 🔗 Auto-linking: Build script creates symlinks automatically
- ✅ Tested: Comprehensive test suite ensures reliability
- 📝 YAML Config: Easy-to-edit configuration
Claude Code loads guidelines from:
~/.claude/CLAUDE.md(global for all projects)PROJECT_DIR/CLAUDE.local.md(project-specific)
Simple approaches:
- Global only (
~/.claude/CLAUDE.md) - One file for everything, but no project-specific context - Per-project only - Each project has its own
CLAUDE.local.md, but you duplicate common patterns across projects
Use this system if you have:
- ✅ Multiple projects - More than 2-3 projects that need guidelines
- ✅ Shared patterns - Common workflows you use across projects (git conventions, review process, decision frameworks)
- ✅ Project-specific needs - Different tech stacks, structures, or domains per project
- ✅ Evolving practices - You want to track how your development practices improve over time
Benefits you get:
- DRY Principle - Write common patterns once, reuse across projects
- Modular Composition - Each project selects which common guidelines to include (not all-or-nothing)
- Version Control - Track guideline evolution, see what worked, rollback changes
- Project Customization - Tech stack and domain-specific guidelines per project, with overrides for common patterns
- Context Optimization - Skills system reduces baseline context by loading details on-demand
- Consistency - Update a pattern once, rebuild to apply everywhere that uses it
Skip this system if:
- ❌ Single project - Just use
CLAUDE.local.mdin that project's repo - ❌ No shared patterns - Every project is completely different
- ❌ Static guidelines - You don't update practices regularly
- ❌ Quick experiment - Testing Claude Code for the first time
Use instead:
# Global universal principles
~/.claude/CLAUDE.md
# Project-specific guidelines (version controlled in each repo)
~/Projects/my-app/CLAUDE.local.md
~/Projects/another-app/CLAUDE.local.mdMany users benefit from combining both:
~/.claude/CLAUDE.md- Truly universal principles (work for any project)- This system - Your shared patterns across YOUR projects with project-specific customization
git clone https://github.com/YOUR-USERNAME/claude-guidelines-template.git claude-guidelines
cd claude-guidelines# Create project directory
mkdir -p projects/my-project
# Create project file
cat > projects/my-project/main.project.md << 'EOF'
# My Project
## Tech Stack
- [Your stack here]
## Project Structure
- [Your structure]
## Key Patterns
- [Your patterns]
EOFEdit builds.yml:
builds:
- name: My Project
project: projects/my-project/main.project.md
output: generated/my-project/guidelines.md
link_to: ~/Projects/my-project/CLAUDE.local.md # Path to actual project
common:
- common/preferences.md
skills: [] # Add skills as needed./build.rbThis generates:
generated/my-project/guidelines.md(in this repo)generated/my-project/.claude/skills/(skill directories, if configured)- Symlink at
~/Projects/my-project/CLAUDE.local.md(points to generated file) - Symlink at
~/Projects/my-project/.claude/skills/(points to generated skills)
Claude Code will now use these guidelines when working in your project!
claude-guidelines/
├── common/ # Shared guidelines (DRY)
│ ├── preferences.md # Example: General preferences
│ └── _editing-instructions.md
├── projects/ # Project-specific content
│ └── example-project/
│ └── main.project.md
├── skills/ # On-demand skills (loaded when invoked)
│ └── example-skill/
│ └── SKILL.md
├── generated/ # Generated files (created by build.rb)
│ └── example-project/
│ ├── guidelines.md # → Symlinked to actual project
│ └── .claude/ # Skills directory
├── learnings/ # Track what works (not in builds)
│ └── README.md
├── test/ # Test suite
│ ├── build_test.rb
│ └── README.md
├── build.rb # Build script
├── builds.yml # Build configuration
├── Rakefile # Rake tasks
└── README.md # This file
Files in common/ are shared across all projects that include them:
# common/preferences.md
When writing code:
- Match existing patterns
- Keep it simple
- Ask questions when uncertainEach project has its own directory in projects/:
# projects/my-app/main.project.md
# My App
## Tech Stack
- Rails 7, PostgreSQL, React
## Project Structure
- app/services/ - Business logic
- app/controllers/ - Keep thinSkills are detailed workflows loaded only when invoked with /skill-name:
# skills/commit/SKILL.md
---
name: commit
description: Create well-formatted git commits
---
# Commit Guidelines
[Detailed commit message format, examples, checklist...]Benefits:
- Reduces baseline context (skills not loaded unless needed)
- Detailed information available on-demand
- Modular and maintainable
Projects can override common files with project-specific versions:
common/git-workflow.md # Universal git patterns
projects/my-project/git-workflow.md # Project-specific (overrides common/)
Hierarchical resolution:
- Check
projects/my-project/git-workflow.md(most specific) - Check parent directories
- Fall back to
common/git-workflow.md
# Build all projects
./build.rb
# Via rake
rake build# Run tests
ruby test/build_test.rb
# Via rake
rake test
# Test + build
rake verify-
Create project directory:
mkdir -p projects/my-project vim projects/my-project/main.project.md
-
Add to
builds.yml:- name: My Project project: projects/my-project/main.project.md output: generated/my-project/guidelines.md link_to: ~/Projects/my-project/CLAUDE.local.md common: - common/preferences.md skills: []
-
Build:
./build.rb
-
Create skill directory:
mkdir -p skills/my-skill
-
Create SKILL.md:
# My Skill Detailed instructions... -
Create meta.yml (optional, for version tracking):
name: my-skill description: What this skill does version: 1.0.0 category: workflow
-
Add to project in
builds.yml:skills: - my-skill
-
Rebuild:
./build.rb
-
Invoke in Claude:
/my-skill
If a project needs different conventions:
# Create override (same filename as common file)
vim projects/my-project/git-workflow.md
# Rebuild - your version replaces common/git-workflow.md
./build.rb- ✅ Patterns that apply to most projects
- ✅ Default workflows and preferences
- ✅ Universal best practices
- ✅ Framework-agnostic guidelines
- ✅ Tech stack specifics
- ✅ Project structure and navigation
- ✅ Domain-specific patterns
- ✅ Project-specific overrides
- ✅ Detailed workflows (>50 lines)
- ✅ Task-specific instructions
- ✅ Reference material used occasionally
- ✅ Complex processes with multiple steps
Extract to skill when:
- Content is >50-100 lines
- Only needed for specific tasks
- Used occasionally, not constantly
- Detailed step-by-step instructions
Keep in main file when:
- Concise reference information
- Needed frequently during development
- Core patterns you want always visible
See the projects/example-project/ directory for a complete example showing:
- Project structure
- Common file usage
- Skill references
- Override patterns
This is a template - customize it for your needs! Some ideas:
- Add more common guidelines for your tech stack
- Create skills for your workflows
- Add project-specific overrides
- Extend the test suite
- Improve documentation
Potential enhancements we'd like to explore:
- Central skill repository: Pull common skills from a shared registry
- Skill versioning: Track skill versions, allow pinning to specific versions
- Skill dependencies: Skills that reference or depend on other skills
- Interactive setup wizard: Guided initial configuration (
./build.rb --init) - Guideline linting: Validate guideline format, check for common issues, verify skill references exist
- Git hooks: Auto-rebuild on commit, validate changes pre-commit
- Multi-project diffs: Compare guidelines across projects to find inconsistencies
- Conditional includes: Include common files based on tech stack detection
- CI/CD examples: GitHub Actions, GitLab CI templates for automated validation
- Migration tools: Import existing CLAUDE.md files into template structure
Have ideas? Open an issue or PR! We're particularly interested in:
- Real-world usage patterns and learnings
- Skills that could be shared broadly
- Improvements to the build system
- Better testing approaches
MIT License - See LICENSE file
Happy coding with Claude! 🚀