Referencia Completa de Claude Code
Patrones de desarrollo de agentes empresariales con Claude Code. Configuración de proyectos, orquestación de agentes, servidores MCP, hooks y estrategias de despliegue en producción.
This template includes both English and Spanish versions. Scroll down to find "Versión Española".
Claude Code Complete Reference
Template provided by VORLUX AI | vorluxai.com
What Is Claude Code?
Claude Code is Anthropic’s official CLI tool for agentic software development. Unlike chat interfaces, Claude Code operates directly in your terminal with full access to your filesystem, git repositories, and development tools. It can read, write, and execute code — making it a true AI pair programmer rather than a suggestion engine.
For enterprise teams, Claude Code transforms individual developer productivity by 3-5x on routine tasks: code generation, refactoring, debugging, test writing, and documentation.
Project Setup
CLAUDE.md — The Project Brain
Every Claude Code project starts with a CLAUDE.md file at the repository root. This file provides persistent context that Claude reads at the start of every session:
# Project Name
## Architecture
- Framework: Astro + React
- Database: PostgreSQL with Drizzle ORM
- Deployment: Self-hosted on Mac cluster
## Conventions
- All API routes return { success, data, error } envelope
- Tests required for all new endpoints
- British English in all documentation
## Key Files
- src/lib/db.ts — database connection
- src/lib/auth.ts — authentication middleware
Best practice: Keep CLAUDE.md under 500 lines. Link to detailed docs rather than inlining everything. Update it as the project evolves.
Agent Orchestration Patterns
Single Agent (Default)
One Claude Code instance handles the full task. Suitable for 90% of development work.
claude "Add pagination to the /api/users endpoint with limit and offset parameters"
Multi-Agent via Subagents
For complex tasks, Claude Code can spawn sub-agents to work in parallel:
Main Agent: "Implement the new billing module"
├── Sub-agent 1: Write the database schema and migrations
├── Sub-agent 2: Implement the API routes
└── Sub-agent 3: Write integration tests
Subagents inherit the project context from CLAUDE.md but run independently. The main agent coordinates their outputs.
Headless Mode (CI/CD)
Run Claude Code non-interactively in pipelines:
claude -p "Review this PR for security issues" --output-format json
The --output-format json flag returns structured output suitable for automated processing.
MCP Servers
Model Context Protocol (MCP) servers extend Claude Code’s capabilities by providing access to external tools and data sources:
// .claude/settings.json
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@anthropic-ai/mcp-filesystem", "/path/to/allowed/dir"]
},
"database": {
"command": "npx",
"args": ["-y", "@anthropic-ai/mcp-postgres", "postgresql://..."]
}
}
}
Common MCP servers for enterprise:
| Server | Purpose |
|---|---|
| filesystem | Controlled file access |
| postgres / sqlite | Database queries |
| github | Repository operations |
| memory | Persistent knowledge graph |
| sequential-thinking | Enhanced reasoning |
Hooks System
Hooks automate quality checks before and after Claude Code’s tool usage:
PostToolUse — Auto-Format on Save
{
"hooks": {
"PostToolUse": [
{
"matcher": "Write|Edit",
"command": "pnpm prettier --write \"$FILE_PATH\"",
"description": "Format edited files"
}
]
}
}
PreToolUse — Block Large Files
{
"hooks": {
"PreToolUse": [
{
"matcher": "Write",
"command": "check-file-size.sh",
"description": "Block writes exceeding 800 lines"
}
]
}
}
Stop — Final Build Check
{
"hooks": {
"Stop": [
{
"command": "pnpm build && pnpm test",
"description": "Verify build and tests pass before session ends"
}
]
}
}
Slash Commands and Custom Skills
Define reusable workflows as slash commands in .claude/commands/:
<!-- .claude/commands/deploy.md -->
# Deploy to production
1. Run the full test suite
2. Build the production bundle
3. Run database migrations
4. Deploy to the production server
5. Verify the health endpoint returns 200
6. Report deployment status
Invoke with: /deploy
Production Patterns
1. Context Window Management
Claude Code’s context window is large but finite. For long sessions:
- Start new sessions for unrelated tasks
- Keep CLAUDE.md focused and concise
- Use
compactwhen context grows large - Reference files by path rather than pasting content
2. Deterministic Outputs
For CI/CD pipelines and automated workflows:
- Use
--output-format jsonfor machine-readable output - Set explicit temperature via system prompts
- Validate outputs with schemas before acting on them
3. Security
- Never store API keys in CLAUDE.md or committed files
- Use
.envfiles with.gitignoreexclusion - Review all generated code before committing to production branches
- Set
allowedToolsto restrict tool access in sensitive environments
4. Cost Control
- Use prompt caching (CLAUDE.md is automatically cached)
- Route simple tasks to smaller models when available
- Set spending limits in the Anthropic Console
- Monitor usage with the API dashboard
Enterprise Deployment Checklist
- CLAUDE.md created with project architecture and conventions
- MCP servers configured for required integrations
- Hooks set up for formatting, linting, and build verification
- Custom slash commands for team workflows
- API key stored in environment variables, not source code
- Spending limits configured per team/project
- CI/CD integration tested in headless mode
Need help deploying Claude Code across your engineering team? Contact VORLUX AI for enterprise setup and training.
Versión Española
Referencia Completa de Claude Code
Plantilla proporcionada por VORLUX AI | vorluxai.com
¿Qué es Claude Code?
Claude Code es la herramienta CLI oficial de Anthropic para desarrollo de software agéntico. A diferencia de las interfaces de chat, Claude Code opera directamente en su terminal con acceso completo a su sistema de archivos, repositorios git y herramientas de desarrollo. Puede leer, escribir y ejecutar código — convirtiéndolo en un verdadero programador IA en pareja en lugar de un motor de sugerencias.
Para equipos empresariales, Claude Code transforma la productividad individual del desarrollador en 3-5x en tareas rutinarias: generación de código, refactorización, depuración, escritura de tests y documentación.
Configuración del Proyecto
CLAUDE.md — El Cerebro del Proyecto
Todo proyecto con Claude Code comienza con un archivo CLAUDE.md en la raíz del repositorio. Este archivo proporciona contexto persistente que Claude lee al inicio de cada sesión.
Mejor práctica: Mantenga CLAUDE.md por debajo de 500 líneas. Enlace a documentación detallada en lugar de incluir todo en línea. Actualícelo conforme el proyecto evolucione.
Patrones de Orquestación de Agentes
Agente Único (Por Defecto)
Una instancia de Claude Code maneja la tarea completa. Adecuado para el 90% del trabajo de desarrollo.
Multi-Agente via Subagentes
Para tareas complejas, Claude Code puede lanzar sub-agentes para trabajar en paralelo. Los subagentes heredan el contexto del proyecto desde CLAUDE.md pero se ejecutan independientemente. El agente principal coordina sus salidas.
Modo Headless (CI/CD)
Ejecute Claude Code de forma no interactiva en pipelines con --output-format json para salida estructurada apta para procesamiento automatizado.
Servidores MCP
Los servidores del Protocolo de Contexto de Modelo (MCP) amplían las capacidades de Claude Code proporcionando acceso a herramientas externas y fuentes de datos.
Servidores MCP comunes para empresa:
| Servidor | Propósito |
|---|---|
| filesystem | Acceso controlado a archivos |
| postgres / sqlite | Consultas a base de datos |
| github | Operaciones de repositorio |
| memory | Grafo de conocimiento persistente |
| sequential-thinking | Razonamiento mejorado |
Sistema de Hooks
Los hooks automatizan verificaciones de calidad antes y después del uso de herramientas de Claude Code:
- PostToolUse — Auto-formateo al guardar (ej: Prettier)
- PreToolUse — Bloquear archivos grandes (ej: límite de 800 líneas)
- Stop — Verificación final de build antes de cerrar sesión
Comandos Slash y Skills Personalizados
Defina flujos de trabajo reutilizables como comandos slash en .claude/commands/. Invoque con: /nombre-del-comando
Patrones de Producción
- Gestión de ventana de contexto — Inicie nuevas sesiones para tareas no relacionadas, mantenga CLAUDE.md conciso
- Salidas deterministas — Use
--output-format jsonpara CI/CD, valide con esquemas - Seguridad — Nunca almacene claves API en código fuente, use
.envcon.gitignore - Control de costes — Use caché de prompts, establezca límites de gasto, monitorice uso
Checklist de Despliegue Empresarial
- CLAUDE.md creado con arquitectura y convenciones del proyecto
- Servidores MCP configurados para integraciones requeridas
- Hooks configurados para formateo, linting y verificación de build
- Comandos slash personalizados para flujos del equipo
- Clave API almacenada en variables de entorno, no en código fuente
- Límites de gasto configurados por equipo/proyecto
- Integración CI/CD probada en modo headless
¿Necesita ayuda desplegando Claude Code en su equipo de ingeniería? Contacte con VORLUX AI para configuración empresarial y formación.