android-retrofit

Implement type-safe HTTP networking in Android with Retrofit.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides expert guidance on setting up and using Retrofit for type-safe HTTP networking in Android applications, simplifying complex network operations.

Core Features & Use Cases

  • Service Definitions: Define API endpoints using Kotlin interfaces.
  • Request Methods: Handle GET, POST, PUT, DELETE requests with various parameter types.
  • Data Serialization: Integrate with converters like Moshi or kotlinx.serialization for JSON.
  • OkHttp Configuration: Customize OkHttpClient for logging, timeouts, and interceptors.
  • Hilt Integration: Set up Retrofit instances as singletons within Hilt modules.
  • Error Handling: Implement robust error handling in repositories for network failures.
  • Use Case: Efficiently build the network layer for an Android app that fetches user data from a REST API, handling authentication headers and parsing JSON responses.

Quick Start

Use the android-retrofit skill to define a service interface for fetching user data from a base URL.

Frequently Asked Questions about android-retrofit

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

FAQPage Schema
How do I implement type-safe HTTP networking in Android using Kotlin?

Type-safe HTTP networking in Android is implemented by defining Kotlin service interfaces with Retrofit annotations to map RESTful API endpoints. This approach ensures compile-time validation of network requests, preventing runtime errors from malformed API calls, and simplifies complex network operations.

How do I handle network errors and failures in an Android repository?

Handle network failures by implementing robust error management within your repository layer. This isolates network exceptions from the UI, allowing you to catch Retrofit and coroutine errors and map them into domain-specific results before propagating them to the rest of your application.

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

Retrofit supports Kotlin coroutines for asynchronous network operations and integrates with Hilt by providing Retrofit instances as singletons within Hilt modules. This setup injects type-safe API services directly into your repositories, eliminating manual instantiation and lifecycle management.

What is the best way to configure OkHttp interceptors and timeouts for an Android REST API client?

Configure an Android REST API client by customizing the OkHttpClient instance attached to your Retrofit builder. This allows you to add logging interceptors, define precise timeout thresholds for connections, and manipulate headers globally before network requests are dispatched.

How do I parse JSON responses in Retrofit using kotlinx.serialization or Moshi?

Parse JSON responses in Retrofit by integrating converter factories like Moshi or kotlinx.serialization. These converters automatically map JSON payloads to Kotlin data classes, enabling seamless type-safe deserialization of RESTful API responses without writing manual JSON parsing logic.

How do I define API endpoints for GET and POST requests in an Android app?

Define API endpoints for GET and POST requests by creating a Kotlin interface annotated with Retrofit annotations. You specify the HTTP method, relative URL, and parameter types for request bodies or form data, which Retrofit uses to construct and execute the network call.