assemblyai-local-dev-loop
Configure AssemblyAI local development with hot reload and testing. Use when setting up a development environment, configuring test workflows, or establishing a fast iteration cycle with AssemblyAI. Trigger with phrases like "assemblyai dev setup", "assemblyai local development", "assemblyai dev environment", "develop with assemblyai".
What this skill does
# AssemblyAI Local Dev Loop
## Overview
Set up a fast, reproducible local development workflow for AssemblyAI transcription and LeMUR projects with mocking, caching, and hot reload.
## Prerequisites
- Completed `assemblyai-install-auth` setup
- Node.js 18+ with npm/pnpm
- TypeScript project with `tsx` or `ts-node`
## Instructions
### Step 1: Project Structure
```
my-assemblyai-project/
├── src/
│ ├── assemblyai/
│ │ ├── client.ts # Singleton client
│ │ ├── transcribe.ts # Transcription helpers
│ │ └── lemur.ts # LeMUR helpers
│ └── index.ts
├── tests/
│ ├── transcribe.test.ts
│ └── fixtures/
│ └── sample-transcript.json # Cached API response
├── .env.local # Local secrets (git-ignored)
├── .env.example # Template for team
└── package.json
```
### Step 2: Dev Scripts
```json
{
"scripts": {
"dev": "tsx watch src/index.ts",
"test": "vitest",
"test:watch": "vitest --watch",
"transcribe": "tsx src/assemblyai/transcribe.ts"
},
"devDependencies": {
"tsx": "^4.7.0",
"vitest": "^1.6.0",
"dotenv": "^16.4.0"
},
"dependencies": {
"assemblyai": "^4.8.0"
}
}
```
### Step 3: Singleton Client with Env Loading
```typescript
// src/assemblyai/client.ts
import 'dotenv/config';
import { AssemblyAI } from 'assemblyai';
let instance: AssemblyAI | null = null;
export function getClient(): AssemblyAI {
if (!instance) {
if (!process.env.ASSEMBLYAI_API_KEY) {
throw new Error('ASSEMBLYAI_API_KEY not set. Copy .env.example to .env.local');
}
instance = new AssemblyAI({
apiKey: process.env.ASSEMBLYAI_API_KEY,
});
}
return instance;
}
```
### Step 4: Cache Transcription Results for Fast Iteration
```typescript
// src/assemblyai/transcribe.ts
import fs from 'fs';
import path from 'path';
import { getClient } from './client';
import type { Transcript } from 'assemblyai';
const CACHE_DIR = path.join(process.cwd(), '.assemblyai-cache');
export async function transcribeWithCache(
audioUrl: string,
options: Record<string, any> = {}
): Promise<Transcript> {
const cacheKey = Buffer.from(audioUrl + JSON.stringify(options))
.toString('base64url')
.slice(0, 32);
const cachePath = path.join(CACHE_DIR, `${cacheKey}.json`);
// Return cached result in dev
if (process.env.NODE_ENV !== 'production' && fs.existsSync(cachePath)) {
console.log('[dev] Using cached transcript:', cacheKey);
return JSON.parse(fs.readFileSync(cachePath, 'utf-8'));
}
const client = getClient();
const transcript = await client.transcripts.transcribe({
audio: audioUrl,
...options,
});
// Cache for next run
fs.mkdirSync(CACHE_DIR, { recursive: true });
fs.writeFileSync(cachePath, JSON.stringify(transcript, null, 2));
console.log('[dev] Cached transcript:', cacheKey);
return transcript;
}
```
### Step 5: Test with Mocked Responses
```typescript
// tests/transcribe.test.ts
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { AssemblyAI } from 'assemblyai';
// Mock the assemblyai module
vi.mock('assemblyai', () => ({
AssemblyAI: vi.fn().mockImplementation(() => ({
transcripts: {
transcribe: vi.fn().mockResolvedValue({
id: 'test-transcript-id',
status: 'completed',
text: 'This is a test transcript.',
audio_duration: 30,
words: [
{ text: 'This', start: 0, end: 200, confidence: 0.99 },
{ text: 'is', start: 210, end: 350, confidence: 0.98 },
],
}),
get: vi.fn(),
list: vi.fn(),
},
lemur: {
task: vi.fn().mockResolvedValue({
request_id: 'test-lemur-id',
response: 'Test summary of the audio.',
}),
},
})),
}));
describe('Transcription', () => {
it('should transcribe audio and return text', async () => {
const client = new AssemblyAI({ apiKey: 'test-key' });
const result = await client.transcripts.transcribe({
audio: 'https://example.com/audio.wav',
});
expect(result.status).toBe('completed');
expect(result.text).toContain('test transcript');
expect(result.words).toHaveLength(2);
});
it('should run LeMUR task on transcript', async () => {
const client = new AssemblyAI({ apiKey: 'test-key' });
const { response } = await client.lemur.task({
transcript_ids: ['test-transcript-id'],
prompt: 'Summarize this.',
});
expect(response).toContain('summary');
});
});
```
## Output
- Hot-reloading dev server with `tsx watch`
- Cached transcription results to avoid repeated API calls during dev
- Mocked test suite that runs without API credentials
- Environment variable management with `.env.local`
## Error Handling
| Error | Cause | Solution |
|-------|-------|----------|
| `ASSEMBLYAI_API_KEY not set` | Missing env file | Copy `.env.example` to `.env.local` |
| `Module not found: assemblyai` | Missing dependency | Run `npm install assemblyai` |
| Stale cache results | Outdated cache | Delete `.assemblyai-cache/` directory |
| Test timeout | Slow mock setup | Ensure mocks resolve synchronously |
## Resources
- [AssemblyAI Node SDK](https://github.com/AssemblyAI/assemblyai-node-sdk)
- [Vitest Documentation](https://vitest.dev/)
- [tsx Documentation](https://github.com/privatenumber/tsx)
## Next Steps
See `assemblyai-sdk-patterns` for production-ready code patterns.
Related in Code Review
gstack
IncludedFast headless browser for QA testing and site dogfooding. Navigate pages, interact with elements, verify state, diff before/after, take annotated screenshots, test responsive layouts, forms, uploads, dialogs, and capture bug evidence. Use when asked to open or test a site, verify a deployment, dogfood a user flow, or file a bug with screenshots. (gstack)
startup-due-diligence
IncludedLegal due diligence review for seed-stage and Series A startups (US, Delaware C-Corp focus). Supports both investor and founder perspectives. Capabilities include: (1) Interactive document review and issue spotting; (2) Document request list generation; (3) Cap table and SAFE/convertible note analysis; (4) Red flag identification with severity ratings; (5) Diligence report generation. TRIGGERS: due diligence, DD, startup investment, cap table review, Series A, seed round, investor diligence, legal review startup, SAFE analysis, convertible note, 409A, founder vesting.
interview-master
IncludedThis skill should be used when the user asks to "generate interview questions", "prepare for interview", "optimize resume", "conduct mock interview", "analyze git commits for resume", "generate resume from code", "review my resume", or mentions interview preparation, career assistance, or extracting project experience from git history. Provides comprehensive interview and career development guidance for both job seekers and interviewers.
fix-issue
IncludedFixes GitHub issues using parallel analysis agents for root cause investigation, code exploration, and regression detection. Reads issue context from gh CLI, searches codebase and memory for related patterns, generates a fix with tests, and links the resolution back to the issue via PR. Includes prevention analysis to avoid recurrence. Use when debugging errors, resolving regressions, fixing bugs, or triaging issues.
sf-apex
IncludedGenerates and reviews Salesforce Apex code with 150-point scoring. TRIGGER when: user writes, reviews, or fixes Apex classes, triggers, test classes, batch/queueable/schedulable jobs, or touches .cls/.trigger files. DO NOT TRIGGER when: LWC JavaScript (use sf-lwc), Flow XML (use sf-flow), SOQL-only queries (use sf-soql), or non-Salesforce code.
swift-development
IncludedComprehensive Swift development for building, testing, and deploying iOS/macOS applications. Use when Claude needs to: (1) Build Swift packages or Xcode projects from command line, (2) Run tests with XCTest or Swift Testing framework, (3) Manage iOS simulators with simctl, (4) Handle code signing, provisioning profiles, and app distribution, (5) Format or lint Swift code with SwiftFormat/SwiftLint, (6) Work with Swift Package Manager (SPM), (7) Implement Swift 6 concurrency patterns (async/await, actors, Sendable), (8) Create SwiftUI views with MVVM architecture, (9) Set up Core Data or SwiftData persistence, or any other Swift/iOS/macOS development tasks.