android-retrofit

Configure Retrofit with coroutines, OkHttp, and Hilt in Android.

Updated Mar 9, 2025
One-click install
npx skills add https://github.com/rock-hu/vitamin-compose --skill android-retrofit-rock-hu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: android-retrofit
Source: https://github.com/rock-hu/vitamin-compose/tree/main/.github/skills/android-retrofit
Command: npx skills add https://github.com/rock-hu/vitamin-compose --skill android-retrofit-rock-hu

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

The skill provides expert guidance on setting up Retrofit for type-safe HTTP networking in Android, covering service definitions, coroutines, OkHttp configuration, and Hilt integration.

Core Features & Use Cases

  • Type-safe API services with Retrofit interfaces
  • Coroutine-based asynchronous calls and error handling
  • OkHttp configuration including interceptors and timeouts
  • Dependency injection with Hilt for Retrofit instances
  • Real-world usage example: building a small network layer for an app

Quick Start

Use Retrofit to define a service interface, create a Retrofit instance in a DI module, inject it, and call suspend functions to fetch data from a REST API.

Frequently Asked Questions about android-retrofit

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

FAQPage Schema
How do I set up type-safe HTTP networking in Android with Retrofit?

Retrofit HTTP networking in Android is implemented by defining type-safe Kotlin service interfaces, configuring a Retrofit instance, and using suspend functions to fetch REST API data. You can structure a complete network layer following this skill's guidance.

How do I configure OkHttp interceptors and timeouts for my Retrofit client?

OkHttp configuration for Retrofit involves defining custom interceptors and setting network timeouts. This skill provides guidance on integrating OkHttp to manage and optimize your Android network request behaviors.

Can I use Hilt dependency injection with Retrofit and Kotlin Coroutines?

Hilt dependency injection integrates with Retrofit and Kotlin Coroutines by creating a Retrofit instance in a DI module and injecting it. You then use coroutine suspend functions for asynchronous HTTP calls and structured error handling.

What's the best way to handle asynchronous API calls in Kotlin using Retrofit?

The best way to handle asynchronous API calls in Kotlin using Retrofit is via Coroutines. This skill demonstrates defining suspend functions in service interfaces to execute type-safe asynchronous network requests and manage API errors.

Do I need a Kotlin Gradle project to use Retrofit for Android network calls?

Yes, a Kotlin Gradle project is required. This skill assumes a Kotlin/Gradle setup and requires adding Retrofit, Kotlin Coroutines, and OkHttp libraries to implement robust type-safe HTTP networking in your Android app.