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