# manage-services > Define and implement OFBiz services. Use when creating new services in services.xml, modifying attributes, or debugging dispatcher. - Author: toaditi - Repository: toaditi/ofbiz-dev-agent-skills - Version: 20260124175846 - Stars: 0 - Forks: 0 - Last Updated: 2026-02-06 - Source: https://github.com/toaditi/ofbiz-dev-agent-skills - Web: https://mule.run/skillshub/@@toaditi/ofbiz-dev-agent-skills~manage-services:20260124175846 --- --- name: manage-services description: Define and implement OFBiz services. Use when creating new services in services.xml, modifying attributes, or debugging dispatcher. --- # Skill: manage-services (v1.0) ## Goal Define and implement OFBiz services. ## Triggers **ALWAYS** read this skill when: - Defining new services in `services.xml`. - Modifying service attributes or logic. - Debugging service dispatcher or validation errors. ## Use when - Creating scalable business logic. - Exposing functionality to UI/API. - Orchestrating multiple steps. ## Dont use when - Logic is purely internal helper (use private Java/Groovy method). - Logic is trivial UI preparation (use Groovy script directly in screen/action). ## Inputs - required: Name, Engine, Location - optional: Attributes, Auth ## Outputs - Service definition in `servicedef/services.xml`. ## Procedure 1. **Select Engine**: - `entity-auto`: **PREFERRED** for standard CRUD (Create, Update, Delete) to reduce boilerplate. ALWAYS use for simple entity maintenance. - `groovy`: Data preparation for UI/API, complex filtering, business logic adaptations. - `java`: Core domain logic, strict typing, performance-critical operations. - `minilang`: Orchestration (only if legacy pattern requires it, otherwise prefer Groovy/Java). 2. Define in `servicedef/services.xml`. - **Transactions**: Manage declaratively (`require-new-transaction="true"` for critical flows) in `services.xml` rather than programmatically. 3. Implement logic in the specified `location`. ## Guardrails - **Naming**: `verb` + `Noun` (e.g., `createProduct`). - **Paths**: ALWAYS use `component:///...`. - **Validation**: Check against `framework/service/dtd/services.xsd`. - **Testing**: Add `testdef/` entry for every new service (local only). ## Failure handling - **Service Not Found**: Check name spelling and `ofbiz-component.xml` loading. - **Engine Error**: Check `invoke` method matches implementation name. ## Examples **Example A (Entity-Auto Service)**: Input: createProduct Output: ```xml Create a Product ``` **Example B (Groovy Service)**: Input: runTask Output: ```xml ```