원클릭으로
goravel-crud-service
Generate the service layer for a Goravel entity with builder pattern configuration. Use after model generation.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Generate the service layer for a Goravel entity with builder pattern configuration. Use after model generation.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Create a broadcast notification system that sends notifications and messages to eligible users based on entity-specific criteria. Use when adding a new entity type that needs to notify users when records are created, updated, or published.
Guide for building non-CRUD pages with consistent design. Use when creating portal pages, custom views, detail modals, sidebar widgets, notification drawers, or any page that is not a standard CRUD table. Covers fullscreen modals, minimal text patterns, calendar widgets, doorbell notifications, optimistic updates, and CrudPage read-only integration.
Guide for building dashboards, charts, KPI cards, and data visualizations. Use when creating dashboard pages, adding charts to features, building stat displays, aggregating data for visual presentation, or implementing export (CSV/PNG/fullscreen) for charts. Based on the Books dashboard implementation using Recharts and shadcn/ui chart components.
Deploy the application to staging or production. Validates, builds, pushes Docker image, deploys via Helm, and runs smoke tests.
Run a comprehensive E2E browser test suite for a newly scaffolded Goravel entity. Tests navigation, CRUD operations, search, filters, row actions, form validation, FK dropdowns, and cross-entity integration using Playwright MCP.
Create a Go database seeder for a Goravel entity with 25+ realistic records. Covers all status/enum values, diverse data for sorting/pagination testing, and proper nullable field handling.
| name | goravel-crud-service |
| description | Generate the service layer for a Goravel entity with builder pattern configuration. Use after model generation. |
| argument-hint | [ModelName] [entity_name] |
| allowed-tools | Bash, Read, Write, Edit, Grep, Glob |
Generate service for $ARGUMENTS.
go run . artisan make:svc --model=<ModelName> <entity_name>
This creates app/services/<entity_name>_service.go.
The generated service uses contracts.NewServiceBuilder. You MUST configure these:
service := contracts.NewServiceBuilder[models.ModelName]("table_name", "id").
// REQUIRED: At least one search field
WithSearchFields("title", "description", "name").
// REQUIRED: Define sortable columns
WithSortFields("id", "created_at", "updated_at", "title").
// REQUIRED: At least one validation rule
WithValidationRules(map[string]interface{}{
"title": "required|max_len:255",
"name": "required|max_len:100",
}).
Build()
// Filter fields (for URL param-based filtering)
WithFilterFields("status", "category", "district").
// Default sort order
WithDefaultSort("created_at", "DESC").
// Eager load relationships
WithRelations("Creator", "Updater").
// Enable scoped permissions (user/role/global)
WithScopeFiltering("service_name", "created_by").
// Lifecycle hooks
WithBeforeCreate(func(data map[string]interface{}) error {
// Custom pre-create logic
return nil
}).
WithAfterCreate(func(model *models.ModelName) error {
// Custom post-create logic
return nil
}).
WithBeforeUpdate(func(id uint, data map[string]interface{}) error {
return nil
}).
// Custom query modifications
WithCustomQuery(func(query orm.Query) orm.Query {
return query.Where("is_active = ?", true)
}).
See app/services/book_service.go for the canonical service implementation.
Key things to match:
NewServiceBuilder[models.Book]("books", "id") - generic type + table + primary keyWith* methods calledIf your frontend sends camelCase sort fields, add a column mapping:
func (s *EntityService) GetColumnMapping() map[string]string {
mapping := s.CrudServiceContract.GetColumnMapping()
mapping["configType"] = "config_type"
mapping["createdAt"] = "created_at"
mapping["updatedAt"] = "updated_at"
return mapping
}
func (s *EntityService) GetEntityStatistics() (map[string]interface{}, error) {
var totalCount int64
totalCount, _ = facades.Orm().Query().Model(&models.Entity{}).Count()
return map[string]interface{}{
"totalCount": totalCount,
}, nil
}
After configuring the service builder:
# Check for issues in the service
go vet ./app/services/...
# Confirm full project compiles
go build ./...
Run /goravel-crud-permissions to register permissions for this entity.