service

Create domain and application services in TypeScript and Go backends with DI wiring patterns.

4|Updated Jul 30, 2026
One-click install
npx skills add https://github.com/gabriellst/codm --skill service-gabriellst
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: service
Source: https://github.com/gabriellst/codm/tree/main/.claude/skills/service
Command: npx skills add https://github.com/gabriellst/codm --skill service-gabriellst

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Business logic that spans multiple entities or integrates external systems has no clear home in a DDD codebase — putting it in entities breaks invariants, and stuffing it in use cases creates duplication. This Skill provides language-specific playbooks for creating well-structured domain and application services. ## Core Features & Use Cases - Language dispatch: Routes to TypeScript or Go playbooks based on file extension, with per-language registries of mandatory patterns and bad practices. - TypeScript service patterns: Abstract-class DI tokens for tsyringe, mock/real registry bindings, factory-managed implementations, and health-check wiring for lifecycle services. - Go service patterns: Interface justification rules, compile-time interface checks, fx wiring with fx.As, and context-local vs cross-context infra service placement. - Use Case: When adding a payment integration that coordinates orders and customers, use this Skill to scaffold a PaymentGateway service with the correct abstract contract, concrete implementation, mock, and registry binding for your backend language. ## Quick Start Ask the agent to create a service for cross-entity pricing logic in the TypeScript backend and follow the service skill's registry and checklist rules.

Frequently Asked Questions about service

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

FAQPage Schema
How do I create a domain service in TypeScript with tsyringe?

Define the contract as an abstract class so tsyringe can use it as a DI token, then create an @injectable() concrete implementation extending it. Bind both mock and real implementations through the INSTANCE_REGISTRY in the owning context's registry.ts file.

When should I use a service instead of an entity method?

Use a service when logic spans multiple aggregates, calls external APIs, or coordinates infrastructure like storage or email. Keep logic on the entity when it only involves that entity's own data and invariants.

Should a Go service always define an interface?

No. An interface is only justified when multiple implementations exist or are planned, such as a stub for development and a real implementation for production. With a single permanent implementation, provide the concrete struct directly.

How do I wire a service with fx in Go?

Register context-local services in the context's module.go using fx.Provide, and use fx.As(new(FooService)) when consumers depend on the interface. Cross-context infrastructure services are wired at the application root in cmd/api/main.go.

When do factory-managed services skip registry entries in TypeScript?

When concrete implementations are injected into a factory by their concrete type rather than an abstract token, tsyringe auto-resolves them with only @injectable(). No INSTANCE_REGISTRY entries are needed for the factory or its implementations.

Why should services not access the database directly?

Services must hold no database driver and run no queries; persistence belongs to repositories. A service composes repository ports and threads an optional transaction parameter through repository calls while the use case owns the transaction boundary.