Repository Skill
Work with data layer repositories - create new ones, modify existing ones, debug data flow, or understand patterns.
Common Tasks
code
/repository create PaymentTransaction # Create new repository /repository debug user sync issues # Debug data synchronization /repository explain data flow # Understand how data flows /repository add method to UserRepository # Modify existing repository /repository fix retry logic in messages # Fix specific issues
Architecture Overview
code
data/{module-name}/
├── public/ → Repository interface, data classes
├── impl/ → RealRepository, RemoteDataSource, LocalDataSource, API
└── fake/ → FakeRepository for testing
Data flow: Remote API → Repository → LocalDataSource → SQLDelight → Flow → UI
Key Patterns
- •Return types:
Flow<T>for observation,JellyfinResult<T>for operations - •Retry: Use
retryJellyfinResult(retryPolicy)for remote calls - •DI:
@ContributesBinding(AppScope::class)for Metro - •Sync pattern: Fetch remote → save local → emit via Flow
When Creating New Repositories
- •Check if module exists at
data/{module-name}/ - •Create module structure if needed
- •Create Repository interface in public
- •Create RealRepository in impl
- •Create data sources in impl
- •Create FakeRepository in fake
- •Run
./formatand verify build
Related Skills
- •datastore - Working with the DataStore library
- •ktorfit - API communication, RemoteDataSource, JSON parsing
- •sqldelight - Database schema, LocalDataSource, queries