Skillshub android-networking
Standards for Retrofit, OkHttp, and API Communication. Use when integrating Retrofit, OkHttp, or API clients in Android apps. (triggers: **/*Api.kt, **/*Service.kt, **/*Client.kt, Retrofit, OkHttpClient, @GET, @POST)
install
source · Clone the upstream repo
git clone https://github.com/ComeOnOliver/skillshub
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ComeOnOliver/skillshub "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/HoangNguyen0403/agent-skills-standard/android-networking" ~/.claude/skills/comeonoliver-skillshub-android-networking && rm -rf "$T"
manifest:
skills/HoangNguyen0403/agent-skills-standard/android-networking/SKILL.mdsource content
Android Networking Standards
Priority: P0
Implementation Guidelines
Libraries & Setup
- Client: Use Retrofit 2 with OkHttp 4 for all backend communication.
- Serialization: Use Kotlinx Serialization (preferred). Use
for JSON field mapping.@SerialName - Security: Implement Certificate Pinning for sensitive production domains. Use
for cleartext traffic control.NetworkSecurityConfig
Network Ops
- Interceptors: Use OkHttp Interceptors for global concerns like
injection via theBearer token
header andAuthorization
(debug only).HttpLoggingInterceptor - Architecture: All API calls must be
functions. Use asuspend
wrapper orResult
to handle success/failure in the Repository layer.Either - Minification: Ensure
is true inisMinifyEnabled
and define R8/ProGuard rules for Retrofit/OkHttp to prevent runtime crashes.build.gradle - Testing: Use MockWebServer to simulate API responses in unit and integration tests. Ensure 100% test coverage for error cases (500, 401, 403).
Anti-Patterns
- No Blocking Network Calls: All API functions must be 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.