android-retrofit

Configure Retrofit networking with coroutines, serialization, and Hilt DI.

Updated Mar 17, 2026
One-click install
npx skills add https://github.com/kotlinknight/NutriSoloAndroid --skill android-retrofit-kotlinknight
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: android-retrofit
Source: https://github.com/kotlinknight/NutriSoloAndroid/tree/main/.agents/skills/android-retrofit
Command: npx skills add https://github.com/kotlinknight/NutriSoloAndroid --skill android-retrofit-kotlinknight

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Android apps often struggle with cleanly configuring Retrofit, coroutine integration, serialization, and consistent error handling across repositories.

Core Features & Use Cases

  • Retrofit service interfaces with suspend functions and optional Response wrappers for error inspection
  • Coroutine-enabled networking workflow with Kotlinx Serialization for JSON
  • Dependency injection via Hilt module for Retrofit, OkHttpClient, and JSON parser
  • Centralized error mapping in repositories to translate HTTP/IO exceptions into domain errors
  • Auth token injection via an OkHttp Interceptor for secure API access

Quick Start

Configure a Hilt-backed Retrofit setup with a simple GitHubService example to begin making API calls.

Frequently Asked Questions about android-retrofit

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

FAQPage Schema
How do I configure Retrofit with Kotlin coroutines and Hilt for Android networking?

Configure Retrofit for Android networking by defining suspend functions in service interfaces, providing Retrofit and OkHttpClient instances via a Hilt module, and using Kotlinx Serialization for JSON parsing. This setup enables coroutine-enabled API calls with structured dependency injection.

What is the best way to handle Retrofit API errors in Android repository layers?

Handle Retrofit API errors by centralizing error mapping in your repository layers to translate HTTP and IO exceptions into domain errors. Using optional Response wrappers for your suspend functions allows direct inspection of HTTP status codes before mapping.

How do I inject authentication tokens into OkHttp requests for Retrofit?

Inject authentication tokens into OkHttp requests by attaching an OkHttp-based AuthInterceptor to your OkHttpClient configuration. The interceptor securely adds the necessary auth headers to outgoing API calls before they reach the Retrofit service.

Does this Retrofit setup require suspend functions for all API endpoints?

Yes, this Retrofit setup enforces suspend functions for all API endpoints to ensure coroutine-enabled networking. This approach allows asynchronous API calls natively integrated with Kotlin coroutines and structured concurrency in your repository layers.

Can I use Kotlinx Serialization instead of Gson for Retrofit JSON parsing?

Yes, this Retrofit configuration uses Kotlinx Serialization for JSON parsing. It integrates the JSON parser within the Hilt dependency injection module to serialize and deserialize API responses efficiently alongside coroutine-enabled network operations.