Gamma Performance Tuning

VerifiedSafe

Optimize Gamma API performance and reduce latency. Use when experiencing slow response times, optimizing throughput, or improving user experience with Gamma integrations.

Sby Skills Guide Bot
DevelopmentIntermediate
8/30/2026
Claude Code
#gamma-api#performance-tuning#async-polling#caching#batch-processing

Recommended for

Automated summary

Tunes Gamma API integrations by adapting polling, caching static data, and parallelizing batch generation to reduce perceived latency.

Strengths

  • Includes a concrete latency table for typical Gamma operations
  • Provides an adaptive smart-polling loop with backoff
  • Shows caching for themes, folders, and generation results
  • Bounds batch concurrency with p-limit

Limitations

  • Assumes an existing Gamma client, async experience, and cache infrastructure; it does not include a measurement harness or baseline collection.
  • Most latency comes from generation itself (10–60s), which the skill cannot directly control.
  • The batch-generation example is partial and light on error-handling details.
When to use it

Use when a Gamma integration feels slow and you want to reduce polling overhead, cache stable resources, or run batches with controlled concurrency.

When not to use it

Avoid it when you need to speed up Gamma's server-side generation itself or when no working integration exists yet.

Security analysis

Safe
Quality score84/100

The skill is a documentation-only guide (declared tools Read/Write/Edit) containing TypeScript snippets for polling, caching, batching, and HTTP keep-alive against the Gamma API. No shell execution, no destructive commands, no obfuscation, and no instructions to transmit secrets or tokens; the API key is only referenced as a function parameter. The frontmatter and Overview/Examples text contain no attempts to override the agent's behavior.

No concerns found

How this analysis is made

Examples

Diagnose slow Gamma generation
My Gamma API integration takes over a minute per deck even though each HTTP call looks fast. Review my polling loop and suggest an adaptive polling strategy, caching for themes and folders, and a safe batch concurrency limit.
Batch deck generation
I need to generate 20 Gamma decks from a content list. Show me how to batch these with p-limit and cache generation results so I can poll status without hitting the API constantly.

name: gamma-performance-tuning description: 'Optimize Gamma API performance and reduce latency.

Use when experiencing slow response times, optimizing throughput,

or improving user experience with Gamma integrations.

Trigger with phrases like "gamma performance", "gamma slow",

"gamma latency", "gamma optimization", "gamma speed".

' allowed-tools: Read, Write, Edit version: 1.13.0 license: MIT author: Jeremy Longshore jeremy@intentsolutions.io tags:

  • saas
  • gamma
  • api
  • performance compatibility: Designed for Claude Code

Gamma Performance Tuning

Output

Publish a tuning receipt with baseline/post-change aggregate metrics, change owner, canary result, and rollback state. Do not include source content, viewer data, or tokens.

Examples

Optimize a fictional staging deck, compare aggregate load/render metrics, and roll back if a synthetic sharing or accessibility check regresses.

Overview

Optimize Gamma API integration performance. Gamma's generate-poll-retrieve pattern means most latency is in generation time (10-60s), not API call overhead. Optimize by: reducing poll overhead, parallelizing batch operations, caching results, and choosing the right generation parameters.

Prerequisites

  • Working Gamma integration (see gamma-sdk-patterns)
  • Understanding of async patterns
  • Redis or in-memory cache (recommended)

Performance Characteristics

| Operation | Typical Latency | Notes | |-----------|----------------|-------| | POST /generations | 200-500ms | Just starts the generation | | GET /generations/{id} (poll) | 100-300ms | Per poll request | | Full generation (poll to completion) | 10-60s | Depends on content + cards | | GET /themes | 100-200ms | Cacheable | | GET /folders | 100-200ms | Cacheable |

Instructions

Step 1: Optimize Poll Strategy

// src/gamma/smart-poll.ts
// Adaptive polling: start fast, slow down over time

export async function smartPoll(
  gamma: GammaClient,
  generationId: string,
  opts = { maxTimeMs: 180000 }
): Promise<GenerateResult> {
  const deadline = Date.now() + opts.maxTimeMs;
  let interval = 2000; // Start at 2s

  while (Date.now() < deadline) {
    const result = await gamma.poll(generationId);

    if (result.status === "completed") return result;
    if (result.status === "failed") throw new Error("Generation failed");

    // Adaptive backoff: poll faster early, slower later
    await new Promise((r) => setTimeout(r, interval));
    interval = Math.min(interval * 1.5, 10000); // Max 10s between polls
  }

  throw new Error(`Poll timeout after ${opts.maxTimeMs}ms`);
}

Step 2: Cache Static Data

// src/gamma/cache.ts
import NodeCache from "node-cache";

const cache = new NodeCache({ stdTTL: 3600 }); // 1 hour for static data

export async function getCachedThemes(gamma: GammaClient) {
  const key = "gamma:themes";
  const cached = cache.get(key);
  if (cached) return cached;

  const themes = await gamma.listThemes();
  cache.set(key, themes);
  return themes;
}

export async function getCachedFolders(gamma: GammaClient) {
  const key = "gamma:folders";
  const cached = cache.get(key);
  if (cached) return cached;

  const folders = await gamma.listFolders();
  cache.set(key, folders);
  return folders;
}

// Cache generation results (useful for showing status)
export async function cacheGenerationResult(
  generationId: string,
  result: GenerateResult
) {
  cache.set(`gamma:gen:${generationId}`, result, 86400); // 24 hours
}

Step 3: Parallel Batch Generation

// src/gamma/batch.ts
import pLimit from "p-limit";

const limit = pLimit(3); // Max 3 concurrent generations

export async function batchGenerate(
  gamma: GammaClient,
  requests: Array<{ content: string; exportAs?: string }>
): Promise<Array<{ index: number; result?: GenerateResult; error?: string }>> {
  const results = await Promise.allSettled(
    requests.map((req, index) =>
      limit(async () => {
        const { generationId } = await gamma.generate({
          content: req.content,
          outputFormat: "presentation",
          exportAs: req.exportAs,
        });
        const result = await smartPoll(gamma, generationId);
        return { index, result };
      })
    )
  );

  return results.map((r, i) => {
    if (r.status === "fulfilled") return r.value;
    return { index: i, error: (r.reason as Error).message };
  });
}

Step 4: Reduce Generation Time

// Shorter content = faster generation
// "brief" text = fewer AI-generated words per card = faster

// SLOWER: extensive text on many cards
await gamma.generate({
  content: "Comprehensive 20-card guide to machine learning...",
  outputFormat: "presentation",
  textAmount: "extensive",  // More text per card = slower
});

// FASTER: brief text, fewer implied cards
await gamma.generate({
  content: "5-card overview of ML basics: supervised, unsupervised, reinforcement, deep learning, applications",
  outputFormat: "presentation",
  textAmount: "brief",      // Less text per card = faster
});

// FASTEST: preserve mode (no AI text generation)
await gamma.generate({
  content: "Your pre-written slide content here...",
  outputFormat: "presentation",
  textMode: "preserve",     // Uses your text as-is, no AI rewriting
});

Step 5: Preload Data at Startup

// src/gamma/preload.ts
// Fetch themes and folders at app startup, not per-request

let preloaded = false;

export async function preloadGammaData(gamma: GammaClient) {
  if (preloaded) return;

  const [themes, folders] = await Promise.all([
    gamma.listThemes(),
    gamma.listFolders(),
  ]);

  // Cache for the session
  cache.set("gamma:themes", themes, 0);   // No TTL (until restart)
  cache.set("gamma:folders", folders, 0);

  preloaded = true;
  console.log(`Preloaded ${themes.length} themes, ${folders.length} folders`);
}

Step 6: Connection Keep-Alive

// src/gamma/optimized-client.ts
import http from "node:http";
import https from "node:https";

// Reuse TCP connections
const agent = new https.Agent({
  keepAlive: true,
  maxSockets: 10,
  keepAliveMsecs: 60000,
});

export function createOptimizedClient(apiKey: string) {
  const base = "https://public-api.gamma.app/v1.0";
  const headers = { "X-API-KEY": apiKey, "Content-Type": "application/json" };

  async function request(method: string, path: string, body?: unknown) {
    const res = await fetch(`${base}${path}`, {
      method, headers,
      body: body ? JSON.stringify(body) : undefined,
      // @ts-ignore — agent support in Node.js
      agent,
    });
    if (!res.ok) throw new Error(`Gamma ${res.status}`);
    return res.json();
  }

  return {
    generate: (body: any) => request("POST", "/generations", body),
    poll: (id: string) => request("GET", `/generations/${id}`),
    listThemes: () => request("GET", "/themes"),
    listFolders: () => request("GET", "/folders"),
  };
}

Performance Targets

| Operation | Target | Action if Exceeded | |-----------|--------|-------------------| | Theme/folder lookup | < 50ms (cached) | Verify cache hit | | Generation start | < 500ms | Check network latency | | Full generation (5 cards) | < 30s | Use textAmount: "brief" | | Full generation (10+ cards) | < 60s | Split into smaller decks | | Batch of 10 presentations | < 3 min | Use concurrency limit of 3 |

Error Handling

| Issue | Cause | Solution | |-------|-------|----------| | High latency on first request | Cold TCP connection | Use keep-alive agent | | Cache miss storm | Cache expired simultaneously | Stagger TTLs | | Batch rate limiting | Too many concurrent requests | Reduce p-limit concurrency | | Poll timeout | Complex generation | Increase timeout, simplify content |

Resources

Next Steps

Proceed to gamma-cost-tuning for credit optimization.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/gamma-performance-tuning-mtfbwlav/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/gamma-performance-tuning-mtfbwlav' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/gamma-performance-tuning-mtfbwlav/download' --output '.skill-downloads/gamma-performance-tuning-mtfbwlav/SKILL.md.part' && mv '.skill-downloads/gamma-performance-tuning-mtfbwlav/SKILL.md.part' '.skill-downloads/gamma-performance-tuning-mtfbwlav/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Environment declared by the author: Designed for Claude Code

Tools declared by the author (check availability in your agent): Read, Write, Edit

Original excerpt: Prerequisites
  • Working Gamma integration (see gamma-sdk-patterns)
  • Understanding of async patterns
  • Redis or in-memory cache (recommended)

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/gamma-performance-tuning-mtfbwlav/SKILL.md' && test -s '.skill-downloads/gamma-performance-tuning-mtfbwlav/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/gamma-performance-tuning' && cp -R '.skill-downloads/gamma-performance-tuning-mtfbwlav' '.claude/skills/gamma-performance-tuning'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/gamma-performance-tuning-mtfbwlav'

openskills read 'gamma-performance-tuning-mtfbwlav'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/gamma-performance-tuning-mtfbwlav/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills