sync-claude-md
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.
What this skill does
# Sync CLAUDE.md
## Overview
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:**
- CLAUDE.md hasn't been updated in many commits
- Major architectural changes occurred (new libraries, patterns, tools)
- CLAUDE.md doesn't exist and needs to be created
- User explicitly requests: `/sync-claude-md`
## Workflow Decision Tree
```
START: /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
```
## Update Existing CLAUDE.md Workflow
### Phase 1: Discovery & Context Analysis
**Step 1.1: Locate CLAUDE.md**
- Check for `./CLAUDE.md` (preferred)
- Check for `./.claude/CLAUDE.md` (alternative)
- If both exist: warn user, prefer `./CLAUDE.md`
**Step 1.2: Find Last Update**
```bash
# 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**
- If commit count > 10: Use heavy analysis (subagents for context)
- If commit count ≤ 10: Direct analysis (read commits directly)
### Phase 2: Context Gathering
**When >10 commits since update:**
1. Read all commit messages between last update and HEAD:
```bash
git log --oneline <last_commit>..HEAD
```
2. Identify major changes (library migrations, new tools, architecture shifts)
3. If changes are complex, spawn subagent(s) to analyze specific areas:
```
Task: "Analyze the Effect.ts migration in commits X-Y and summarize
what documentation changes are needed for CLAUDE.md"
```
4. Summarize findings concisely to preserve context window
**When ≤10 commits since update:**
1. Read commit messages directly
2. Optionally read `git show --stat <commit>` for key commits
3. Identify what changed (new commands, libraries, patterns, files)
### Phase 3: Parallel Agent Review
Spawn 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:**
```typescript
Task(agent1, prompt)
Task(agent2, prompt)
Task(agent3, prompt)
```
Wait for all 3 agents to complete, then collect reports.
### Phase 4: Master Analysis
**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**
- Compare 3 agent reports (look for consensus)
- Validate against official docs
- Identify gaps based on commit context from Phase 2
**Step 4.3: Analyze Current vs Required**
Compare current CLAUDE.md sections against:
- Recent changes (from Phase 2 context)
- Agent findings (from Phase 3)
- Official best practices (from Step 4.1)
**Step 4.4: Generate Comprehensive Proposal**
Create detailed change proposal with:
- **Summary**: What needs updating and why
- **Sections to Add**: New sections with exact content
- **Sections to Modify**: Specific changes to existing sections
- **Sections to Remove**: Outdated content to delete
- **Rationale**: Why each change aligns with best practices
Format proposal as markdown with clear sections.
### Phase 5: User Approval Gate
**Present proposal to user:**
```markdown
## 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.**
### Phase 6: Application
**If user approves:**
1. Apply all proposed changes to CLAUDE.md file
2. Use Edit tool for modifications, Write tool if complete rewrite needed
3. Confirm changes applied successfully
4. **DO NOT** commit to git (let user commit manually)
5. Display summary:
```
✅ 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:**
1. Explain what was not applied
2. Offer to save proposal to file for later reference
3. End workflow
---
## Create New CLAUDE.md Workflow
### Phase 1: Project Analysis
**Step 1.1: Detect Project Type**
Read project files to understand technology stack:
- `package.json` → Node/Bun project, identify runtime & dependencies
- `tsconfig.json` → TypeScript configuration
- `Cargo.toml` → Rust project
- `pyproject.toml` / `requirements.txt` → Python project
- `.github/workflows/` → CI/CD presence
- `docker-compose.yml` → Docker usage
**Step 1.2: Identify Key Patterns**
Look for:
- Testing framework (Jest, Bun test, pytest, etc.)
- Linting/formatting (Biome, ESLint, Prettier, Black, etc.)
- Build tools (Vite, webpack, cargo, etc.)
- Effect management (Effect.ts, neverthrow, Result types, etc.)
- Architecture patterns (docs/, src/ structure)
### Phase 2: Fetch Official Guidance
**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")
```
### Phase 3: Generate Initial CLAUDE.md
**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:
```markdown
# 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]
```
## Architecture
[To be documented]
## Important Notes
- [Add project-specific notes]
```
**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)
```
### Phase 5: Create File
**If user approves:**
1. Create `./CLAUDE.md` (preferred location)
2. Confirm creation
3. Suggest next steps:
```
✅ 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:**
1. Offer to save draft to different location
2. End workflow
---
## Context Window Management
**Conservative Approach:**
- Monitor context usage Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.