Przejdź do treści
Biblioteka skilli
Programowanie · Budowanie i kod

speak-sdk-patterns

/speak-sdk-patterns

Podaje produkcyjne wzorce użycia API Speak: sesje konwersacji, ocena wymowy, wstępne przetwarzanie audio i operacje wsadowe.

Licencja
MIT
Ostatnia zmiana repozytorium
26.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
2
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
3
Przestarzałość

Brak sygnałów. Repozytorium zmienione 26.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Podaje produkcyjne wzorce użycia API Speak: sesje konwersacji, ocena wymowy, wstępne przetwarzanie audio i operacje wsadowe.

Wyzwalacze z opisu

speak sdk patterns
Oryginalny opis (EN)

Production patterns for Speak language learning API: conversation sessions, pronunciation assessment, audio preprocessing, and batch operations. Use when implementing sdk patterns features, or troubleshooting Speak language learning integration issues. Trigger with phrases like "speak sdk patterns", "speak sdk patterns".

Jak działa

  1. Overview
  2. Prerequisites
  3. Instructions
  4. Output
  5. Error Handling
  6. Resources
  7. Next Steps
  8. Examples
Sekcje z nagłówków SKILL.md, w oryginale · 140 linii, 468 słów
Podgląd SKILL.md
---
name: speak-sdk-patterns
description: 'Production patterns for Speak language learning API: conversation sessions,
  pronunciation assessment, audio preprocessing, and batch operations.

  Use when implementing sdk patterns features,

  or troubleshooting Speak language learning integration issues.

  Trigger with phrases like "speak sdk patterns", "speak sdk patterns".

  '
allowed-tools: Read, Write, Edit, Bash(npm:*), Bash(curl:*), Grep
version: 1.14.0
license: MIT
author: Jeremy Longshore <jeremy@intentsolutions.io>
tags:
- saas
- speak
- api
compatibility: Designed for Claude Code
---
# Speak SDK Patterns

## Overview

Production patterns for Speak language learning API: conversation sessions, pronunciation assessment, audio preprocessing, and batch operations.

## Prerequisites

- Completed `speak-install-auth` setup
- Valid API credentials configured
- ffmpeg installed for audio processing

## Instructions

### Pattern 1: Conversation Session Manager

```typescript
class ConversationManager {
  private client: SpeakClient;
  private sessions: Map<string, SessionState> = new Map();

  async startLesson(language: string, scenario: string, level: string) {
    const session = await this.client.startConversation({
      scenario, language, level, nativeLanguage: 'en',
    });
    this.sessions.set(session.id, {
      turns: [], startTime: Date.now(), language,
    });
    return session;
  }

  async submitResponse(sessionId: string, audioPath: string) {
    const turn = await this.client.sendTurn(sessionId, { audioPath });
    this.sessions.get(sessionId)?.turns.push(turn);
    return turn;
  }

  async endAndReport(sessionId: string) {
    const summary = await this.client.endSession(sessionId);
    const state = this.sessions.get(sessionId)!;
    return {
      ...summary,
      duration: (Date.now() - state.startTime) / 1000,
      totalTurns: state.turns.length,
      avgPronunciation: state.turns.reduce((s, t) =>
        s + (t.pronunciationScore || 0), 0) / state.turns.length,
    };
  }
}
```

### Pattern 2: Audio Preprocessor

```typescript
import { execSync } from 'child_process';

function preprocessAudio(inputPath: string): string {
  const outputPath = inputPath.replace(/\.[^.]+$/, '.processed.wav');
  // Convert to WAV 16kHz mono PCM — required by Speak API
  execSync(
    `ffmpeg -y -i "${inputPath}" -ar 16000 -ac 1 -c:a pcm_s16le "${outputPath}"`,
    { stdio: 'pipe' }
  );
  return outputPath;
}
```

### Pattern 3: Retry with Backoff

```typescript
async function withRetry<T>(fn: () => Promise<T>, maxRetries = 3): Promise<T> {
  for (let i = 0; i < maxRetries; i++) {
    try {
      return await fn();
    } catch (err: any) {
      if (err.response?.status === 429 && i < maxRetries - 1) {
        const wait = parseInt(err.response.headers['retry-after'] || '5');
        await new Promise(r => setTimeout(r, wait * 1000));
        continue;
      }
      throw err;
    }
  }
  throw new Error('Max retries exceeded');
}
```

### Pattern 4: Progress Tracker

```typescript
class LearningProgress {
  private history: SessionSummary[] = [];

  addSession(summary: SessionSummary) {
    this.history.push(summary);
  }

  getReport() {
    const recent = this.history.slice(-10);
    return {
      totalSessions: this.history.length,
      avgPronunciation: recent.reduce((s, h) => s + h.avgPronunciationScore, 0) / recent.length,
      totalMinutes: this.history.reduce((s, h) => s + h.durationMinutes, 0),
      vocabularyLearned: [...new Set(this.history.flatMap(h => h.newWords))].length,
    };
  }
}
```

## Output

- Patterns implementation complete
- Speak API integration verified
- Production-ready patterns applied

## Error Handling

| Error | Cause | Solution |
|-------|-------|----------|
| 401 Unauthorized | Invalid API key | Verify SPEAK_API_KEY environment variable |
| 429 Rate Limited | Too many requests | Wait Retry-After seconds, use backoff |
| Audio format error | Wrong codec/sample rate | Convert to WAV 16kHz mono with ffmpeg |
| Session expired | Timeout after 30 min | Start a new conversation session |

## Resources

- [Speak Website](https://speak.com)
- [OpenAI Realtime API](https://platform.openai.com/docs/guides/realtime)
- [Speak GPT-4 Blog](https://speak.com/blog/speak-gpt-4)

## Next Steps

See `speak-prod-checklist` for production readiness.

## Examples

**Basic**: Apply sdk patterns with default configuration for a standard Speak integration.

**Advanced**: Customize for production with error recovery, monitoring, and team-specific requirements.
Pliki w paczce (2)
  • SKILL.md 4 KB
  • references/code-patterns.md 3 KB

Wersje

W bazie nie ma innych skilli o nazwie speak-sdk-patterns.

Identyczna treść występuje jeszcze w 1 innych folderach na GitHubie. Tu pokazujemy jedną, najlepiej ocenioną kopię.

Migawka bazy z 13.11.2026 · wersja paczki c2f3918d4a14 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100speak-performance-tuning
    Skraca opóźnienia API Speak przez wstępne przetwarzanie audio, cache odpowiedzi i pule połączeń.
  • 100speak-upgrade-migration
    Pomaga aktualizować wersje SDK Speak, migrować między platformami do nauki języków i obsługiwać zmiany wersji API.
  • 100deepgram-go-text-to-speech
    Syntezuje w Go dźwięk przez Speak v1 REST lub Speak WebSocket w SDK Deepgram.
  • 100linear-sdk-patterns
    Opisuje wzorce i dobre praktyki SDK TypeScript i JavaScript dla Linear, w tym idiomy i optymalizację użycia API.
  • 100perplexity-sdk-patterns
    Stosuje produkcyjne wzorce użycia SDK Perplexity w TypeScript i Pythonie oraz porządkuje standardy kodowania zespołu.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.