Skip to content
Development
Skill

/android-networking

Integrate Retrofit, OkHttp, and Kotlinx Serialization for type-safe API communication in Android. Use when building API clients, adding interceptors, or configuring network security—not standalone MockWebServer or API-test setup.

From plugin
agent-skills-standard
538200 skills1 MCP
Install
$ npx -y skills add hoangnguyen0403/agent-skills-standard --skill android-networking --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/android-networking

Context preview

The summary Claude sees to decide when to auto-load this skill.

Integrate Retrofit, OkHttp, and Kotlinx Serialization for type-safe API communication in Android. Use when building API clients, adding interceptors, or configuring network security—not standalone MockWebServer or API-test setup.

SKILL.md

android-networking.SKILL.md
name: android-networking
description: Integrate Retrofit, OkHttp, and Kotlinx Serialization for type-safe API communication in Android. Use when building API clients, adding interceptors, or configuring network security—not standalone MockWebServer or API-test setup.
metadata:
  triggers:
    files:
    - '**/*Api.kt'
    - '**/*Service.kt'
    - '**/*Client.kt'
    keywords:
    - Retrofit
    - OkHttpClient
    - "@GET"
    - "@POST"

Android Networking Standards

**Priority: P0 (CRITICAL)**

1. Configure HTTP Stack

  • Use **Retrofit 2** with **OkHttp 4** for all backend communication.
  • Use **Kotlinx Serialization** with `@SerialName` for JSON field mapping.
  • Implement **Certificate Pinning** for sensitive production domains.

See [setup & wrappers](references/implementation.md) for DTO and API examples.

2. Define API Endpoints

  • All API calls must `suspend` functions.
  • Declare endpoints only in API interface — handle errors in Repository.

See [setup & wrappers](references/implementation.md) for API endpoint definitions.

3. Add Cross-Cutting Concerns

  • Use OkHttp Interceptors for `Bearer token` injection and `HttpLoggingInterceptor` (debug only).
  • Wrap responses with `Result` wrapper or `Either` in Repository layer.
  • Define R8/ProGuard rules for Retrofit/OkHttp when `isMinifyEnabled = true`.
  • Use **MockWebServer** for unit/integration tests — cover 500, 401, 403 error cases.

Anti-Patterns

  • **No Blocking Network Calls**: All API functions must suspend.
  • **No Logic in API Interface**: Only declare endpoints — handle errors in Repository.
  • **No Raw Converter Factory**: Explicitly set "application/json" MediaType with kotlinx.serialization.

References

  • [Setup & Wrappers](references/implementation.md)
Read more
Ships withagent-skills-standard

The portable SDLC standards layer for AI coding agents. Sync once, then work in your own runtime.

Get the whole plugin

Other skills on agent-skills-standard.