Back to Skills

gamma-sdk-patterns

verified
View on GitHub

Marketplace

claude-code-plugins-plus

jeremylongshore/claude-code-plugins-plus-skills

Plugin

gamma-pack

productivity

Repository

jeremylongshore/claude-code-plugins-plus-skills
1.1kstars

plugins/saas-packs/gamma-pack/skills/gamma-sdk-patterns/SKILL.md

Last Verified

January 22, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/jeremylongshore/claude-code-plugins-plus-skills/blob/main/plugins/saas-packs/gamma-pack/skills/gamma-sdk-patterns/SKILL.md -a claude-code --skill gamma-sdk-patterns

Installation paths:

Claude
.claude/skills/gamma-sdk-patterns/
Powered by add-skill CLI

Instructions

# Gamma SDK Patterns

## Overview
Learn idiomatic patterns and best practices for the Gamma SDK to build robust presentation automation.

## Prerequisites
- Completed `gamma-local-dev-loop` setup
- Familiarity with async/await patterns
- TypeScript recommended

## Instructions

### Pattern 1: Client Singleton
```typescript
// lib/gamma.ts
import { GammaClient } from '@gamma/sdk';

let client: GammaClient | null = null;

export function getGammaClient(): GammaClient {
  if (!client) {
    client = new GammaClient({
      apiKey: process.env.GAMMA_API_KEY,
      timeout: 30000,
      retries: 3,
    });
  }
  return client;
}
```

### Pattern 2: Presentation Builder
```typescript
// lib/presentation-builder.ts
import { getGammaClient } from './gamma';

interface SlideContent {
  title: string;
  content: string;
  layout?: 'title' | 'content' | 'image' | 'split';
}

export class PresentationBuilder {
  private slides: SlideContent[] = [];
  private title: string = '';
  private style: string = 'professional';

  setTitle(title: string): this {
    this.title = title;
    return this;
  }

  addSlide(slide: SlideContent): this {
    this.slides.push(slide);
    return this;
  }

  setStyle(style: string): this {
    this.style = style;
    return this;
  }

  async build() {
    const gamma = getGammaClient();
    return gamma.presentations.create({
      title: this.title,
      slides: this.slides,
      style: this.style,
    });
  }
}
```

### Pattern 3: Error Handling Wrapper
```typescript
// lib/safe-gamma.ts
import { GammaError } from '@gamma/sdk';

export async function safeGammaCall<T>(
  fn: () => Promise<T>
): Promise<{ data: T; error: null } | { data: null; error: string }> {
  try {
    const data = await fn();
    return { data, error: null };
  } catch (err) {
    if (err instanceof GammaError) {
      return { data: null, error: err.message };
    }
    throw err;
  }
}
```

### Pattern 4: Template Factory
```typescript
// lib/templates.ts
type Template

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
2887 chars