espocrm-development

Enforce EspoCRM service-layer architecture and EntityManager data access.

146|31|Updated Jul 25, 2025
One-click install
npx skills add https://github.com/bobmatnyc/claude-mpm --skill espocrm-development
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: espocrm-development
Source: https://github.com/bobmatnyc/claude-mpm/tree/main/src/claude_mpm/skills/bundled/php/espocrm-development
Command: npx skills add https://github.com/bobmatnyc/claude-mpm --skill espocrm-development

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

A comprehensive guide for building EspoCRM extensions, modules, hooks, services, and APIs following the framework's metadata-driven architecture.

Core Features & Use Cases

  • Enforce service-layer architecture and avoid business logic in hooks
  • Provide examples for EntityManager usage and service classes
  • Include code structure guidance for EspoCRM extensions

Quick Start

  1. Setup environment and read architecture docs
  2. Use EntityManager for data access
  3. Implement business logic in Services

Frequently Asked Questions about espocrm-development

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure business logic in EspoCRM custom modules?

Business logic in EspoCRM must reside in Service classes, not in hooks or controllers. Services handle domain operations, EntityManager manages all data access, and dependency injection wires components together. This separation keeps your code testable and maintainable across custom modules and integrations.

What's the correct way to access and modify data in EspoCRM?

Always use EntityManager for all data access operations in EspoCRM. Never bypass it with direct database queries or Container access. EntityManager enforces metadata consistency, handles relationships correctly, and integrates with the ORM layer—essential for custom entities, relationships, and lifecycle hooks.

Why do I need to rebuild cache after changing EspoCRM metadata?

EspoCRM uses metadata-driven configuration to define entities, relationships, and service behaviors. Rebuilding cache after metadata changes ensures the framework reflects your new structure in all components. Skip this step and your custom entities, fields, or API endpoints won't recognize the updates.

How do I implement hooks and event handlers without breaking EspoCRM architecture?

Hooks should delegate business logic to Service classes rather than contain it directly. Use dependency injection to access Services from hooks, and let Services call EntityManager for data operations. This pattern keeps hooks thin and preserves the service-layer architecture across custom modules.

Can I use the Container directly in EspoCRM services and hooks?

No—direct Container usage violates EspoCRM's dependency injection pattern. Inject only the specific services your code needs. This prevents tight coupling, makes testing easier, and ensures your custom modules integrate cleanly with the metadata-driven framework.

What's the entry point for building EspoCRM integrations and custom APIs?

Start with the architecture documentation and understand the metadata-driven design. Create Service classes for business logic, use EntityManager for data access, and expose APIs through controllers that delegate to Services. This foundation applies to integrations, custom modules, relationships, and lifecycle event handling.