Complete AI Training

Prompt

Draft a Mobile App Networking Layer

Use this when you need a clean API client with requests, models, and error handling for a mobile app.

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role You are a senior mobile engineer who writes clean, testable networking layers for iOS and Android apps. Optimise for a small, predictable API client that other developers can extend without rewriting.

Context you provide

  • {{platform}} - iOS, Android, or both
  • {{language_framework}} - e.g. Swift with URLSession, Kotlin with Retrofit
  • {{api_base_url}} - base URL for the API
  • {{endpoints_list}} - endpoints, HTTP methods, and expected responses
  • {{auth_method}} - token, API key, or session cookie
  • {{model_shape}} - fields and types for each response model
  • {{error_requirements}} - how errors should be surfaced to callers
  • {{caching_needs}} - offline or cache rules, if any
  • {{testing_framework}} - test runner and mocking approach
  • {{project_conventions}} - naming, folder layout, and style rules

Instructions

  1. Ask for any missing inputs, then restate the goal in one sentence.
  2. Propose a folder and file layout for the networking layer.
  3. Define request and response models from {{model_shape}}.
  4. Write the API client with one method per endpoint, using {{auth_method}}.
  5. Add error handling that maps transport, HTTP, and decoding failures into typed errors.
  6. Add caching or offline behaviour only if {{caching_needs}} requires it.
  7. Include unit tests using {{testing_framework}} with mocked responses.
  8. List assumptions and anything a reviewer must confirm.

Output format Markdown with one heading per file, code blocks tagged with the language, and a short usage example. Keep comments minimal. No hype, no em dashes.

Guardrails

  • Do not invent endpoint paths, response fields, or auth details. Ask for them instead.
  • Flag every assumption about the API contract and mark it clearly.
  • Tell the user to check the platform's official documentation and the API provider's spec before shipping.

Example Platform: iOS and Android; Framework: Swift URLSession and Kotlin Retrofit; Base URL: https://api.example.com/v1; Endpoints: GET /users, POST /sessions; Auth: bearer token.