Api response optimization

From aj-geddes/useful-ai-prompts · View interactive version

Api response optimization is an AI agent skill from the GitHub repository aj-geddes/useful-ai-prompts. Optimize API response times through caching, compression, and efficient payloads. Improve backend performance and reduce network traffic.

How to use this skill

Skill file

API Response Optimization

Table of Contents

Overview

Fast API responses improve overall application performance and user experience. Optimization focuses on payload size, caching, and query efficiency.

When to Use

Quick Start

Minimal working example:

// Inefficient response (unnecessary data)
GET /api/users/123
{
  "id": 123,
  "name": "John",
  "email": "john@example.com",
  "password_hash": "...", // ❌ Should never send
  "ssn": "123-45-6789", // ❌ Sensitive data
  "internal_id": "xyz",
  "created_at": "2024-01-01T00:00:00Z",
  "updated_at": "2024-01-02T00:00:00Z",
  "meta_data": {...}, // ❌ Unused fields
  "address": {
    "street": "123 Main",
    "city": "City",
    "state": "ST",
    "zip": "12345",
    "geo": {...} // ❌ Not needed
  }
}

// Optimized response (only needed fields)
GET /api/users/123
{
  "id": 123,
// ... (see reference guides for full implementation)

Reference Guides

Detailed implementations in the references/ directory:

| Guide | Contents |

|---|---|

| Response Payload Optimization | Response Payload Optimization |

| Caching Strategies | Caching Strategies |

| Compression & Performance | Compression & Performance |

| Optimization Checklist | Optimization Checklist |

Best Practices

✅ DO

❌ DON'T

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.