Configurando archivos CLAUDE.md
Configurar proyecto-specific settings and context to maximize Claude Code's effectiveness for your specific projects.
What is CLAUDE.md?
CLAUDE.md is a special configuration file that allows you to provide persistent context and proyecto-specific settings to Claude Code. It helps Claude understand your proyecto better and provide more accurate assistance.
Key Benefits
- Persistent proyecto context across sessions
- Custom configuration for proyecto-specific needs
- Improved código recommendations
- Better understanding of proyecto architecture
- Reduced need for repetitive explanations
Creating a Basic CLAUDE.md File
Let's Iniciar with a basic CLAUDE.md file structure:
Step 1: Create the File
tutorials.claudeMdSetup.creating.step1.description
# Project: My Awesome App ## Project Description A brief description of what your project does and its main features. ## Tech Stack - Frontend: React, TypeScript - Backend: Node.js, Express - Database: MongoDB - Testing: Jest, React Testing Library ## Code Conventions - We use Prettier for formatting - ESLint for linting - Functional components with hooks for React - 2-space indentation - camelCase for variables and functions - PascalCase for components and classes ## Project Structure - /src - Main source code - /components - React components - /pages - Page components - /api - API routes - /utils - Utility functions - /hooks - Custom React hooks - /styles - CSS/SCSS files - /public - Static assets - /tests - Test files
Step 2: Add Context-Specific Sections
Enhance your CLAUDE.md with more specific context:
## Important Notes - User authentication uses JWT stored in HttpOnly cookies - API calls should use the client utility in /src/utils/api.ts - New components should have a companion test file - State management uses React Context + useReducer ## Known Issues - Performance issues with large data sets in the dashboard component - Mobile menu animation is choppy on older iOS devices ## Future Plans - Implementing real-time updates with WebSockets - Adding a dark mode theme - Migrating to Next.js for improved SEO
Avanzado Configuration
Take your CLAUDE.md file to the next level with these Avanzado Características:
Custom Instructions
Add specific instructions for how Claude should behave when working with your proyecto:
## Instructions for Claude - Always suggest TypeScript types for new functions - Prioritize performance optimizations - Use React Query for data fetching - Follow the existing error handling pattern - Include JSDoc comments for public functions - Prefer functional programming approaches
Environment Configuration
Provide information about the desarrollo environment:
## Environment Setup - Node.js v16+ - npm scripts: - `npm start` - Start development server - `npm test` - Run tests - `npm run build` - Build for production - `npm run lint` - Run linter - Environment variables (examples, not actual values): - API_URL=http://localhost:3001 - DEBUG=false - FEATURE_FLAGS_ENABLED=true
Architecture Diagrams
Include Mermaid diagrams to visualize architecture:
## Architecture
```mermaid
graph TD
A[Client] --> B[API Gateway]
B --> C[Auth Service]
B --> D[User Service]
B --> E[Content Service]
C --> F[(Auth DB)]
D --> G[(User DB)]
E --> H[(Content DB)]
```
## Component Relationships
```mermaid
graph TD
A[App] --> B[Layout]
B --> C[Header]
B --> D[Main Content]
B --> E[Footer]
D --> F[Dashboard]
F --> G[UserStats]
F --> H[ActivityFeed]
F --> I[Recommendations]
```Mejores Prácticas
Follow these best practices for maintaining effective CLAUDE.md files:
Keep It Updated
- Update CLAUDE.md whenever proyecto architecture changes
- Add new sections as proyecto complexity grows
- Remove outdated information
- Treat it as living Documentación
Use Multiple CLAUDE.md Files
For larger projects, consider using multiple CLAUDE.md files in different directories:
- tutorials.claudeMdSetup.bestPractices.multipleFiles.items.0
- tutorials.claudeMdSetup.bestPractices.multipleFiles.items.1
- tutorials.claudeMdSetup.bestPractices.multipleFiles.items.2
- tutorials.claudeMdSetup.bestPractices.multipleFiles.items.3
Version Control
- Commit CLAUDE.md to your repository
- Review changes to CLAUDE.md during código reviews
- Consider adding CLAUDE.md updates to your Definition of Done
Related Tutoriales
Explorar these related Tutoriales to enhance your Claude Code flujo de trabajo:
- Aprende cómo use the /clear command effectively for context management
- Master Git integration best practices with Claude Code
- Check out Avanzado context management techniques