Design and implement service layer classes for Frappe Framework v15 with proper business logic separation. Triggers: "create service", "add service layer", "frappe service", "business logic", "/frappe-service". Generates service classes with validation, orchestration, and integration patterns.
View on GitHubFebruary 2, 2026
Select agents to install to:
npx add-skill https://github.com/sergio-bershadsky/ai/blob/main/plugins/frappe-dev/skills/frappe-service/SKILL.md -a claude-code --skill frappe-serviceInstallation paths:
.claude/skills/frappe-service/# Frappe Service Layer Design
Create well-structured service layer classes that encapsulate business logic, coordinate between repositories, and provide clean interfaces for controllers and APIs.
## When to Use
- Implementing complex business logic
- Coordinating operations across multiple DocTypes
- Creating reusable business operations
- Separating concerns between controllers and data access
- Building transaction-aware operations
## Arguments
```
/frappe-service <service_name> [--doctype <doctype>] [--operations <op1,op2>]
```
**Examples:**
```
/frappe-service OrderProcessing --doctype "Sales Order"
/frappe-service InventoryManagement --operations allocate,release,transfer
/frappe-service PaymentGateway
```
## Procedure
### Step 1: Gather Service Requirements
Ask the user for:
1. **Service Name** (PascalCase, e.g., `OrderProcessingService`)
2. **Primary DocType** (if applicable)
3. **Key Operations** to implement
4. **External Integrations** (APIs, payment gateways, etc.)
5. **Transaction Requirements** (atomic operations, rollback needs)
### Step 2: Design Service Architecture
Determine the service pattern:
| Pattern | Use Case | Example |
|---------|----------|---------|
| CRUD Service | Basic DocType operations | `CustomerService` |
| Workflow Service | State transitions, approvals | `ApprovalService` |
| Integration Service | External API calls | `PaymentGatewayService` |
| Orchestration Service | Multi-DocType coordination | `OrderFulfillmentService` |
| Batch Service | Bulk operations | `BulkImportService` |
### Step 3: Generate Service Class
Create `<app>/<module>/services/<service_name>.py`:
```python
"""
<Service Name> Service
<Detailed description of what this service handles>
Responsibilities:
- <Responsibility 1>
- <Responsibility 2>
- <Responsibility 3>
Usage:
from <app>.<module>.services.<service_name> import <ServiceName>Service
service = <ServiceName>Service()
result = service.process_order(order_data)