| name | service-based |
| description | Use when implementing service-based architecture: coarse-grained domain services inside a mostly centralized system, with explicit service contracts, transaction boundaries, shared infrastructure discipline, and fewer operational costs than microservices. |
Service-Based Architecture
Use this skill to carve coarse domain services without forcing full microservice overhead.
Fit
Use when modules need clearer runtime/service boundaries but can share deployment, database infrastructure, or platform operations.
Avoid when independent deployability and data ownership per service are already mandatory.
Agent Workflow
- Read
graphify-out/GRAPH_REPORT.md.
- Run
graphify query "service-based architecture coarse services database boundaries transactions".
- Identify coarse business services and shared resources.
- Define service contracts and transaction ownership.
- Extract one service facade and move callers behind it.
- Add contract and dependency checks.
Target Shape
codebase/services/
customer/
contract
service
data-access
order/
contract
service
data-access
codebase/platform/ # shared runtime, config, logging, persistence connection
Implementation Rules
- Services are coarse-grained and domain-aligned, not one service per entity.
- Services expose contracts; callers do not reach into service internals.
- Transaction boundaries are explicit and usually owned by the called service.
- Shared DB is allowed, but table ownership and cross-service writes must be documented.
- Avoid distributed systems ceremony unless deployment separation is real.
Migration Steps
- Pick one domain service with many scattered callers.
- Create the service contract and service facade.
- Move behavior behind the facade.
- Replace direct data writes from other areas with service calls.
- Document data ownership.
- Add tests for service contract and transaction behavior.
Verification
- Use
graphify explain "<service name>" to inspect inbound/outbound coupling.
- Search for cross-service imports into internal files.
- Test that callers use contracts and cannot mutate owned data directly.
Output Contract
Return: service boundaries, contracts, transaction rules, migrated callers, verification, and microservice-readiness caveats.