[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6F9GF10DJXEYEQJ8E4FFQJY":3,"skill-same:01M6F9GF10DJXEYEQJ8E4FFQJY":76},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":44,"linkOnly":45,"markdownContent":46,"markdownBody":47,"frontMatter":48,"refName":53,"commitSha":54,"skillDirectory":55,"forksCount":56,"repositoryHtmlUrl":57,"repositoryHomepageUrl":6,"ownerHtmlUrl":58,"ownerBlogUrl":59,"ownerDescription":60,"updatedAt":61,"install":62,"resources":75},"01M6F9GF10DJXEYEQJ8E4FFQJY","twinmind-reference-architecture",null,"Implement TwinMind reference architecture with best-practice project layout.\nUse when designing new TwinMind integrations, reviewing project structure,\nor establishing architecture standards for meeting AI applications.\nTrigger with phrases like \"twinmind architecture\", \"twinmind best practices\",\n\"twinmind project structure\", \"how to organize twinmind\", \"twinmind layout\".","Dicklesworthstone\u002Fpi_agent_rust","Dicklesworthstone","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F35050222?v=4","01M6CG26AR942CSVMN1M5E3DSE","Jeff Emanuel","01M6CG26EPP71PSHW1VDS71121",1992,"MIT","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Fplugins-community\u002Fplugins\u002Fsaas-packs\u002Ftwinmind-pack\u002Fskills\u002Ftwinmind-reference-architecture\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43],"architecture","twinmind reference architecture","reference","organize","new","when","for","with","architecture standards","how to","trigger","io","layout","project","structure","implement","standards","best-practice","use","read","integrations","how","applications","best practices","project structure","2026-11-10 10:12:30",false,"---\nname: twinmind-reference-architecture\ndescription: |\n  Implement TwinMind reference architecture with best-practice project layout.\n  Use when designing new TwinMind integrations, reviewing project structure,\n  or establishing architecture standards for meeting AI applications.\n  Trigger with phrases like \"twinmind architecture\", \"twinmind best practices\",\n  \"twinmind project structure\", \"how to organize twinmind\", \"twinmind layout\".\nallowed-tools: Read, Grep\nversion: 1.0.0\nlicense: MIT\nauthor: Jeremy Longshore \u003Cjeremy@intentsolutions.io>\n---\n\n# TwinMind Reference Architecture\n\n## Overview\nProduction-ready architecture patterns for TwinMind meeting AI integrations.\n\n## Prerequisites\n- Understanding of layered architecture\n- TwinMind API knowledge\n- TypeScript project setup\n- Testing framework configured\n\n## Project Structure\n\n```\nmy-twinmind-project\u002F\n├── src\u002F\n│   ├── twinmind\u002F\n│   │   ├── client.ts           # Singleton client wrapper\n│   │   ├── config.ts           # Environment configuration\n│   │   ├── types.ts            # TypeScript types\n│   │   ├── errors.ts           # Custom error classes\n│   │   └── handlers\u002F\n│   │       ├── webhooks.ts     # Webhook handlers\n│   │       └── events.ts       # Event processing\n│   ├── services\u002F\n│   │   └── meeting\u002F\n│   │       ├── index.ts        # Service facade\n│   │       ├── transcription.ts # Transcription service\n│   │       ├── summary.ts      # Summary generation\n│   │       ├── actions.ts      # Action item extraction\n│   │       └── cache.ts        # Caching layer\n│   ├── integrations\u002F\n│   │   ├── calendar\u002F           # Calendar sync\n│   │   ├── slack\u002F              # Slack notifications\n│   │   ├── linear\u002F             # Task management\n│   │   └── email\u002F              # Follow-up emails\n│   ├── api\u002F\n│   │   ├── routes\u002F\n│   │   │   ├── meetings.ts     # Meeting endpoints\n│   │   │   ├── transcripts.ts  # Transcript endpoints\n│   │   │   └── webhooks.ts     # Webhook endpoint\n│   │   └── middleware\u002F\n│   │       ├── auth.ts         # Authentication\n│   │       ├── rateLimit.ts    # Rate limiting\n│   │       └── validation.ts   # Request validation\n│   ├── jobs\u002F\n│   │   ├── sync.ts             # Background sync job\n│   │   ├── cleanup.ts          # Data cleanup job\n│   │   └── reports.ts          # Report generation\n│   └── utils\u002F\n│       ├── audio.ts            # Audio processing\n│       ├── logging.ts          # Structured logging\n│       └── metrics.ts          # Prometheus metrics\n├── tests\u002F\n│   ├── unit\u002F\n│   │   └── twinmind\u002F\n│   ├── integration\u002F\n│   │   └── twinmind\u002F\n│   └── e2e\u002F\n│       └── meeting-flow.test.ts\n├── config\u002F\n│   ├── twinmind.development.json\n│   ├── twinmind.staging.json\n│   └── twinmind.production.json\n└── docs\u002F\n    ├── ARCHITECTURE.md\n    └── RUNBOOK.md\n```\n\n## Layer Architecture\n\n```\n┌─────────────────────────────────────────────────────┐\n│                   API Layer                          │\n│        (Controllers, Routes, Webhooks)               │\n├─────────────────────────────────────────────────────┤\n│                Service Layer                         │\n│      (Business Logic, Orchestration)                 │\n├─────────────────────────────────────────────────────┤\n│              TwinMind Layer                          │\n│       (Client, Types, Error Handling)                │\n├─────────────────────────────────────────────────────┤\n│             Integration Layer                        │\n│    (Calendar, Slack, Linear, Email)                  │\n├─────────────────────────────────────────────────────┤\n│            Infrastructure Layer                      │\n│       (Cache, Queue, Monitoring)                     │\n└─────────────────────────────────────────────────────┘\n```\n\n## Key Components\n\n### Step 1: Client Wrapper\n\n```typescript\n\u002F\u002F src\u002Ftwinmind\u002Fclient.ts\nimport axios, { AxiosInstance } from 'axios';\nimport { TwinMindConfig, loadConfig } from '.\u002Fconfig';\nimport { TranscriptCache } from '..\u002Fservices\u002Fmeeting\u002Fcache';\nimport { MetricsCollector } from '..\u002Futils\u002Fmetrics';\n\nexport class TwinMindService {\n  private client: AxiosInstance;\n  private cache: TranscriptCache;\n  private metrics: MetricsCollector;\n  private config: TwinMindConfig;\n\n  constructor(config?: TwinMindConfig) {\n    this.config = config || loadConfig();\n\n    this.client = axios.create({\n      baseURL: this.config.baseUrl,\n      headers: {\n        'Authorization': `Bearer ${this.config.apiKey}`,\n        'Content-Type': 'application\u002Fjson',\n      },\n      timeout: this.config.timeout,\n    });\n\n    this.cache = new TranscriptCache(this.config.cacheOptions);\n    this.metrics = new MetricsCollector('twinmind');\n\n    this.setupInterceptors();\n  }\n\n  private setupInterceptors(): void {\n    \u002F\u002F Request logging\n    this.client.interceptors.request.use((config) => {\n      this.metrics.incrementCounter('requests', { method: config.method });\n      return config;\n    });\n\n    \u002F\u002F Response handling\n    this.client.interceptors.response.use(\n      (response) => {\n        this.metrics.recordLatency(\n          'request_duration',\n          response.config.metadata?.startTime\n        );\n        return response;\n      },\n      (error) => {\n        this.metrics.incrementCounter('errors', {\n          status: error.response?.status || 'network',\n        });\n        throw error;\n      }\n    );\n  }\n\n  async transcribe(audioUrl: string, options?: TranscriptionOptions): Promise\u003CTranscript> {\n    return this.cache.getOrFetch(\n      `transcript:${audioUrl}`,\n      () => this.metrics.track(\n        'transcribe',\n        () => this.client.post('\u002Ftranscribe', { audio_url: audioUrl, ...options })\n      )\n    );\n  }\n\n  async summarize(transcriptId: string): Promise\u003CSummary> {\n    return this.metrics.track(\n      'summarize',\n      () => this.client.post('\u002Fsummarize', { transcript_id: transcriptId })\n    );\n  }\n\n  async search(query: string, options?: SearchOptions): Promise\u003CSearchResult[]> {\n    return this.client.get('\u002Fsearch', { params: { q: query, ...options } });\n  }\n}\n\n\u002F\u002F Singleton instance\nlet instance: TwinMindService | null = null;\n\nexport function getTwinMindService(): TwinMindService {\n  if (!instance) {\n    instance = new TwinMindService();\n  }\n  return instance;\n}\n```\n\n### Step 2: Service Layer\n\n```typescript\n\u002F\u002F src\u002Fservices\u002Fmeeting\u002Findex.ts\nimport { getTwinMindService } from '..\u002F..\u002Ftwinmind\u002Fclient';\nimport { TranscriptionService } from '.\u002Ftranscription';\nimport { SummaryService } from '.\u002Fsummary';\nimport { ActionItemService } from '.\u002Factions';\nimport { CalendarIntegration } from '..\u002F..\u002Fintegrations\u002Fcalendar';\nimport { SlackIntegration } from '..\u002F..\u002Fintegrations\u002Fslack';\n\nexport interface MeetingResult {\n  transcriptId: string;\n  transcript: Transcript;\n  summary: Summary;\n  actionItems: ActionItem[];\n  participants: Participant[];\n}\n\nexport class MeetingService {\n  private twinmind = getTwinMindService();\n  private transcription = new TranscriptionService();\n  private summaryService = new SummaryService();\n  private actionService = new ActionItemService();\n  private calendar = new CalendarIntegration();\n  private slack = new SlackIntegration();\n\n  async processMeeting(\n    audioUrl: string,\n    options: ProcessMeetingOptions = {}\n  ): Promise\u003CMeetingResult> {\n    \u002F\u002F Get calendar context\n    const calendarEvent = options.calendarEventId\n      ? await this.calendar.getEvent(options.calendarEventId)\n      : null;\n\n    \u002F\u002F Transcribe\n    const transcript = await this.transcription.transcribe(audioUrl, {\n      title: calendarEvent?.title || options.title,\n      attendees: calendarEvent?.attendees,\n    });\n\n    \u002F\u002F Generate summary and extract action items in parallel\n    const [summary, actionItems] = await Promise.all([\n      this.summaryService.generate(transcript.id),\n      this.actionService.extract(transcript.id),\n    ]);\n\n    \u002F\u002F Identify participants\n    const participants = await this.identifyParticipants(\n      transcript,\n      calendarEvent?.attendees\n    );\n\n    \u002F\u002F Notify if configured\n    if (options.notifySlack) {\n      await this.slack.notifyMeetingComplete({\n        title: transcript.title,\n        summary: summary.summary,\n        actionItems,\n      });\n    }\n\n    return {\n      transcriptId: transcript.id,\n      transcript,\n      summary,\n      actionItems,\n      participants,\n    };\n  }\n\n  private async identifyParticipants(\n    transcript: Transcript,\n    attendees?: string[]\n  ): Promise\u003CParticipant[]> {\n    \u002F\u002F Match speakers to attendees\n    const speakers = transcript.speakers || [];\n\n    return speakers.map((speaker, index) => ({\n      id: speaker.id,\n      name: attendees?.[index] || speaker.name || `Speaker ${index + 1}`,\n      speakingTime: this.calculateSpeakingTime(transcript.segments, speaker.id),\n    }));\n  }\n\n  private calculateSpeakingTime(segments: Segment[], speakerId: string): number {\n    return segments\n      .filter(s => s.speaker_id === speakerId)\n      .reduce((total, s) => total + (s.end - s.start), 0);\n  }\n}\n```\n\n### Step 3: Error Boundary\n\n```typescript\n\u002F\u002F src\u002Ftwinmind\u002Ferrors.ts\nexport class TwinMindError extends Error {\n  constructor(\n    message: string,\n    public readonly code: string,\n    public readonly statusCode?: number,\n    public readonly retryable: boolean = false,\n    public readonly originalError?: Error\n  ) {\n    super(message);\n    this.name = 'TwinMindError';\n  }\n\n  static fromApiError(error: any): TwinMindError {\n    const status = error.response?.status;\n    const message = error.response?.data?.message || error.message;\n    const code = error.response?.data?.code || 'UNKNOWN';\n\n    switch (status) {\n      case 401:\n        return new TwinMindError(message, 'AUTH_FAILED', status, false);\n      case 429:\n        return new TwinMindError(message, 'RATE_LIMITED', status, true);\n      case 500:\n      case 502:\n      case 503:\n        return new TwinMindError(message, 'SERVER_ERROR', status, true);\n      default:\n        return new TwinMindError(message, code, status, false, error);\n    }\n  }\n}\n\nexport function wrapWithErrorHandling\u003CT>(\n  operation: () => Promise\u003CT>\n): Promise\u003CT> {\n  return operation().catch((error) => {\n    throw TwinMindError.fromApiError(error);\n  });\n}\n```\n\n### Step 4: Health Check\n\n```typescript\n\u002F\u002F src\u002Ftwinmind\u002Fhealth.ts\nexport interface HealthStatus {\n  status: 'healthy' | 'degraded' | 'unhealthy';\n  checks: HealthCheck[];\n  timestamp: Date;\n}\n\nexport interface HealthCheck {\n  name: string;\n  status: 'pass' | 'warn' | 'fail';\n  latencyMs?: number;\n  message?: string;\n}\n\nexport async function checkHealth(): Promise\u003CHealthStatus> {\n  const checks: HealthCheck[] = [];\n\n  \u002F\u002F Check TwinMind API\n  const apiCheck = await checkApiHealth();\n  checks.push(apiCheck);\n\n  \u002F\u002F Check cache\n  const cacheCheck = await checkCacheHealth();\n  checks.push(cacheCheck);\n\n  \u002F\u002F Check database\n  const dbCheck = await checkDatabaseHealth();\n  checks.push(dbCheck);\n\n  \u002F\u002F Determine overall status\n  const hasFailure = checks.some(c => c.status === 'fail');\n  const hasWarning = checks.some(c => c.status === 'warn');\n\n  return {\n    status: hasFailure ? 'unhealthy' : hasWarning ? 'degraded' : 'healthy',\n    checks,\n    timestamp: new Date(),\n  };\n}\n\nasync function checkApiHealth(): Promise\u003CHealthCheck> {\n  const start = Date.now();\n  try {\n    const service = getTwinMindService();\n    await service.healthCheck();\n    return {\n      name: 'twinmind_api',\n      status: 'pass',\n      latencyMs: Date.now() - start,\n    };\n  } catch (error: any) {\n    return {\n      name: 'twinmind_api',\n      status: 'fail',\n      latencyMs: Date.now() - start,\n      message: error.message,\n    };\n  }\n}\n```\n\n## Data Flow Diagram\n\n```\n                              ┌───────────────┐\n                              │   Calendar    │\n                              │   (Google)    │\n                              └───────┬───────┘\n                                      │ sync\n┌──────────┐                 ┌────────▼────────┐\n│  Client  │─────request────►│   API Gateway   │\n│   App    │◄────response────│                 │\n└──────────┘                 └────────┬────────┘\n                                      │\n                             ┌────────▼────────┐\n                             │  Meeting        │\n                             │  Service        │\n                             └────────┬────────┘\n                                      │\n              ┌───────────────────────┼───────────────────────┐\n              │                       │                       │\n     ┌────────▼────────┐    ┌────────▼────────┐    ┌────────▼────────┐\n     │  Transcription  │    │    Summary      │    │  Action Items   │\n     │    Service      │    │    Service      │    │    Service      │\n     └────────┬────────┘    └────────┬────────┘    └────────┬────────┘\n              │                       │                       │\n              └───────────────────────┼───────────────────────┘\n                                      │\n                             ┌────────▼────────┐\n                             │   TwinMind      │\n                             │     API         │\n                             └────────┬────────┘\n                                      │\n              ┌───────────────────────┼───────────────────────┐\n              │                       │                       │\n     ┌────────▼────────┐    ┌────────▼────────┐    ┌────────▼────────┐\n     │     Slack       │    │     Linear      │    │     Email       │\n     │  (notifications)│    │    (tasks)      │    │  (follow-ups)   │\n     └─────────────────┘    └─────────────────┘    └─────────────────┘\n```\n\n## Configuration Management\n\n```typescript\n\u002F\u002F config\u002Ftwinmind.ts\nexport interface TwinMindConfig {\n  apiKey: string;\n  baseUrl: string;\n  environment: 'development' | 'staging' | 'production';\n  timeout: number;\n  retries: number;\n  cacheOptions: {\n    enabled: boolean;\n    ttlSeconds: number;\n  };\n  features: {\n    diarization: boolean;\n    autoSummary: boolean;\n    actionItemExtraction: boolean;\n  };\n}\n\nexport function loadConfig(): TwinMindConfig {\n  const env = process.env.NODE_ENV || 'development';\n  const envConfig = require(`.\u002Ftwinmind.${env}.json`);\n\n  return {\n    apiKey: process.env.TWINMIND_API_KEY!,\n    baseUrl: process.env.TWINMIND_API_URL || 'https:\u002F\u002Fapi.twinmind.com\u002Fv1',\n    environment: env as any,\n    timeout: parseInt(process.env.TWINMIND_TIMEOUT || '30000'),\n    retries: parseInt(process.env.TWINMIND_RETRIES || '3'),\n    ...envConfig,\n  };\n}\n```\n\n## Output\n- Structured project layout\n- Client wrapper with caching and metrics\n- Service layer with business logic\n- Error boundary implemented\n- Health checks configured\n- Configuration management\n\n## Error Handling\n\n| Issue | Cause | Solution |\n|-------|-------|----------|\n| Circular dependencies | Wrong layering | Separate concerns by layer |\n| Config not loading | Wrong paths | Verify config file locations |\n| Type errors | Missing types | Add TwinMind types |\n| Test isolation | Shared state | Use dependency injection |\n\n## Resources\n- [TwinMind API Reference](https:\u002F\u002Ftwinmind.com\u002Fdocs\u002Fapi)\n- [Clean Architecture](https:\u002F\u002Fblog.cleancoder.com\u002Funcle-bob\u002F2012\u002F08\u002F13\u002Fthe-clean-architecture.html)\n- [TypeScript Best Practices](https:\u002F\u002Fwww.typescriptlang.org\u002Fdocs\u002Fhandbook\u002Fdeclaration-files\u002Fdo-s-and-don-ts.html)\n\n## Flagship Skills\nFor multi-environment setup, see `twinmind-multi-env-setup`.\n","# TwinMind Reference Architecture\n\n## Overview\nProduction-ready architecture patterns for TwinMind meeting AI integrations.\n\n## Prerequisites\n- Understanding of layered architecture\n- TwinMind API knowledge\n- TypeScript project setup\n- Testing framework configured\n\n## Project Structure\n\n```\nmy-twinmind-project\u002F\n├── src\u002F\n│   ├── twinmind\u002F\n│   │   ├── client.ts           # Singleton client wrapper\n│   │   ├── config.ts           # Environment configuration\n│   │   ├── types.ts            # TypeScript types\n│   │   ├── errors.ts           # Custom error classes\n│   │   └── handlers\u002F\n│   │       ├── webhooks.ts     # Webhook handlers\n│   │       └── events.ts       # Event processing\n│   ├── services\u002F\n│   │   └── meeting\u002F\n│   │       ├── index.ts        # Service facade\n│   │       ├── transcription.ts # Transcription service\n│   │       ├── summary.ts      # Summary generation\n│   │       ├── actions.ts      # Action item extraction\n│   │       └── cache.ts        # Caching layer\n│   ├── integrations\u002F\n│   │   ├── calendar\u002F           # Calendar sync\n│   │   ├── slack\u002F              # Slack notifications\n│   │   ├── linear\u002F             # Task management\n│   │   └── email\u002F              # Follow-up emails\n│   ├── api\u002F\n│   │   ├── routes\u002F\n│   │   │   ├── meetings.ts     # Meeting endpoints\n│   │   │   ├── transcripts.ts  # Transcript endpoints\n│   │   │   └── webhooks.ts     # Webhook endpoint\n│   │   └── middleware\u002F\n│   │       ├── auth.ts         # Authentication\n│   │       ├── rateLimit.ts    # Rate limiting\n│   │       └── validation.ts   # Request validation\n│   ├── jobs\u002F\n│   │   ├── sync.ts             # Background sync job\n│   │   ├── cleanup.ts          # Data cleanup job\n│   │   └── reports.ts          # Report generation\n│   └── utils\u002F\n│       ├── audio.ts            # Audio processing\n│       ├── logging.ts          # Structured logging\n│       └── metrics.ts          # Prometheus metrics\n├── tests\u002F\n│   ├── unit\u002F\n│   │   └── twinmind\u002F\n│   ├── integration\u002F\n│   │   └── twinmind\u002F\n│   └── e2e\u002F\n│       └── meeting-flow.test.ts\n├── config\u002F\n│   ├── twinmind.development.json\n│   ├── twinmind.staging.json\n│   └── twinmind.production.json\n└── docs\u002F\n    ├── ARCHITECTURE.md\n    └── RUNBOOK.md\n```\n\n## Layer Architecture\n\n```\n┌─────────────────────────────────────────────────────┐\n│                   API Layer                          │\n│        (Controllers, Routes, Webhooks)               │\n├─────────────────────────────────────────────────────┤\n│                Service Layer                         │\n│      (Business Logic, Orchestration)                 │\n├─────────────────────────────────────────────────────┤\n│              TwinMind Layer                          │\n│       (Client, Types, Error Handling)                │\n├─────────────────────────────────────────────────────┤\n│             Integration Layer                        │\n│    (Calendar, Slack, Linear, Email)                  │\n├─────────────────────────────────────────────────────┤\n│            Infrastructure Layer                      │\n│       (Cache, Queue, Monitoring)                     │\n└─────────────────────────────────────────────────────┘\n```\n\n## Key Components\n\n### Step 1: Client Wrapper\n\n```typescript\n\u002F\u002F src\u002Ftwinmind\u002Fclient.ts\nimport axios, { AxiosInstance } from 'axios';\nimport { TwinMindConfig, loadConfig } from '.\u002Fconfig';\nimport { TranscriptCache } from '..\u002Fservices\u002Fmeeting\u002Fcache';\nimport { MetricsCollector } from '..\u002Futils\u002Fmetrics';\n\nexport class TwinMindService {\n  private client: AxiosInstance;\n  private cache: TranscriptCache;\n  private metrics: MetricsCollector;\n  private config: TwinMindConfig;\n\n  constructor(config?: TwinMindConfig) {\n    this.config = config || loadConfig();\n\n    this.client = axios.create({\n      baseURL: this.config.baseUrl,\n      headers: {\n        'Authorization': `Bearer ${this.config.apiKey}`,\n        'Content-Type': 'application\u002Fjson',\n      },\n      timeout: this.config.timeout,\n    });\n\n    this.cache = new TranscriptCache(this.config.cacheOptions);\n    this.metrics = new MetricsCollector('twinmind');\n\n    this.setupInterceptors();\n  }\n\n  private setupInterceptors(): void {\n    \u002F\u002F Request logging\n    this.client.interceptors.request.use((config) => {\n      this.metrics.incrementCounter('requests', { method: config.method });\n      return config;\n    });\n\n    \u002F\u002F Response handling\n    this.client.interceptors.response.use(\n      (response) => {\n        this.metrics.recordLatency(\n          'request_duration',\n          response.config.metadata?.startTime\n        );\n        return response;\n      },\n      (error) => {\n        this.metrics.incrementCounter('errors', {\n          status: error.response?.status || 'network',\n        });\n        throw error;\n      }\n    );\n  }\n\n  async transcribe(audioUrl: string, options?: TranscriptionOptions): Promise\u003CTranscript> {\n    return this.cache.getOrFetch(\n      `transcript:${audioUrl}`,\n      () => this.metrics.track(\n        'transcribe',\n        () => this.client.post('\u002Ftranscribe', { audio_url: audioUrl, ...options })\n      )\n    );\n  }\n\n  async summarize(transcriptId: string): Promise\u003CSummary> {\n    return this.metrics.track(\n      'summarize',\n      () => this.client.post('\u002Fsummarize', { transcript_id: transcriptId })\n    );\n  }\n\n  async search(query: string, options?: SearchOptions): Promise\u003CSearchResult[]> {\n    return this.client.get('\u002Fsearch', { params: { q: query, ...options } });\n  }\n}\n\n\u002F\u002F Singleton instance\nlet instance: TwinMindService | null = null;\n\nexport function getTwinMindService(): TwinMindService {\n  if (!instance) {\n    instance = new TwinMindService();\n  }\n  return instance;\n}\n```\n\n### Step 2: Service Layer\n\n```typescript\n\u002F\u002F src\u002Fservices\u002Fmeeting\u002Findex.ts\nimport { getTwinMindService } from '..\u002F..\u002Ftwinmind\u002Fclient';\nimport { TranscriptionService } from '.\u002Ftranscription';\nimport { SummaryService } from '.\u002Fsummary';\nimport { ActionItemService } from '.\u002Factions';\nimport { CalendarIntegration } from '..\u002F..\u002Fintegrations\u002Fcalendar';\nimport { SlackIntegration } from '..\u002F..\u002Fintegrations\u002Fslack';\n\nexport interface MeetingResult {\n  transcriptId: string;\n  transcript: Transcript;\n  summary: Summary;\n  actionItems: ActionItem[];\n  participants: Participant[];\n}\n\nexport class MeetingService {\n  private twinmind = getTwinMindService();\n  private transcription = new TranscriptionService();\n  private summaryService = new SummaryService();\n  private actionService = new ActionItemService();\n  private calendar = new CalendarIntegration();\n  private slack = new SlackIntegration();\n\n  async processMeeting(\n    audioUrl: string,\n    options: ProcessMeetingOptions = {}\n  ): Promise\u003CMeetingResult> {\n    \u002F\u002F Get calendar context\n    const calendarEvent = options.calendarEventId\n      ? await this.calendar.getEvent(options.calendarEventId)\n      : null;\n\n    \u002F\u002F Transcribe\n    const transcript = await this.transcription.transcribe(audioUrl, {\n      title: calendarEvent?.title || options.title,\n      attendees: calendarEvent?.attendees,\n    });\n\n    \u002F\u002F Generate summary and extract action items in parallel\n    const [summary, actionItems] = await Promise.all([\n      this.summaryService.generate(transcript.id),\n      this.actionService.extract(transcript.id),\n    ]);\n\n    \u002F\u002F Identify participants\n    const participants = await this.identifyParticipants(\n      transcript,\n      calendarEvent?.attendees\n    );\n\n    \u002F\u002F Notify if configured\n    if (options.notifySlack) {\n      await this.slack.notifyMeetingComplete({\n        title: transcript.title,\n        summary: summary.summary,\n        actionItems,\n      });\n    }\n\n    return {\n      transcriptId: transcript.id,\n      transcript,\n      summary,\n      actionItems,\n      participants,\n    };\n  }\n\n  private async identifyParticipants(\n    transcript: Transcript,\n    attendees?: string[]\n  ): Promise\u003CParticipant[]> {\n    \u002F\u002F Match speakers to attendees\n    const speakers = transcript.speakers || [];\n\n    return speakers.map((speaker, index) => ({\n      id: speaker.id,\n      name: attendees?.[index] || speaker.name || `Speaker ${index + 1}`,\n      speakingTime: this.calculateSpeakingTime(transcript.segments, speaker.id),\n    }));\n  }\n\n  private calculateSpeakingTime(segments: Segment[], speakerId: string): number {\n    return segments\n      .filter(s => s.speaker_id === speakerId)\n      .reduce((total, s) => total + (s.end - s.start), 0);\n  }\n}\n```\n\n### Step 3: Error Boundary\n\n```typescript\n\u002F\u002F src\u002Ftwinmind\u002Ferrors.ts\nexport class TwinMindError extends Error {\n  constructor(\n    message: string,\n    public readonly code: string,\n    public readonly statusCode?: number,\n    public readonly retryable: boolean = false,\n    public readonly originalError?: Error\n  ) {\n    super(message);\n    this.name = 'TwinMindError';\n  }\n\n  static fromApiError(error: any): TwinMindError {\n    const status = error.response?.status;\n    const message = error.response?.data?.message || error.message;\n    const code = error.response?.data?.code || 'UNKNOWN';\n\n    switch (status) {\n      case 401:\n        return new TwinMindError(message, 'AUTH_FAILED', status, false);\n      case 429:\n        return new TwinMindError(message, 'RATE_LIMITED', status, true);\n      case 500:\n      case 502:\n      case 503:\n        return new TwinMindError(message, 'SERVER_ERROR', status, true);\n      default:\n        return new TwinMindError(message, code, status, false, error);\n    }\n  }\n}\n\nexport function wrapWithErrorHandling\u003CT>(\n  operation: () => Promise\u003CT>\n): Promise\u003CT> {\n  return operation().catch((error) => {\n    throw TwinMindError.fromApiError(error);\n  });\n}\n```\n\n### Step 4: Health Check\n\n```typescript\n\u002F\u002F src\u002Ftwinmind\u002Fhealth.ts\nexport interface HealthStatus {\n  status: 'healthy' | 'degraded' | 'unhealthy';\n  checks: HealthCheck[];\n  timestamp: Date;\n}\n\nexport interface HealthCheck {\n  name: string;\n  status: 'pass' | 'warn' | 'fail';\n  latencyMs?: number;\n  message?: string;\n}\n\nexport async function checkHealth(): Promise\u003CHealthStatus> {\n  const checks: HealthCheck[] = [];\n\n  \u002F\u002F Check TwinMind API\n  const apiCheck = await checkApiHealth();\n  checks.push(apiCheck);\n\n  \u002F\u002F Check cache\n  const cacheCheck = await checkCacheHealth();\n  checks.push(cacheCheck);\n\n  \u002F\u002F Check database\n  const dbCheck = await checkDatabaseHealth();\n  checks.push(dbCheck);\n\n  \u002F\u002F Determine overall status\n  const hasFailure = checks.some(c => c.status === 'fail');\n  const hasWarning = checks.some(c => c.status === 'warn');\n\n  return {\n    status: hasFailure ? 'unhealthy' : hasWarning ? 'degraded' : 'healthy',\n    checks,\n    timestamp: new Date(),\n  };\n}\n\nasync function checkApiHealth(): Promise\u003CHealthCheck> {\n  const start = Date.now();\n  try {\n    const service = getTwinMindService();\n    await service.healthCheck();\n    return {\n      name: 'twinmind_api',\n      status: 'pass',\n      latencyMs: Date.now() - start,\n    };\n  } catch (error: any) {\n    return {\n      name: 'twinmind_api',\n      status: 'fail',\n      latencyMs: Date.now() - start,\n      message: error.message,\n    };\n  }\n}\n```\n\n## Data Flow Diagram\n\n```\n                              ┌───────────────┐\n                              │   Calendar    │\n                              │   (Google)    │\n                              └───────┬───────┘\n                                      │ sync\n┌──────────┐                 ┌────────▼────────┐\n│  Client  │─────request────►│   API Gateway   │\n│   App    │◄────response────│                 │\n└──────────┘                 └────────┬────────┘\n                                      │\n                             ┌────────▼────────┐\n                             │  Meeting        │\n                             │  Service        │\n                             └────────┬────────┘\n                                      │\n              ┌───────────────────────┼───────────────────────┐\n              │                       │                       │\n     ┌────────▼────────┐    ┌────────▼────────┐    ┌────────▼────────┐\n     │  Transcription  │    │    Summary      │    │  Action Items   │\n     │    Service      │    │    Service      │    │    Service      │\n     └────────┬────────┘    └────────┬────────┘    └────────┬────────┘\n              │                       │                       │\n              └───────────────────────┼───────────────────────┘\n                                      │\n                             ┌────────▼────────┐\n                             │   TwinMind      │\n                             │     API         │\n                             └────────┬────────┘\n                                      │\n              ┌───────────────────────┼───────────────────────┐\n              │                       │                       │\n     ┌────────▼────────┐    ┌────────▼────────┐    ┌────────▼────────┐\n     │     Slack       │    │     Linear      │    │     Email       │\n     │  (notifications)│    │    (tasks)      │    │  (follow-ups)   │\n     └─────────────────┘    └─────────────────┘    └─────────────────┘\n```\n\n## Configuration Management\n\n```typescript\n\u002F\u002F config\u002Ftwinmind.ts\nexport interface TwinMindConfig {\n  apiKey: string;\n  baseUrl: string;\n  environment: 'development' | 'staging' | 'production';\n  timeout: number;\n  retries: number;\n  cacheOptions: {\n    enabled: boolean;\n    ttlSeconds: number;\n  };\n  features: {\n    diarization: boolean;\n    autoSummary: boolean;\n    actionItemExtraction: boolean;\n  };\n}\n\nexport function loadConfig(): TwinMindConfig {\n  const env = process.env.NODE_ENV || 'development';\n  const envConfig = require(`.\u002Ftwinmind.${env}.json`);\n\n  return {\n    apiKey: process.env.TWINMIND_API_KEY!,\n    baseUrl: process.env.TWINMIND_API_URL || 'https:\u002F\u002Fapi.twinmind.com\u002Fv1',\n    environment: env as any,\n    timeout: parseInt(process.env.TWINMIND_TIMEOUT || '30000'),\n    retries: parseInt(process.env.TWINMIND_RETRIES || '3'),\n    ...envConfig,\n  };\n}\n```\n\n## Output\n- Structured project layout\n- Client wrapper with caching and metrics\n- Service layer with business logic\n- Error boundary implemented\n- Health checks configured\n- Configuration management\n\n## Error Handling\n\n| Issue | Cause | Solution |\n|-------|-------|----------|\n| Circular dependencies | Wrong layering | Separate concerns by layer |\n| Config not loading | Wrong paths | Verify config file locations |\n| Type errors | Missing types | Add TwinMind types |\n| Test isolation | Shared state | Use dependency injection |\n\n## Resources\n- [TwinMind API Reference](https:\u002F\u002Ftwinmind.com\u002Fdocs\u002Fapi)\n- [Clean Architecture](https:\u002F\u002Fblog.cleancoder.com\u002Funcle-bob\u002F2012\u002F08\u002F13\u002Fthe-clean-architecture.html)\n- [TypeScript Best Practices](https:\u002F\u002Fwww.typescriptlang.org\u002Fdocs\u002Fhandbook\u002Fdeclaration-files\u002Fdo-s-and-don-ts.html)\n\n## Flagship Skills\nFor multi-environment setup, see `twinmind-multi-env-setup`.\n",{"name":5,"author":49,"license":15,"version":50,"description":51,"allowed-tools":52},"Jeremy Longshore \u003Cjeremy@intentsolutions.io>","1.0.0","Implement TwinMind reference architecture with best-practice project layout.\nUse when designing new TwinMind integrations, reviewing project structure,\nor establishing architecture standards for meeting AI applications.\nTrigger with phrases like \"twinmind architecture\", \"twinmind best practices\",\n\"twinmind project structure\", \"how to organize twinmind\", \"twinmind layout\".\n","Read, Grep","main","90b50ed0778745a80fd5bfb13b1843d45b9e82f7","tests\u002Fext_conformance\u002Fartifacts\u002Fplugins-community\u002Fplugins\u002Fsaas-packs\u002Ftwinmind-pack\u002Fskills\u002Ftwinmind-reference-architecture",233,"https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust","https:\u002F\u002Fgithub.com\u002FDicklesworthstone","https:\u002F\u002Fwww.jeffreyemanuel.com\u002F","Building in NY","2026-11-15 01:54:15",{"source":8,"skillName":5,"commands":63,"prompt":73,"zipAvailable":74},[64,67,70],{"tool":65,"command":66},"npx","npx skills add Dicklesworthstone\u002Fpi_agent_rust --skill twinmind-reference-architecture",{"tool":68,"command":69},"bunx","bunx skills add Dicklesworthstone\u002Fpi_agent_rust --skill twinmind-reference-architecture",{"tool":71,"command":72},"pnpm","pnpm dlx skills add Dicklesworthstone\u002Fpi_agent_rust --skill twinmind-reference-architecture","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Fplugins-community\u002Fplugins\u002Fsaas-packs\u002Ftwinmind-pack\u002Fskills\u002Ftwinmind-reference-architecture\u002FSKILL.md",true,[],[77,110,144,166,192,217],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":81,"licenseFileUrl":82,"sourceHtmlUrl":83,"categories":84,"keywords":90,"publishedAt":109},"01M6FCR7G5A005P364Z6ZWCJDP","theme-factory","Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors\u002Ffonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.","Apache-2.0","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fcreative-design\u002Ftheme-factory\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fcreative-design\u002Ftheme-factory\u002FSKILL.md",[85],{"categoryNo":86,"categoryName":87,"taxonomyType":88,"taxonomyTypeDesc":89},"01JBSEEDCAT000000000000015","视觉设计","SCENARIO","使用场景",[91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,26,107,108],"theme factory","factory","theme","docs","toolkit","generate","artifacts","SET","fly","slides","landing","html","styling","artifact","pages","themes","you","fonts","2026-11-11 15:11:14",{"skillNo":111,"name":112,"nameZh":6,"description":113,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":81,"licenseFileUrl":114,"sourceHtmlUrl":115,"categories":116,"keywords":120,"publishedAt":44},"01M6FEGPPK0ZTKCCM0R3E3KS33","web-artifacts-builder","Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn\u002Fui). Use for complex artifacts requiring state management, routing, or shadcn\u002Fui components - not for simple single-file HTML\u002FJSX artifacts.","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Futilities\u002Fweb-artifacts-builder\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Futilities\u002Fweb-artifacts-builder\u002FSKILL.md",[117],{"categoryNo":118,"categoryName":119,"taxonomyType":88,"taxonomyTypeDesc":89},"01JBSEEDCAT000000000000009","前端开发",[121,122,97,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,37,102,138,139,140,141,25,142,143],"web artifacts builder","web","artifacts builder","builder","frontend","css","components","react","component","routing","state management","state","shadcn","file","ui","Tools","Tailwind","single-file","simple","ui components","multi","jsx","suite",{"skillNo":145,"name":146,"nameZh":6,"description":147,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":81,"licenseFileUrl":148,"sourceHtmlUrl":149,"categories":150,"keywords":155,"publishedAt":44},"01M6FEE9VTK1W4GY21AKREJXRG","webapp-testing","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fsecurity\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fsecurity\u002Fwebapp-testing\u002FSKILL.md",[151,154],{"categoryNo":152,"categoryName":153,"taxonomyType":88,"taxonomyTypeDesc":89},"01JBSEEDCAT000000000000008","测试与质量",{"categoryNo":118,"categoryName":119,"taxonomyType":88,"taxonomyTypeDesc":89},[156,157,158,125,159,160,122,161,95,162,135,163,41,164,165,26,25],"testing","webapp testing","webapp","screenshots","playwright","debugging","browser","logs","behavior","local",{"skillNo":167,"name":168,"nameZh":6,"description":169,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":170,"sourceHtmlUrl":171,"categories":172,"keywords":173,"publishedAt":44},"01M6FE20F7ZTQBFWKF4MPJ2SBX","neuropixels-analysis","Neuropixels neural recording analysis. Load SpikeGLX\u002FOpenEphys data, preprocess, motion correction, Kilosort4 spike sorting, quality metrics, Allen\u002FIBL curation, AI-assisted visual analysis, for Neuropixels 1.0\u002F2.0 extracellular electrophysiology. Use when working with neural recordings, spike sorting, extracellular electrophysiology, or when the user mentions Neuropixels, SpikeGLX, Open Ephys, Kilosort, quality metrics, or unit curation.","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fscientific\u002Fneuropixels-analysis\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fscientific\u002Fneuropixels-analysis\u002FSKILL.md",[],[174,175,176,177,178,179,180,181,37,182,183,184,185,186,187,188,26,189,190,191,25,24],"analysis","neuropixels analysis","spike","metrics","data","open","quality","user","recordings","Neural","motion","visual","quality metrics","unit","sorting","curation","recording","load",{"skillNo":193,"name":194,"nameZh":6,"description":195,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":81,"licenseFileUrl":196,"sourceHtmlUrl":197,"categories":198,"keywords":202,"publishedAt":44},"01M6FDP0PDK6F1GGX395C7625Z","skill-creator","Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fproductivity\u002Fskill-creator\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fproductivity\u002Fskill-creator\u002FSKILL.md",[199],{"categoryNo":200,"categoryName":201,"taxonomyType":88,"taxonomyTypeDesc":89},"01JBSEEDCAT000000000000023","Skill与智能体开发",[203,204,205,206,207,208,209,210,39,211,212,213,214,215,26,25,216,24,23],"skill creator","creator","workflows","create","update","capabilities","knowledge","tool","specialized","guide","new skill","existing skill","users","Existing",{"skillNo":218,"name":219,"nameZh":6,"description":220,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":221,"sourceHtmlUrl":222,"categories":223,"keywords":225,"publishedAt":44},"01M6FDM8Y7VK7NYG9SM7QPA3PW","notebooklm","Use this skill to query your Google NotebookLM notebooks directly from Claude Code for source-grounded, citation-backed answers from Gemini. Browser automation, library management, persistent auth. Drastically reduced hallucinations through document-only responses.","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fproductivity\u002Fnotebooklm\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fproductivity\u002Fnotebooklm\u002FSKILL.md",[224],{"categoryNo":200,"categoryName":201,"taxonomyType":88,"taxonomyTypeDesc":89},[219,226,227,228,229,230,231,162,232,233,37,234,235,236,237,25,238],"google","browser automation","gemini","automation","auth","code","library","management","only","document","query","Citation","source"]