Implement Service
Before Starting
Search for similar services first:
- •Search
domain/for services in the same domain area - •Look at how similar services handle errors, dependencies, and Result types
- •Check existing fakes for patterns to follow
For complex business logic or architectural decisions, review existing patterns carefully or seek guidance.
Steps
- •Design interface in
:publicmodule (or:implif internal-only) - •Implement in
:implmodule with@BitkeyInject(AppScope::class) - •Create fake in
:fakemodule withreset()method - •Write tests using fakes
Use find-module skill to locate the correct module.
Rules
- •Interface uses domain language, not implementation details
- •All fallible operations return
Result<T, Error>(never throw) - •Chain with
flatMap/mapError, not try-catch - •No UI concerns (screen state, dialogs, navigation)
- •No circular dependencies; lower-level components cannot depend on services
References
@docs/docs/mobile/architecture/conventions.md @docs/docs/mobile/architecture/domain-service.md @docs/docs/mobile/architecture/domain-service-testing.md @docs/docs/mobile/architecture/dependency-injection.md