repository-remote

Create remote API repositories with Interface + Implementation and safeApiCall.

Updated Dec 4, 2025
One-click install
npx skills add https://github.com/thinhtt264/Snaplet-App --skill repository-remote
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: repository-remote
Source: https://github.com/thinhtt264/Snaplet-App/tree/main/.cursor/skills/repository-remote
Command: npx skills add https://github.com/thinhtt264/Snaplet-App --skill repository-remote

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a standard pattern for implementing repositories that talk to remote APIs, ensuring a clean separation between interfaces and implementations and enforcing safe remote calls.

Core Features & Use Cases

  • Interface + Implementation split: Define XxxRepository and XxxRepositoryImpl with suspend functions returning ApiResult<T>.
  • Safe API calls: Wrap every remote API call with safeApiCall and ensure Retrofit-based responses map to ApiResult.
  • Hilt binding: Provide a RepositoryModule binding to inject XxxRepositoryImpl as XxxRepository and bind to Singleton scope.
  • Use Case: When building a feature that interacts with a backend, create a dedicated remote repository that handles network calls and error handling, without mixing in Room/DAO logic.

Quick Start

Create an XxxRepository interface and an XxxRepositoryImpl implementation, add a RepositoryModule binding, and ensure all remote calls are wrapped with safeApiCall.

Frequently Asked Questions about repository-remote

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

FAQPage Schema
How do I create a Kotlin repository for Retrofit with safe API calls?

A safe Kotlin repository for Retrofit splits interface and implementation into suspend functions returning ApiResult. It wraps every Retrofit network request with safeApiCall to handle errors automatically and ensure clean separation.

What is the best way to structure a remote API repository in Kotlin?

The best way to structure a remote API repository in Kotlin is using a strict Interface + Implementation pattern. You define XxxRepository and XxxRepositoryImpl, ensuring all remote calls return ApiResult wrapped with safeApiCall for clean separation.

How do I bind a remote repository using Hilt in Kotlin?

To bind a remote repository using Hilt, create a RepositoryModule that injects XxxRepositoryImpl as XxxRepository and binds it to Singleton scope. This ensures your interface and implementation are properly provided for dependency injection.

Does this remote repository pattern work with Room or local database logic?

This remote repository pattern is designed exclusively for features interacting with a backend. It handles network calls and error handling without mixing in Room or DAO logic, keeping your local and remote data sources strictly separated.

Why wrap Retrofit responses in ApiResult for remote API calls?

Wrapping Retrofit responses in ApiResult for remote API calls enforces safe network operations. The safeApiCall wrapper maps Retrofit responses to ApiResult, standardizing error handling and ensuring your repository layer manages failures consistently.