gamma-local-dev-loop
Set up local development workflow for Gamma API integration. Use when building automation scripts, testing API calls locally, or configuring a dev environment with mock responses. Trigger: "gamma local dev", "gamma development setup", "gamma test locally", "gamma mock API", "gamma dev workflow".
What this skill does
# Gamma Local Dev Loop
## Overview
Set up an efficient local development workflow for Gamma API integrations. Since Gamma is a REST API with no SDK, the dev loop centers on HTTP request/response testing, mock servers for offline development, and a reusable client wrapper.
## Prerequisites
- Completed `gamma-install-auth` setup
- Node.js 18+ with `tsx` for TypeScript execution
- `GAMMA_API_KEY` in `.env`
## Instructions
### Step 1: Project Structure
```
gamma-integration/
├── src/
│ ├── client.ts # Reusable Gamma API client
│ ├── generate.ts # Generation workflows
│ └── poll.ts # Polling helper
├── test/
│ ├── mock-server.ts # Local mock for offline dev
│ └── integration.test.ts
├── .env # GAMMA_API_KEY (gitignored)
├── .env.example # Template without secrets
├── package.json
└── tsconfig.json
```
### Step 2: Reusable Client Wrapper
```typescript
// src/client.ts
import "dotenv/config";
const GAMMA_BASE = "https://public-api.gamma.app/v1.0";
export interface GammaClient {
generate(body: GenerateRequest): Promise<GenerateResponse>;
poll(generationId: string): Promise<PollResponse>;
listThemes(): Promise<Theme[]>;
listFolders(): Promise<Folder[]>;
}
export function createClient(apiKey?: string, baseUrl?: string): GammaClient {
const key = apiKey ?? process.env.GAMMA_API_KEY;
if (!key) throw new Error("GAMMA_API_KEY required");
const base = baseUrl ?? GAMMA_BASE;
const headers = { "X-API-KEY": key, "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,
});
if (!res.ok) {
const text = await res.text();
throw new Error(`Gamma ${res.status}: ${text}`);
}
return res.json();
}
return {
generate: (body) => request("POST", "/generations", body),
poll: (id) => request("GET", `/generations/${id}`),
listThemes: () => request("GET", "/themes"),
listFolders: () => request("GET", "/folders"),
};
}
```
### Step 3: Poll Helper with Timeout
```typescript
// src/poll.ts
import type { GammaClient } from "./client";
export async function waitForCompletion(
client: GammaClient,
generationId: string,
opts = { intervalMs: 5000, timeoutMs: 120000 }
) {
const deadline = Date.now() + opts.timeoutMs;
while (Date.now() < deadline) {
const result = await client.poll(generationId);
if (result.status === "completed") return result;
if (result.status === "failed") throw new Error(`Generation failed: ${result.error}`);
await new Promise((r) => setTimeout(r, opts.intervalMs));
}
throw new Error(`Poll timeout after ${opts.timeoutMs}ms`);
}
```
### Step 4: Mock Server for Offline Dev
```typescript
// test/mock-server.ts
import http from "node:http";
const MOCK_PORT = 9876;
const generations = new Map<string, { status: string; tick: number }>();
const server = http.createServer((req, res) => {
res.setHeader("Content-Type", "application/json");
// POST /v1.0/generations
if (req.method === "POST" && req.url === "/v1.0/generations") {
const id = `mock_${Date.now()}`;
generations.set(id, { status: "in_progress", tick: 0 });
res.end(JSON.stringify({ generationId: id }));
return;
}
// GET /v1.0/generations/:id — completes after 3 polls
const pollMatch = req.url?.match(/\/v1\.0\/generations\/(.+)/);
if (req.method === "GET" && pollMatch) {
const gen = generations.get(pollMatch[1]);
if (!gen) { res.writeHead(404); res.end("{}"); return; }
gen.tick++;
if (gen.tick >= 3) gen.status = "completed";
res.end(JSON.stringify({
generationId: pollMatch[1],
status: gen.status,
...(gen.status === "completed" && {
gammaUrl: `https://gamma.app/docs/mock-${pollMatch[1]}`,
exportUrl: `https://export.gamma.app/mock.pdf`,
creditsUsed: 10,
}),
}));
return;
}
// GET /v1.0/themes
if (req.url === "/v1.0/themes") {
res.end(JSON.stringify([
{ id: "theme_1", name: "Professional" },
{ id: "theme_2", name: "Modern" },
]));
return;
}
// GET /v1.0/folders
if (req.url === "/v1.0/folders") {
res.end(JSON.stringify([{ id: "folder_1", name: "Test Folder" }]));
return;
}
res.writeHead(404);
res.end("{}");
});
server.listen(MOCK_PORT, () => console.log(`Mock Gamma API on :${MOCK_PORT}`));
```
### Step 5: Development Scripts
```json
{
"scripts": {
"dev:mock": "tsx test/mock-server.ts",
"dev:generate": "tsx src/generate.ts",
"test": "vitest run",
"test:integration": "GAMMA_BASE=http://localhost:9876/v1.0 vitest run test/integration"
}
}
```
### Step 6: Integration Test
```typescript
// test/integration.test.ts
import { describe, it, expect } from "vitest";
import { createClient } from "../src/client";
import { waitForCompletion } from "../src/poll";
const BASE = process.env.GAMMA_BASE ?? "http://localhost:9876/v1.0";
describe("Gamma API", () => {
const client = createClient("test-key", BASE);
it("generates and polls to completion", async () => {
const { generationId } = await client.generate({
content: "Test presentation",
outputFormat: "presentation",
});
expect(generationId).toBeTruthy();
const result = await waitForCompletion(client, generationId);
expect(result.status).toBe("completed");
expect(result.gammaUrl).toContain("gamma.app");
});
it("lists workspace themes", async () => {
const themes = await client.listThemes();
expect(themes.length).toBeGreaterThan(0);
});
});
```
## Dev Loop Summary
| Activity | Command | Hits Live API? |
|----------|---------|----------------|
| Start mock server | `npm run dev:mock` | No |
| Generate (mock) | `GAMMA_BASE=http://localhost:9876/v1.0 npm run dev:generate` | No |
| Run tests | `npm test` (uses mock) | No |
| Live API test | `GAMMA_API_KEY=gma_... tsx src/generate.ts` | Yes |
## Error Handling
| Issue | Cause | Fix |
|-------|-------|-----|
| `GAMMA_API_KEY required` | Missing env var | Add to `.env` or export |
| Mock returns 404 | Wrong mock port/path | Verify `GAMMA_BASE` points to mock |
| Poll timeout locally | Mock tick count too high | Reduce tick threshold |
| `fetch is not defined` | Node.js < 18 | Upgrade to Node.js 18+ |
## Resources
- [Gamma Developer Docs](https://developers.gamma.app/)
- [Generate API Parameters](https://developers.gamma.app/guides/generate-api-parameters-explained)
## Next Steps
Proceed to `gamma-sdk-patterns` for reusable API wrapper patterns.
Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.