CLAUDE.md File Enhancer
This skill provides comprehensive CLAUDE.md file generation and enhancement for Claude Code projects. It analyzes existing files, validates against best practices, and generates customized guidelines tailored to your project type, tech stack, and team size.
Capabilities
- 🆕 Interactive Initialization: Intelligent workflow that explores your repository, detects project type and tech stack, asks for confirmation, then creates customized CLAUDE.md files
- ✨ 100% Native Format Compliance: All generated files follow official Claude Code format with project structure diagrams, setup instructions, architecture sections, and file structure explanations (matching
/update-claude-md slash command)
- Analyze Existing Files: Scan and evaluate current CLAUDE.md files for structure, completeness, and quality
- Validate Best Practices: Check against Anthropic guidelines (file length, required sections, formatting standards)
- Generate New Files: Create complete CLAUDE.md files from scratch for new projects
- Enhance Existing Files: Add missing sections, improve structure, and update to latest best practices
- Modular Architecture: Support context-specific CLAUDE.md files in subdirectories (backend/, frontend/, docs/)
- Tech Stack Customization: Tailor guidelines to specific technologies (TypeScript, Python, Go, React, Vue, etc.)
- Team Size Adaptation: Adjust complexity based on team size (solo, small <10, large 10+)
- Template Selection: Choose appropriate template based on project complexity and development phase
Input Requirements
For Analysis and Enhancement
Provide existing CLAUDE.md file content or file path:
{
"mode": "enhance",
"file_path": "CLAUDE.md",
"content": "[existing CLAUDE.md content]",
"project_context": {
"type": "web_app",
"tech_stack": ["typescript", "react", "node", "postgresql"],
"team_size": "small",
"phase": "mvp"
}
}
For New File Generation
Provide project context:
{
"mode": "create",
"project_context": {
"type": "api",
"tech_stack": ["python", "fastapi", "postgresql", "docker"],
"team_size": "medium",
"phase": "production",
"workflows": ["tdd", "cicd", "documentation_first"]
},
"modular": true,
"subdirectories": ["backend", "database", "docs"]
}
Context Parameters
- type: Project type (
web_app, api, fullstack, cli, library, mobile, desktop)
- tech_stack: Array of technologies (e.g.,
["typescript", "react", "node"])
- team_size:
solo, small (<10), medium (10-50), large (50+)
- phase: Development phase (
prototype, mvp, production, enterprise)
- workflows: Key workflows (
tdd, cicd, documentation_first, agile, etc.)
Output Formats
Analysis Report
{
"analysis": {
"file_size": 450,
"line_count": 320,
"sections_found": [
"Quick Navigation",
"Core Principles",
"Tech Stack",
"Workflow Instructions"
],
"missing_sections": [
"Testing Requirements",
"Error Handling Patterns"
],
"issues": [
{
"type": "length_warning",
"severity": "medium",
"message": "File exceeds recommended 300 lines (320 lines)"
},
{
"type": "missing_section",
"severity": "low",
"message": "Consider adding 'Testing Requirements' section"
}
],
"quality_score": 75,
"recommendations": [
"Split into modular files (backend/CLAUDE.md, frontend/CLAUDE.md)",
"Add testing requirements section",
"Reduce root file to <150 lines"
]
}
}
Generated Content
Complete CLAUDE.md file content or specific sections to add:
# CLAUDE.md
This file provides guidance for Claude Code when working with this project.
## Quick Navigation
- [Backend Guidelines](backend/CLAUDE.md)
- [Frontend Guidelines](frontend/CLAUDE.md)
- [Database Operations](database/CLAUDE.md)
- [CI/CD Workflows](.github/CLAUDE.md)
## Core Principles
1. **Test-Driven Development**: Write tests before implementation
2. **Type Safety First**: Use TypeScript strict mode throughout
3. **Component Composition**: Favor small, reusable components
4. **Error Handling**: Always handle errors with proper logging
5. **Documentation Updates**: Keep docs in sync with code changes
[... additional sections based on template ...]
How to Use
Example 1: Initialize CLAUDE.md for New Project (Interactive)
Hey Claude—I just added the "claude-md-enhancer" skill. I don't have a CLAUDE.md file yet. Can you help me create one for this project?
What Happens:
- Claude checks if CLAUDE.md exists (it doesn't)
- Claude explores your repository using built-in commands
- Claude analyzes: project type, tech stack, team size, workflows
- Claude shows discoveries and asks for confirmation
- You confirm the settings
- Claude creates customized CLAUDE.md file(s)
- Claude enhances with best practices
Interactive Flow:
- ✋ User must confirm before creation
- 🔍 Full visibility into what was discovered
- ⚙️ Option to adjust settings before proceeding
Example 2: Analyze Existing CLAUDE.md
Hey Claude—I just added the "claude-md-enhancer" skill. Can you analyze my current CLAUDE.md file and tell me what's missing or could be improved?
Example 2: Generate New CLAUDE.md for TypeScript Project
Hey Claude—I just added the "claude-md-enhancer" skill. Can you create a CLAUDE.md file for my TypeScript React project with a team of 5 developers? We use PostgreSQL, Docker, and follow TDD practices.
Example 3: Enhance Existing File
Hey Claude—I just added the "claude-md-enhancer" skill. Can you enhance my existing CLAUDE.md by adding missing sections and improving the structure? Here's my current file: [paste content]
Example 4: Generate Modular Architecture
Hey Claude—I just added the "claude-md-enhancer" skill. Can you create a modular CLAUDE.md setup for my full-stack project? I need separate files for backend (Python/FastAPI), frontend (React), and database (PostgreSQL).
Initialization Workflow (New Projects)
When CLAUDE.md doesn't exist in your project, this skill provides an intelligent initialization workflow:
Workflow Steps
Step 1: Detection
- Skill checks if CLAUDE.md exists in project root
- If not found, initialization workflow begins
Step 2: Repository Exploration
- Uses Claude Code's built-in
explore command
- Analyzes project structure, files, and directories
- Examines configuration files (package.json, requirements.txt, go.mod, etc.)
- Reviews existing documentation
Step 3: Intelligent Analysis
- Project Type Detection: web_app, api, fullstack, cli, library, mobile, desktop
- Tech Stack Detection: TypeScript, Python, React, FastAPI, PostgreSQL, Docker, etc.
- Team Size Estimation: Based on project complexity (solo, small, medium, large)
- Development Phase: prototype, mvp, production, enterprise
- Workflow Detection: TDD, CI/CD, documentation-first, agile
- Structure Recommendation: Single file vs. modular architecture
Step 4: User Confirmation ✋
- Displays all discoveries in clear format
- Shows recommended CLAUDE.md structure
- Asks user to confirm or adjust settings
- User must explicitly approve before proceeding
Step 5: File Creation
- Generates customized CLAUDE.md based on confirmed settings
- Creates modular files if recommended (backend/, frontend/, etc.)
- Applies tech-specific best practices
Step 6: Enhancement
- Validates generated content
- Adds quality improvements
- Ensures completeness
Step 7: Summary
- Shows what files were created
- Provides next steps
- Ready for immediate use
Interactive Example
User: "I need a CLAUDE.md for this project"
Claude: "I'll explore your repository first to understand the project.
[Explores using built-in commands]
Based on my exploration, here's what I discovered:
Project Type: Full-Stack Application
Tech Stack: TypeScript, React, Node.js, PostgreSQL, Docker
Team Size: Small (2-9 developers)
Development Phase: MVP
Workflows: TDD, CI/CD
Recommended Structure: Modular architecture
- Root CLAUDE.md (navigation hub)
- backend/CLAUDE.md (API guidelines)
- frontend/CLAUDE.md (React guidelines)
Would you like me to create these files?"
User: "Yes, please proceed"
Claude: "Creating customized CLAUDE.md files...
✅ Created CLAUDE.md (100 lines)
✅ Created backend/CLAUDE.md (150 lines)
✅ Created frontend/CLAUDE.md (175 lines)
Your project is ready for AI-assisted development!"
Scripts
workflow.py
Manages the interactive initialization workflow for new projects.
Key Functions:
check_claude_md_exists() - Detect if CLAUDE.md exists
generate_exploration_prompt() - Guide Claude to explore repository
analyze_discoveries() - Analyze exploration results
generate_confirmation_prompt() - Create user confirmation prompt
get_workflow_steps() - Get complete workflow steps
analyzer.py
Analyzes existing CLAUDE.md files to identify structure, sections, and quality issues.
Key Functions:
analyze_file() - Parse and analyze CLAUDE.md structure
detect_sections() - Identify present and missing sections
calculate_quality_score() - Score file quality (0-100)
generate_recommendations() - Provide actionable improvement suggestions
validator.py
Validates CLAUDE.md files against best practices and Anthropic guidelines.
Key Functions:
validate_length() - Check file length (warn if >300 lines)
validate_structure() - Verify required sections present
validate_formatting() - Check markdown formatting quality
validate_completeness() - Ensure critical information included
generator.py
Generates new CLAUDE.md content or missing sections based on templates.
Key Functions:
generate_root_file() - Create main CLAUDE.md orchestrator
generate_context_file() - Create context-specific files (backend, frontend, etc.)
generate_section() - Generate individual sections (tech stack, workflows, etc.)
merge_with_existing() - Add new sections to existing files
template_selector.py
Selects appropriate template based on project context.
Key Functions:
select_template() - Choose template based on project type and team size
customize_template() - Adapt template to tech stack
determine_complexity() - Calculate appropriate detail level
recommend_modular_structure() - Suggest subdirectory organization
Best Practices
Critical Validation Rule ⚠️
"Always validate your output against official native examples before declaring complete."
Before finalizing any CLAUDE.md generation:
- Compare output against
/update-claude-md slash command format
- Check official Claude Code documentation for required sections
- Verify all native format sections are present (Overview, Project Structure, File Structure, Setup & Installation, Architecture, etc.)
- Cross-check against reference examples in
examples/ folder
For New Projects
- Start with minimal template (50-100 lines) and grow as needed
- Use modular architecture for projects with >3 major components
- Include tech stack reference immediately
- Add workflow instructions before team grows beyond 5 people
For Enhancement
- Analyze before modifying - understand current structure first
- Preserve custom content - only enhance, don't replace
- Validate after changes - ensure improvements don't break existing patterns
- Test with Claude Code - verify guidelines work as intended
General Guidelines
- Keep root file concise - Max 150 lines, use as navigation hub
- Use context-specific files - backend/CLAUDE.md, frontend/CLAUDE.md, etc.
- Avoid duplication - Each guideline should appear once
- Link to external docs - Don't copy official documentation
- Update regularly - Review guidelines quarterly or when stack changes
Limitations
Technical Constraints
- Requires valid project context for accurate template selection
- Tech stack detection is based on keywords, may need manual refinement
- Modular file generation assumes standard directory structure
Scope Boundaries
- Focuses on CLAUDE.md structure, not project-specific business logic
- Best practice recommendations are general, may need industry-specific customization
- Validation is guideline-based, not enforcement (no automated fixes without approval)
When NOT to Use
- For non-Claude AI tools (this is Claude Code specific)
- For projects that don't use Claude Code or similar AI assistants
- When you need highly specialized domain guidelines (legal, medical compliance)
Template Categories
By Size
- Minimal (50 lines) - Solo developers, prototypes, hackathons
- Core (100-150 lines) - Small teams, MVPs, standard projects
- Detailed (200-300 lines) - Large teams, production systems, enterprise
By Project Type
- Web App - Frontend-focused (React, Vue, Angular)
- API - Backend services (REST, GraphQL, microservices)
- Full-Stack - Integrated frontend + backend
- CLI - Command-line tools and utilities
- Library - Reusable packages and frameworks
- Mobile - React Native, Flutter, native iOS/Android
By Tech Stack
- TypeScript/Node - Modern JavaScript ecosystem
- Python - Django, FastAPI, Flask
- Go - Gin, Echo, native services
- Java/Kotlin - Spring Boot, enterprise Java
- Ruby - Rails, Sinatra
Quality Metrics
File Quality Score (0-100)
Calculated based on:
- Length appropriateness (25 points) - Not too short or long
- Section completeness (25 points) - Required sections present
- Formatting quality (20 points) - Proper markdown structure
- Content specificity (15 points) - Tailored to project, not generic
- Modular organization (15 points) - Uses subdirectory files when appropriate
Recommendations Priority
- Critical - Missing required sections, file too long (>400 lines)
- High - Missing important sections, formatting issues
- Medium - Could add optional sections, minor improvements
- Low - Nice-to-have enhancements, stylistic suggestions
Advanced Features
Modular Architecture Support
Automatically generates context-specific files:
project-root/
├── CLAUDE.md # Root orchestrator (100-150 lines)
├── backend/
│ └── CLAUDE.md # Backend-specific (150-200 lines)
├── frontend/
│ └── CLAUDE.md # Frontend-specific (150-200 lines)
├── database/
│ └── CLAUDE.md # Database operations (100-150 lines)
└── .github/
└── CLAUDE.md # CI/CD workflows (100-150 lines)
Tech Stack Detection
Automatically detects technologies from:
package.json (Node.js/TypeScript)
requirements.txt or pyproject.toml (Python)
go.mod (Go)
Cargo.toml (Rust)
pom.xml or build.gradle (Java)
Team Size Adaptation
Adjusts detail level:
- Solo: Minimal guidelines, focus on efficiency
- Small (<10): Core guidelines, workflow basics
- Medium (10-50): Detailed guidelines, team coordination
- Large (50+): Comprehensive guidelines, process enforcement
References
- Anthropic Claude Code Docs: https://docs.claude.com/en/docs/claude-code
- CLAUDE.md Best Practices: Based on community patterns and Anthropic guidance
- Example CLAUDE.md Files: See
examples/ folder for 6 reference implementations covering different project types and team sizes
Version
Version: 1.0.0
Last Updated: November 2025
Compatible: Claude Code 2.0+, Claude Apps, Claude API
Remember: The goal is to make Claude more efficient and context-aware, not to create bureaucracy. Start simple, iterate based on real usage, and automate quality checks where possible.
1---
2name: claude-md-enhancer
3description: Analyzes, generates, and enhances CLAUDE.md files for any project type using best practices, modular architecture support, and tech stack customization. Use when setting up new projects, improving existing CLAUDE.md files, or establishing AI-assisted development standards.
4origin: "https://raw.githubusercontent.com/alirezarezvani/claude-code-skill-factory/main/generated-skills/claude-md-enhancer/SKILL.md"
5---
6
7# CLAUDE.md File Enhancer
8
9This skill provides comprehensive CLAUDE.md file generation and enhancement for Claude Code projects. It analyzes existing files, validates against best practices, and generates customized guidelines tailored to your project type, tech stack, and team size.
10
11## Capabilities
12
13- **🆕 Interactive Initialization**: Intelligent workflow that explores your repository, detects project type and tech stack, asks for confirmation, then creates customized CLAUDE.md files
14- **✨ 100% Native Format Compliance**: All generated files follow official Claude Code format with project structure diagrams, setup instructions, architecture sections, and file structure explanations (matching `/update-claude-md` slash command)
15- **Analyze Existing Files**: Scan and evaluate current CLAUDE.md files for structure, completeness, and quality
16- **Validate Best Practices**: Check against Anthropic guidelines (file length, required sections, formatting standards)
17- **Generate New Files**: Create complete CLAUDE.md files from scratch for new projects
18- **Enhance Existing Files**: Add missing sections, improve structure, and update to latest best practices
19- **Modular Architecture**: Support context-specific CLAUDE.md files in subdirectories (backend/, frontend/, docs/)
20- **Tech Stack Customization**: Tailor guidelines to specific technologies (TypeScript, Python, Go, React, Vue, etc.)
21- **Team Size Adaptation**: Adjust complexity based on team size (solo, small <10, large 10+)
22- **Template Selection**: Choose appropriate template based on project complexity and development phase
23
24## Input Requirements
25
26### For Analysis and Enhancement
27
28Provide existing CLAUDE.md file content or file path:
29
30```json
31{
32 "mode": "enhance",
33 "file_path": "CLAUDE.md",
34 "content": "[existing CLAUDE.md content]",
35 "project_context": {
36 "type": "web_app",
37 "tech_stack": ["typescript", "react", "node", "postgresql"],
38 "team_size": "small",
39 "phase": "mvp"
40 }
41}
42```
43
44### For New File Generation
45
46Provide project context:
47
48```json
49{
50 "mode": "create",
51 "project_context": {
52 "type": "api",
53 "tech_stack": ["python", "fastapi", "postgresql", "docker"],
54 "team_size": "medium",
55 "phase": "production",
56 "workflows": ["tdd", "cicd", "documentation_first"]
57 },
58 "modular": true,
59 "subdirectories": ["backend", "database", "docs"]
60}
61```
62
63### Context Parameters
64
65- **type**: Project type (`web_app`, `api`, `fullstack`, `cli`, `library`, `mobile`, `desktop`)
66- **tech_stack**: Array of technologies (e.g., `["typescript", "react", "node"]`)
67- **team_size**: `solo`, `small` (<10), `medium` (10-50), `large` (50+)
68- **phase**: Development phase (`prototype`, `mvp`, `production`, `enterprise`)
69- **workflows**: Key workflows (`tdd`, `cicd`, `documentation_first`, `agile`, etc.)
70
71## Output Formats
72
73### Analysis Report
74
75```json
76{
77 "analysis": {
78 "file_size": 450,
79 "line_count": 320,
80 "sections_found": [
81 "Quick Navigation",
82 "Core Principles",
83 "Tech Stack",
84 "Workflow Instructions"
85 ],
86 "missing_sections": [
87 "Testing Requirements",
88 "Error Handling Patterns"
89 ],
90 "issues": [
91 {
92 "type": "length_warning",
93 "severity": "medium",
94 "message": "File exceeds recommended 300 lines (320 lines)"
95 },
96 {
97 "type": "missing_section",
98 "severity": "low",
99 "message": "Consider adding 'Testing Requirements' section"
100 }
101 ],
102 "quality_score": 75,
103 "recommendations": [
104 "Split into modular files (backend/CLAUDE.md, frontend/CLAUDE.md)",
105 "Add testing requirements section",
106 "Reduce root file to <150 lines"
107 ]
108 }
109}
110```
111
112### Generated Content
113
114Complete CLAUDE.md file content or specific sections to add:
115
116```markdown
117# CLAUDE.md
118
119This file provides guidance for Claude Code when working with this project.
120
121## Quick Navigation
122
123- [Backend Guidelines](backend/CLAUDE.md)
124- [Frontend Guidelines](frontend/CLAUDE.md)
125- [Database Operations](database/CLAUDE.md)
126- [CI/CD Workflows](.github/CLAUDE.md)
127
128## Core Principles
129
1301. **Test-Driven Development**: Write tests before implementation
1312. **Type Safety First**: Use TypeScript strict mode throughout
1323. **Component Composition**: Favor small, reusable components
1334. **Error Handling**: Always handle errors with proper logging
1345. **Documentation Updates**: Keep docs in sync with code changes
135
136[... additional sections based on template ...]
137```
138
139## How to Use
140
141### Example 1: Initialize CLAUDE.md for New Project (Interactive)
142
143```
144Hey Claude—I just added the "claude-md-enhancer" skill. I don't have a CLAUDE.md file yet. Can you help me create one for this project?
145```
146
147**What Happens**:
1481. Claude checks if CLAUDE.md exists (it doesn't)
1492. Claude explores your repository using built-in commands
1503. Claude analyzes: project type, tech stack, team size, workflows
1514. Claude shows discoveries and asks for confirmation
1525. You confirm the settings
1536. Claude creates customized CLAUDE.md file(s)
1547. Claude enhances with best practices
155
156**Interactive Flow**:
157- ✋ User must confirm before creation
158- 🔍 Full visibility into what was discovered
159- ⚙️ Option to adjust settings before proceeding
160
161### Example 2: Analyze Existing CLAUDE.md
162
163```
164Hey Claude—I just added the "claude-md-enhancer" skill. Can you analyze my current CLAUDE.md file and tell me what's missing or could be improved?
165```
166
167### Example 2: Generate New CLAUDE.md for TypeScript Project
168
169```
170Hey Claude—I just added the "claude-md-enhancer" skill. Can you create a CLAUDE.md file for my TypeScript React project with a team of 5 developers? We use PostgreSQL, Docker, and follow TDD practices.
171```
172
173### Example 3: Enhance Existing File
174
175```
176Hey Claude—I just added the "claude-md-enhancer" skill. Can you enhance my existing CLAUDE.md by adding missing sections and improving the structure? Here's my current file: [paste content]
177```
178
179### Example 4: Generate Modular Architecture
180
181```
182Hey Claude—I just added the "claude-md-enhancer" skill. Can you create a modular CLAUDE.md setup for my full-stack project? I need separate files for backend (Python/FastAPI), frontend (React), and database (PostgreSQL).
183```
184
185## Initialization Workflow (New Projects)
186
187When CLAUDE.md doesn't exist in your project, this skill provides an intelligent initialization workflow:
188
189### Workflow Steps
190
191**Step 1: Detection**
192- Skill checks if CLAUDE.md exists in project root
193- If not found, initialization workflow begins
194
195**Step 2: Repository Exploration**
196- Uses Claude Code's built-in `explore` command
197- Analyzes project structure, files, and directories
198- Examines configuration files (package.json, requirements.txt, go.mod, etc.)
199- Reviews existing documentation
200
201**Step 3: Intelligent Analysis**
202- **Project Type Detection**: web_app, api, fullstack, cli, library, mobile, desktop
203- **Tech Stack Detection**: TypeScript, Python, React, FastAPI, PostgreSQL, Docker, etc.
204- **Team Size Estimation**: Based on project complexity (solo, small, medium, large)
205- **Development Phase**: prototype, mvp, production, enterprise
206- **Workflow Detection**: TDD, CI/CD, documentation-first, agile
207- **Structure Recommendation**: Single file vs. modular architecture
208
209**Step 4: User Confirmation** ✋
210- Displays all discoveries in clear format
211- Shows recommended CLAUDE.md structure
212- Asks user to confirm or adjust settings
213- **User must explicitly approve** before proceeding
214
215**Step 5: File Creation**
216- Generates customized CLAUDE.md based on confirmed settings
217- Creates modular files if recommended (backend/, frontend/, etc.)
218- Applies tech-specific best practices
219
220**Step 6: Enhancement**
221- Validates generated content
222- Adds quality improvements
223- Ensures completeness
224
225**Step 7: Summary**
226- Shows what files were created
227- Provides next steps
228- Ready for immediate use
229
230### Interactive Example
231
232```
233User: "I need a CLAUDE.md for this project"
234
235Claude: "I'll explore your repository first to understand the project.
236 [Explores using built-in commands]
237
238 Based on my exploration, here's what I discovered:
239
240 Project Type: Full-Stack Application
241 Tech Stack: TypeScript, React, Node.js, PostgreSQL, Docker
242 Team Size: Small (2-9 developers)
243 Development Phase: MVP
244 Workflows: TDD, CI/CD
245
246 Recommended Structure: Modular architecture
247 - Root CLAUDE.md (navigation hub)
248 - backend/CLAUDE.md (API guidelines)
249 - frontend/CLAUDE.md (React guidelines)
250
251 Would you like me to create these files?"
252
253User: "Yes, please proceed"
254
255Claude: "Creating customized CLAUDE.md files...
256 ✅ Created CLAUDE.md (100 lines)
257 ✅ Created backend/CLAUDE.md (150 lines)
258 ✅ Created frontend/CLAUDE.md (175 lines)
259
260 Your project is ready for AI-assisted development!"
261```
262
263## Scripts
264
265### workflow.py
266Manages the interactive initialization workflow for new projects.
267
268**Key Functions**:
269- `check_claude_md_exists()` - Detect if CLAUDE.md exists
270- `generate_exploration_prompt()` - Guide Claude to explore repository
271- `analyze_discoveries()` - Analyze exploration results
272- `generate_confirmation_prompt()` - Create user confirmation prompt
273- `get_workflow_steps()` - Get complete workflow steps
274
275### analyzer.py
276Analyzes existing CLAUDE.md files to identify structure, sections, and quality issues.
277
278**Key Functions**:
279- `analyze_file()` - Parse and analyze CLAUDE.md structure
280- `detect_sections()` - Identify present and missing sections
281- `calculate_quality_score()` - Score file quality (0-100)
282- `generate_recommendations()` - Provide actionable improvement suggestions
283
284### validator.py
285Validates CLAUDE.md files against best practices and Anthropic guidelines.
286
287**Key Functions**:
288- `validate_length()` - Check file length (warn if >300 lines)
289- `validate_structure()` - Verify required sections present
290- `validate_formatting()` - Check markdown formatting quality
291- `validate_completeness()` - Ensure critical information included
292
293### generator.py
294Generates new CLAUDE.md content or missing sections based on templates.
295
296**Key Functions**:
297- `generate_root_file()` - Create main CLAUDE.md orchestrator
298- `generate_context_file()` - Create context-specific files (backend, frontend, etc.)
299- `generate_section()` - Generate individual sections (tech stack, workflows, etc.)
300- `merge_with_existing()` - Add new sections to existing files
301
302### template_selector.py
303Selects appropriate template based on project context.
304
305**Key Functions**:
306- `select_template()` - Choose template based on project type and team size
307- `customize_template()` - Adapt template to tech stack
308- `determine_complexity()` - Calculate appropriate detail level
309- `recommend_modular_structure()` - Suggest subdirectory organization
310
311## Best Practices
312
313### Critical Validation Rule ⚠️
314
315**"Always validate your output against official native examples before declaring complete."**
316
317Before finalizing any CLAUDE.md generation:
3181. Compare output against `/update-claude-md` slash command format
3192. Check official Claude Code documentation for required sections
3203. Verify all native format sections are present (Overview, Project Structure, File Structure, Setup & Installation, Architecture, etc.)
3214. Cross-check against reference examples in `examples/` folder
322
323### For New Projects
3241. Start with minimal template (50-100 lines) and grow as needed
3252. Use modular architecture for projects with >3 major components
3263. Include tech stack reference immediately
3274. Add workflow instructions before team grows beyond 5 people
328
329### For Enhancement
3301. Analyze before modifying - understand current structure first
3312. Preserve custom content - only enhance, don't replace
3323. Validate after changes - ensure improvements don't break existing patterns
3334. Test with Claude Code - verify guidelines work as intended
334
335### General Guidelines
3361. **Keep root file concise** - Max 150 lines, use as navigation hub
3372. **Use context-specific files** - backend/CLAUDE.md, frontend/CLAUDE.md, etc.
3383. **Avoid duplication** - Each guideline should appear once
3394. **Link to external docs** - Don't copy official documentation
3405. **Update regularly** - Review guidelines quarterly or when stack changes
341
342## Limitations
343
344### Technical Constraints
345- Requires valid project context for accurate template selection
346- Tech stack detection is based on keywords, may need manual refinement
347- Modular file generation assumes standard directory structure
348
349### Scope Boundaries
350- Focuses on CLAUDE.md structure, not project-specific business logic
351- Best practice recommendations are general, may need industry-specific customization
352- Validation is guideline-based, not enforcement (no automated fixes without approval)
353
354### When NOT to Use
355- For non-Claude AI tools (this is Claude Code specific)
356- For projects that don't use Claude Code or similar AI assistants
357- When you need highly specialized domain guidelines (legal, medical compliance)
358
359## Template Categories
360
361### By Size
362- **Minimal** (50 lines) - Solo developers, prototypes, hackathons
363- **Core** (100-150 lines) - Small teams, MVPs, standard projects
364- **Detailed** (200-300 lines) - Large teams, production systems, enterprise
365
366### By Project Type
367- **Web App** - Frontend-focused (React, Vue, Angular)
368- **API** - Backend services (REST, GraphQL, microservices)
369- **Full-Stack** - Integrated frontend + backend
370- **CLI** - Command-line tools and utilities
371- **Library** - Reusable packages and frameworks
372- **Mobile** - React Native, Flutter, native iOS/Android
373
374### By Tech Stack
375- **TypeScript/Node** - Modern JavaScript ecosystem
376- **Python** - Django, FastAPI, Flask
377- **Go** - Gin, Echo, native services
378- **Java/Kotlin** - Spring Boot, enterprise Java
379- **Ruby** - Rails, Sinatra
380
381## Quality Metrics
382
383### File Quality Score (0-100)
384
385Calculated based on:
386- **Length appropriateness** (25 points) - Not too short or long
387- **Section completeness** (25 points) - Required sections present
388- **Formatting quality** (20 points) - Proper markdown structure
389- **Content specificity** (15 points) - Tailored to project, not generic
390- **Modular organization** (15 points) - Uses subdirectory files when appropriate
391
392### Recommendations Priority
393
394- **Critical** - Missing required sections, file too long (>400 lines)
395- **High** - Missing important sections, formatting issues
396- **Medium** - Could add optional sections, minor improvements
397- **Low** - Nice-to-have enhancements, stylistic suggestions
398
399## Advanced Features
400
401### Modular Architecture Support
402
403Automatically generates context-specific files:
404
405```
406project-root/
407├── CLAUDE.md # Root orchestrator (100-150 lines)
408├── backend/
409│ └── CLAUDE.md # Backend-specific (150-200 lines)
410├── frontend/
411│ └── CLAUDE.md # Frontend-specific (150-200 lines)
412├── database/
413│ └── CLAUDE.md # Database operations (100-150 lines)
414└── .github/
415 └── CLAUDE.md # CI/CD workflows (100-150 lines)
416```
417
418### Tech Stack Detection
419
420Automatically detects technologies from:
421- `package.json` (Node.js/TypeScript)
422- `requirements.txt` or `pyproject.toml` (Python)
423- `go.mod` (Go)
424- `Cargo.toml` (Rust)
425- `pom.xml` or `build.gradle` (Java)
426
427### Team Size Adaptation
428
429Adjusts detail level:
430- **Solo**: Minimal guidelines, focus on efficiency
431- **Small (<10)**: Core guidelines, workflow basics
432- **Medium (10-50)**: Detailed guidelines, team coordination
433- **Large (50+)**: Comprehensive guidelines, process enforcement
434
435## References
436
437- **Anthropic Claude Code Docs**: https://docs.claude.com/en/docs/claude-code
438- **CLAUDE.md Best Practices**: Based on community patterns and Anthropic guidance
439- **Example CLAUDE.md Files**: See `examples/` folder for 6 reference implementations covering different project types and team sizes
440
441## Version
442
443**Version**: 1.0.0
444**Last Updated**: November 2025
445**Compatible**: Claude Code 2.0+, Claude Apps, Claude API
446
447Remember: The goal is to make Claude more efficient and context-aware, not to create bureaucracy. Start simple, iterate based on real usage, and automate quality checks where possible.