Skip to content
Back to skills

Android Networking

ASecurity

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

  • 584 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added June 6, 2026
developmentkotlinapibackendsecurity

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned June 6, 2026

npx -y skills add HoangNguyen0403/agent-skills-standard --skill android-networking --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Android Networking?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Android Networking
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/hoangnguyen0403-android-networking/badge)](https://www.skillsdirectory.com/skills/hoangnguyen0403-android-networking)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
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.
metadata:
  triggers:
    files:
    - '**/*Api.kt'
    - '**/*Service.kt'
    - '**/*Client.kt'
    keywords:
    - Retrofit
    - OkHttpClient
    - "@GET"
    - "@POST"
---
# Android Networking Standards

## **Priority: P0**

## 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)

Files in this skill

  • SKILL.md1.7 KB
  • evals/evals.json1.7 KB
  • references/implementation.md1.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.