Synchronize project CLAUDE.md with recent codebase changes by analyzing git history, reviewing against official Anthropic best practices using parallel agents, and proposing comprehensive updates. Use when CLAUDE.md is outdated or doesn't exist.
Limited to specific tools
Additional assets for this skill
This skill is limited to using the following tools:
name: sync-claude-md description: Synchronize project CLAUDE.md with recent codebase changes by analyzing git history, reviewing against official Anthropic best practices using parallel agents, and proposing comprehensive updates. Use when CLAUDE.md is outdated or doesn't exist. license: Complete terms in LICENSE.txt allowed-tools:
This skill keeps project-level CLAUDE.md files synchronized with codebase evolution. It analyzes git history since the last CLAUDE.md update, spawns 3 parallel review agents to validate against official Anthropic documentation, and proposes comprehensive changes with user approval before applying.
When to use:
/sync-claude-mdSTART: /sync-claude-md invoked
│
├─ CLAUDE.md exists? (check ./CLAUDE.md or ./.claude/CLAUDE.md)
│ │
│ ├─ YES → Go to "Update Existing CLAUDE.md" workflow
│ │
│ └─ NO → Go to "Create New CLAUDE.md" workflow
│
END
Step 1.1: Locate CLAUDE.md
./CLAUDE.md (preferred)./.claude/CLAUDE.md (alternative)./CLAUDE.mdStep 1.2: Find Last Update
# Find when CLAUDE.md was last modified
git log --follow --format="%H" -1 -- CLAUDE.md
# Count commits since that update
git rev-list --count <last_commit>..HEAD
Step 1.3: Determine Context Gathering Strategy
When >10 commits since update:
git log --oneline <last_commit>..HEAD
Task: "Analyze the Effect.ts migration in commits X-Y and summarize
what documentation changes are needed for CLAUDE.md"
When ≤10 commits since update:
git show --stat <commit> for key commitsSpawn 3 parallel agents (sonnet model) with identical instructions:
Agent Prompt:
Review the project CLAUDE.md file and tell me if it follows best practices.
You must read official docs about CLAUDE.md on the official Anthropic website
before reviewing our CLAUDE.md. Then report to me.
Focus on:
- Does it contain technical guidance (commands, code style, testing)?
- Are architectural patterns documented?
- Is it concise and actionable?
- Does it follow the official structure recommendations?
Report:
1. What aligns with best practices
2. What's missing or incorrect
3. Specific recommendations
Execute in parallel:
Task(agent1, prompt)
Task(agent2, prompt)
Task(agent3, prompt)
Wait for all 3 agents to complete, then collect reports.
Step 4.1: Read Official Documentation Fetch Anthropic's official CLAUDE.md documentation:
WebFetch("https://code.claude.com/docs/en/memory.md",
"Extract all information about CLAUDE.md files: structure, content, best practices")
Step 4.2: Cross-Reference Findings
Step 4.3: Analyze Current vs Required Compare current CLAUDE.md sections against:
Step 4.4: Generate Comprehensive Proposal Create detailed change proposal with:
Format proposal as markdown with clear sections.
Present proposal to user:
## Proposed Changes to CLAUDE.md
### Summary
[Brief overview of what will change]
### Changes
#### 1. Add Section: "Effect.ts Integration"
**Rationale:** Recent migration to Effect.ts (commits abc-xyz) not documented
**Content:**
[Show exact content to be added]
#### 2. Update Section: "Development Commands"
**Rationale:** Biome linter added but not documented
**Changes:**
- Add: `bun run lint`
- Add: `bun run check`
[etc...]
[Continue for all changes...]
Ask user:
Apply these changes to CLAUDE.md? (yes/no)
Wait for user response.
If user approves:
✅ CLAUDE.md updated successfully
Changes applied:
- Added 3 new sections
- Updated 2 existing sections
- Removed 1 outdated section
Next step: Review changes and commit when ready
If user rejects:
Step 1.1: Detect Project Type Read project files to understand technology stack:
package.json → Node/Bun project, identify runtime & dependenciestsconfig.json → TypeScript configurationCargo.toml → Rust projectpyproject.toml / requirements.txt → Python project.github/workflows/ → CI/CD presencedocker-compose.yml → Docker usageStep 1.2: Identify Key Patterns Look for:
Fetch Anthropic Documentation:
WebFetch("https://code.claude.com/docs/en/memory.md",
"Extract best practices for creating new CLAUDE.md files:
structure, required sections, examples")
Ask user for approach:
CLAUDE.md doesn't exist. Generate:
1. Minimal starter template (basic structure, fill in later)
2. Comprehensive CLAUDE.md (full analysis of your project)
Choose option (1 or 2):
Option 1: Minimal Template Generate basic structure:
# CLAUDE.md
## Project Overview
[Project name] - [Brief description]
**Runtime**: [Detected runtime]
**Language**: [Detected language]
## Development Commands
```bash
# Install dependencies
[detected package manager] install
# Run tests
[detected test command]
# Run linter
[detected lint command]
[To be documented]
**Option 2: Comprehensive Analysis**
1. Analyze entire project structure
2. Read key configuration files
3. Identify all development commands
4. Document architectural patterns found
5. List important notes (env vars, special setup, etc.)
6. Generate complete CLAUDE.md following official structure
### Phase 4: Present to User
Show generated CLAUDE.md in full:
```markdown
## Proposed CLAUDE.md
[Show complete content]
---
Create this file? (yes/no)
If user approves:
./CLAUDE.md (preferred location)✅ CLAUDE.md created successfully
Next steps:
1. Review and customize content
2. Add project-specific patterns
3. Commit to repository for team sharing
If user rejects:
Conservative Approach:
Summarization Triggers:
Bailout Conditions:
CLAUDE.md not found and not in git repo:
git rev-parse --is-inside-work-treeBoth ./CLAUDE.md and ./.claude/CLAUDE.md exist:
./CLAUDE.mdOfficial docs unreachable:
Agent failures:
DO:
DON'T:
Scenario 1: CLAUDE.md outdated after major refactor
User: /sync-claude-md
[Skill detects 15 commits since last update]
[Analyzes commits, spawns 3 agents, fetches official docs]
[Proposes adding Effect.ts section, updating commands, adding security section]
Skill: "Apply these changes to CLAUDE.md? (yes/no)"
User: yes
[Changes applied, user commits manually]
Scenario 2: No CLAUDE.md exists
User: /sync-claude-md
Skill: "CLAUDE.md doesn't exist. Generate:
1. Minimal starter template
2. Comprehensive CLAUDE.md
Choose option (1 or 2):"
User: 2
[Analyzes project, generates comprehensive CLAUDE.md]
[Shows preview]
Skill: "Create this file? (yes/no)"
User: yes
[File created, user reviews and commits]
Scenario 3: Recent update, minor changes needed
User: /sync-claude-md
[Skill detects 3 commits since last update]
[Reads commits directly, spawns agents, reviews]
Skill: "CLAUDE.md is mostly up to date. Proposed changes:
- Add 1 new command: 'bun run format'
- Update Important Notes with new library
Apply? (yes/no)"
User: yes
[Changes applied]