Claude-skill-registry create-service
Guide for creating services in the backend. Use when asked to create a service layer component. Directs to the appropriate service skill based on the type of service needed.
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/create-service" ~/.claude/skills/majiayu000-claude-skill-registry-create-service && rm -rf "$T"
manifest:
skills/data/create-service/SKILL.mdsource content
Create Service
Services contain business logic and orchestrate operations between repositories, external APIs, and other services.
Service Types
There are two types of services in this architecture:
| Type | Purpose | Skill |
|---|---|---|
| Resource Service | CRUD operations on entities (notes, users, etc.) | |
| Utility Service | Cross-cutting concerns (auth, notifications, email) | |
Which Skill to Use?
Use create-resource-service
when:
create-resource-service- Creating a service for a domain entity (Note, User, Course, etc.)
- The service will perform CRUD operations via a repository
- The service needs authorization checks per operation
- The service should emit events for real-time updates
- You've already created the schema and repository for this entity
Example:
NoteService, UserService, CourseService
Use create-utility-service
when:
create-utility-service- Creating a service for cross-cutting concerns
- The service calls external APIs (auth service, payment gateway, etc.)
- The service provides shared functionality used by other services
- The service doesn't directly map to a domain entity
Example:
AuthenticationService, AuthorizationService, EmailService, NotificationService
Service Layer Principles
Regardless of type, all services follow these principles:
- Business logic lives here - Not in controllers or repositories
- Dependency injection - Inject dependencies via constructor
- Throw domain errors - Use errors from
(not HTTP errors)@/errors - User context - Accept
where neededAuthenticatedUserContextType - Return domain types - Return schema types, not HTTP responses
File Naming
Location:
src/services/{service-name}.service.ts
| Type | Example |
|---|---|
| Resource | , |
| Utility | , |
See Also
- CRUD services for entitiescreate-resource-service
- Cross-cutting/specialized servicescreate-utility-service
- Add real-time events to a resource serviceadd-resource-events