AgentSkillsCN

repository

与数据仓库协作——创建、修改、调试,或深入理解仓库模式、数据来源与数据流动架构。

SKILL.md
--- frontmatter
name: repository
description: Work with data repositories - create, modify, debug, or understand repository patterns, data sources, and data flow architecture.
argument-hint: "[task] - e.g., 'create Payment', 'debug user sync', 'explain data flow'"
context: fork
allowed-tools: Read, Edit, Write, Bash(./format, ./gradlew *, grep, cat, mkdir, find), Glob, Grep

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

  1. Check if module exists at data/{module-name}/
  2. Create module structure if needed
  3. Create Repository interface in public
  4. Create RealRepository in impl
  5. Create data sources in impl
  6. Create FakeRepository in fake
  7. Run ./format and verify build

Related Skills

  • datastore - Working with the DataStore library
  • ktorfit - API communication, RemoteDataSource, JSON parsing
  • sqldelight - Database schema, LocalDataSource, queries