android-retrofit

Configure Retrofit service interfaces, OkHttp interceptors, and Hilt DI for Android networking.

1|Updated Jan 24, 2026
One-click install
npx skills add https://github.com/peanutDD/upload-download-util --skill android-retrofit-peanutdd
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: android-retrofit
Source: https://github.com/peanutDD/upload-download-util/tree/main/frontend/src-tauri/.agents/skills/android-retrofit
Command: npx skills add https://github.com/peanutDD/upload-download-util --skill android-retrofit-peanutdd

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Android apps often suffer from boilerplate and unsafe network calls when wiring Retrofit for HTTP APIs; this Skill provides guidance to implement and maintain a clean, type-safe network layer.

Core Features & Use Cases

  • Service interface definitions with Retrofit annotations to model API endpoints
  • Kotlin coroutines integration for asynchronous calls and clean error handling
  • OkHttp configuration and interceptor usage for logging, caching, and auth
  • Hilt-based dependency injection for providing Retrofit instances and services
  • Error handling patterns, serialization setup, and repository integration for robust data access
  • End-to-end example workflows for common networking tasks in Android apps

Quick Start

Create a Retrofit instance with a base URL and implement a sample service interface to call a REST endpoint.

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 with Retrofit in Android using Kotlin coroutines?

Type-safe HTTP networking in Android uses Retrofit service interfaces with coroutines for asynchronous operations. Define annotated API endpoints, implement coroutine suspend functions, and handle errors cleanly to establish robust network layers without boilerplate.

What's the best way to configure OkHttp interceptors for logging and authentication in a Retrofit network layer?

OkHttp configuration in a Retrofit network layer applies interceptors for logging, caching, and authentication. Customize the OkHttp client instance directly, attach necessary interceptors, and pass it to the Retrofit builder for stable service execution.

Can I use Hilt dependency injection to provide Retrofit instances and API service interfaces in Android?

Hilt dependency injection provisions Retrofit instances and service interfaces within Android architectures. Configure Hilt modules to supply customized Retrofit and OkHttp instances, ensuring network layers remain stable and fully testable across Kotlin-based projects.

How do I handle API errors and map response failures when using Retrofit in Android?

Error handling patterns in Retrofit map HTTP response failures into manageable Kotlin exceptions. Implement error mapping logic within repository integration layers, catching network failures and API errors to maintain robust data access and stable app architectures.

Does this Retrofit networking approach work with Kotlin-based Android projects that use dependency injection?

This Retrofit networking approach suits Kotlin-based Android projects relying on dependency injection with Hilt. It streamlines type-safe HTTP calls, integrates coroutines for asynchronous execution, and provisions network services for stable, testable app architectures.

Why do I need to define service interfaces with Retrofit annotations for Android HTTP calls?

Service interfaces with Retrofit annotations model API endpoints to ensure type-safe HTTP networking in Android. Defining interfaces eliminates unsafe network calls and boilerplate, directly mapping Kotlin coroutines and request/response handling to REST endpoints.