This skill should be used when the user asks to "create CLAUDE.md", "initialize CLAUDE.md", "sync CLAUDE.md with code", "update documentation from codebase", "create .claude/rules/", "manage modular...
Manages the complete lifecycle of project instructions: creating initial documentation, syncing with codebase patterns, and organizing modular rules.
Use when:
Provides 4 main operations:
Note: .claude/rules/ only works in project directories, not in global ~/.claude/
Before creating any project-level documentation, ALWAYS read the user's global CLAUDE.md:
# Check if global CLAUDE.md exists
~/.claude/CLAUDE.md
If it exists:
If it doesn't exist:
Use AskUserQuestion tool with THREE questions:
{
"questions": [
{
"question": "What do you need help with?",
"header": "Operation",
"multiSelect": false,
"options": [
{
"label": "Create new CLAUDE.md",
"description": "Start from scratch with opinionated baseline"
},
{
"label": "Sync CLAUDE.md with existing code",
"description": "Analyze codebase to detect patterns and update docs"
},
{
"label": "Split large CLAUDE.md into rules/",
"description": "Break CLAUDE.md (>500 lines) into focused files"
}
]
},
{
"question": "What complexity level?",
"header": "Structure",
"multiSelect": false,
"options": [
{
"label": "Simple (just CLAUDE.md)",
"description": "Single file, good for small/medium projects"
},
{
"label": "Modular (CLAUDE.md + .claude/rules/)",
"description": "Multiple files with path patterns, for large projects"
}
]
},
{
"question": "Should this be shared with your team or kept local?",
"header": "Sharing",
"multiSelect": false,
"options": [
{
"label": "Shared (CLAUDE.md)",
"description": "Committed to git, shared across team and sessions"
},
{
"label": "Local only (CLAUDE.local.md)",
"description": "Git-ignored, personal workspace rules only"
}
]
}
]
}
Route to workflow:
Create opinionated baseline CLAUDE.md for new projects.
Process:
Determine filename (from Step 1 answer):
CLAUDE.mdCLAUDE.local.mdDetect project type
Think through design:
Show preview with:
Generate and write (after confirmation):
If local only (CLAUDE.local.md):
CLAUDE.local.md to .gitignoreInform user with next steps
See references/initialize-workflow.md for complete details
Analyze codebase to extract patterns and update documentation.
Process:
Detect current setup:
Analyze codebase (use Task tool with Explore agent):
Extract patterns:
Think through findings:
Show findings to user:
Ask approach (AskUserQuestion):
Generate updates and write (after confirmation)
Inform user with summary of changes
See references/sync-workflow.md for complete details
Set up modular documentation with focused rule files.
Process:
Detect stack (same as initialize)
Ask which rules to create (AskUserQuestion):
Think through design:
Show preview:
Create files (after confirmation):
Inform user with structure overview
See references/organize-and-split-workflows.md for templates and details
Break CLAUDE.md (>500 lines) into focused modular files.
Process:
Read and analyze CLAUDE.md:
Think through split strategy:
Show split preview:
Execute split (after confirmation):
Inform user with results
See references/organize-and-split-workflows.md for complete details
Quick reference:
| Stack | Recommended Pattern |
|---|---|
| React/Vue SPA | Feature-Sliced Design (FSD) |
| Next.js | FSD or Feature-First |
| Express/Fastify | Feature-First |
| NestJS | Feature-First |
| Django/Flask | MVC |
| Rails | MVC |
| Spring Boot | Package by Feature |
| Go API | Package by Feature |
See references/architecture-patterns.md for complete guide
# Coding standards for TypeScript
---
paths: src/**/*.{ts,tsx}
---
# Testing conventions
---
paths: **/*.{test,spec}.*
---
# API-specific rules
---
paths: src/{api,routes}/**/*
---
Control whether @-mention file picker respects .gitignore:
{
"respectGitignore": true
}
Add to .claude/settings.json (project-specific) or ~/.claude/settings.json (global).
Use when: You want file suggestions to exclude gitignored files
Customize @ file search commands:
{
"fileSuggestion": {
"command": "rg --files",
"timeout": 5000
}
}
Use when:
These settings affect how documentation discovery and file reference tools work.
Complete workflows and detailed guides:
references/initialize-workflow.md - Creating new CLAUDE.md from scratchreferences/sync-workflow.md - Analyzing code and extracting patternsreferences/organize-and-split-workflows.md - Managing .claude/rules/ structurereferences/modular-organization.md - Modular documentation guidereferences/architecture-patterns.md - Complete architecture pattern guideStudy these as templates:
examples/minimal-claude-md.md - Single file example (~200 lines)examples/modular-setup/ - Complete modular structureProject size?
āā <10k lines ā Single file CLAUDE.md
āā >10k lines ā Modular with .claude/rules/
Different rules for different areas?
āā Yes ā Modular (use path patterns)
āā No ā Single file
Have documentation?
āā No ā Initialize workflow
āā Yes ā Is it outdated?
āā Yes ā Sync workflow
āā No ā Is it >500 lines?
āā Yes ā Split workflow
āā No ā Organize workflow (if want modular)
Type of project?
āā Frontend SPA (React/Vue)
ā āā Large (>50k lines) ā FSD
ā āā Medium ā Feature-First
āā Backend API
ā āā Go/Java/C# ā Package by Feature
ā āā Express/Flask/FastAPI ā Feature-First
ā āā Django/Rails ā MVC
āā Unsure ā Ask user preferences
Initialize (Single File):
Initialize (Modular):
Sync:
Organize:
Split:
All outputs: 100% English, no dynamic data, user-confirmed, ready to use