[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6F6E0AYF2XWSM6S6X36CBSF":3,"skill-same:01M6F6E0AYF2XWSM6S6X36CBSF":75},{"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":43,"linkOnly":44,"markdownContent":45,"markdownBody":46,"frontMatter":47,"refName":52,"commitSha":53,"skillDirectory":54,"forksCount":55,"repositoryHtmlUrl":56,"repositoryHomepageUrl":6,"ownerHtmlUrl":57,"ownerBlogUrl":58,"ownerDescription":59,"updatedAt":60,"install":61,"resources":74},"01M6F6E0AYF2XWSM6S6X36CBSF","documenso-reference-architecture",null,"Implement Documenso reference architecture with best-practice project layout.\nUse when designing new Documenso integrations, reviewing project structure,\nor establishing architecture standards for document signing applications.\nTrigger with phrases like \"documenso architecture\", \"documenso best practices\",\n\"documenso project structure\", \"how to organize documenso\".","Dicklesworthstone\u002Fpi_agent_rust","Dicklesworthstone","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F35050222?v=4","01M6CG26AR942CSVMN1M5E3DSE","Jeff Emanuel","01M6CG26EPP71PSHW1VDS71121",1981,"MIT","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Fplugins-community\u002Fplugins\u002Fsaas-packs\u002Fdocumenso-pack\u002Fskills\u002Fdocumenso-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],"architecture","documenso","documenso reference architecture","reference","new","project structure","when","for","how to","trigger","io","layout","project","structure","organize","document","standards","best-practice","use","read","integrations","how","applications","best practices","2026-11-10 10:12:30",false,"---\nname: documenso-reference-architecture\ndescription: |\n  Implement Documenso reference architecture with best-practice project layout.\n  Use when designing new Documenso integrations, reviewing project structure,\n  or establishing architecture standards for document signing applications.\n  Trigger with phrases like \"documenso architecture\", \"documenso best practices\",\n  \"documenso project structure\", \"how to organize documenso\".\nallowed-tools: Read, Grep\nversion: 1.0.0\nlicense: MIT\nauthor: Jeremy Longshore \u003Cjeremy@intentsolutions.io>\n---\n\n# Documenso Reference Architecture\n\n## Overview\nProduction-ready architecture patterns for Documenso document signing integrations.\n\n## Prerequisites\n- Understanding of layered architecture\n- Documenso SDK knowledge\n- TypeScript project setup\n- Testing framework configured\n\n## Project Structure\n\n```\nmy-signing-app\u002F\n├── src\u002F\n│   ├── documenso\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│   │   └── signing\u002F\n│   │       ├── index.ts        # Service facade\n│   │       ├── documents.ts    # Document operations\n│   │       ├── templates.ts    # Template operations\n│   │       └── cache.ts        # Caching layer\n│   ├── api\u002F\n│   │   └── signing\u002F\n│   │       ├── routes.ts       # API routes\n│   │       └── webhook.ts      # Webhook endpoint\n│   ├── jobs\u002F\n│   │   └── signing\u002F\n│   │       ├── cleanup.ts      # Draft cleanup job\n│   │       └── sync.ts         # Status sync job\n│   └── utils\u002F\n│       ├── pdf.ts              # PDF utilities\n│       └── validation.ts       # Input validation\n├── tests\u002F\n│   ├── unit\u002F\n│   │   └── signing\u002F\n│   │       ├── documents.test.ts\n│   │       └── templates.test.ts\n│   └── integration\u002F\n│       └── signing\u002F\n│           └── workflows.test.ts\n├── config\u002F\n│   ├── documenso.development.json\n│   ├── documenso.staging.json\n│   └── documenso.production.json\n├── templates\u002F\n│   └── pdf\u002F                    # PDF template files\n│       ├── nda.pdf\n│       ├── contract.pdf\n│       └── agreement.pdf\n└── docs\u002F\n    └── signing\u002F\n        ├── SETUP.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│          Documenso Layer                 │\n│   (Client, Types, Error Handling)        │\n├─────────────────────────────────────────┤\n│         Infrastructure Layer             │\n│    (Cache, Queue, Monitoring)            │\n└─────────────────────────────────────────┘\n```\n\n## Key Components\n\n### Documenso Client Wrapper\n\n```typescript\n\u002F\u002F src\u002Fdocumenso\u002Fclient.ts\nimport { Documenso } from \"@documenso\u002Fsdk-typescript\";\nimport { DocumensoConfig, loadDocumensoConfig } from \".\u002Fconfig\";\nimport { CacheService } from \"..\u002Fservices\u002Fsigning\u002Fcache\";\nimport { MetricsService } from \"..\u002Futils\u002Fmetrics\";\n\nexport class DocumensoService {\n  private client: Documenso;\n  private cache: CacheService;\n  private metrics: MetricsService;\n\n  constructor(config: DocumensoConfig) {\n    this.client = new Documenso({\n      apiKey: config.apiKey,\n      serverURL: config.baseUrl,\n      timeoutMs: config.timeout,\n    });\n    this.cache = new CacheService(config.cacheOptions);\n    this.metrics = new MetricsService(\"documenso\");\n  }\n\n  async getDocument(documentId: string) {\n    return this.cache.getOrFetch(\n      `doc:${documentId}`,\n      () => this.metrics.track(\"getDocument\", () =>\n        this.client.documents.getV0({ documentId })\n      ),\n      { ttl: 300 }\n    );\n  }\n\n  async createDocument(input: CreateDocumentInput) {\n    return this.metrics.track(\"createDocument\", () =>\n      this.client.documents.createV0(input)\n    );\n  }\n\n  \u002F\u002F Expose raw client for advanced use cases\n  getRawClient(): Documenso {\n    return this.client;\n  }\n}\n\n\u002F\u002F Singleton instance\nlet service: DocumensoService | null = null;\n\nexport function getDocumensoService(): DocumensoService {\n  if (!service) {\n    const config = loadDocumensoConfig();\n    service = new DocumensoService(config);\n  }\n  return service;\n}\n```\n\n### Configuration Management\n\n```typescript\n\u002F\u002F src\u002Fdocumenso\u002Fconfig.ts\nimport { z } from \"zod\";\n\nconst ConfigSchema = z.object({\n  apiKey: z.string().min(1),\n  baseUrl: z.string().url().optional(),\n  timeout: z.number().default(30000),\n  cacheOptions: z.object({\n    enabled: z.boolean().default(true),\n    ttl: z.number().default(300),\n  }).default({}),\n});\n\nexport type DocumensoConfig = z.infer\u003Ctypeof ConfigSchema>;\n\nexport function loadDocumensoConfig(): DocumensoConfig {\n  const env = process.env.NODE_ENV ?? \"development\";\n\n  \u002F\u002F Load environment-specific config\n  let fileConfig = {};\n  try {\n    fileConfig = require(`..\u002F..\u002Fconfig\u002Fdocumenso.${env}.json`);\n  } catch {\n    console.warn(`No config file for environment: ${env}`);\n  }\n\n  \u002F\u002F Merge with environment variables\n  const config = {\n    apiKey: process.env.DOCUMENSO_API_KEY ?? \"\",\n    baseUrl: process.env.DOCUMENSO_BASE_URL,\n    ...fileConfig,\n  };\n\n  return ConfigSchema.parse(config);\n}\n```\n\n### Error Boundary\n\n```typescript\n\u002F\u002F src\u002Fdocumenso\u002Ferrors.ts\nexport class DocumensoServiceError extends Error {\n  constructor(\n    message: string,\n    public readonly code: string,\n    public readonly statusCode: number,\n    public readonly retryable: boolean,\n    public readonly originalError?: Error\n  ) {\n    super(message);\n    this.name = \"DocumensoServiceError\";\n  }\n\n  static fromSdkError(error: any): DocumensoServiceError {\n    const statusCode = error.statusCode ?? error.status ?? 0;\n    const retryable = statusCode === 429 || statusCode >= 500;\n\n    return new DocumensoServiceError(\n      error.message,\n      `DOCUMENSO_${statusCode}`,\n      statusCode,\n      retryable,\n      error\n    );\n  }\n}\n\nexport async function withErrorHandling\u003CT>(\n  operation: () => Promise\u003CT>\n): Promise\u003CT> {\n  try {\n    return await operation();\n  } catch (error) {\n    throw DocumensoServiceError.fromSdkError(error);\n  }\n}\n```\n\n### Service Facade\n\n```typescript\n\u002F\u002F src\u002Fservices\u002Fsigning\u002Findex.ts\nimport { getDocumensoService } from \"..\u002F..\u002Fdocumenso\u002Fclient\";\nimport { withErrorHandling } from \"..\u002F..\u002Fdocumenso\u002Ferrors\";\nimport { validateCreateDocumentInput } from \"..\u002F..\u002Futils\u002Fvalidation\";\n\nexport interface SigningService {\n  createAndSendDocument(input: CreateDocumentInput): Promise\u003CDocumentResult>;\n  getDocumentStatus(documentId: string): Promise\u003CDocumentStatus>;\n  downloadSignedDocument(documentId: string): Promise\u003CBuffer>;\n}\n\nexport class SigningServiceImpl implements SigningService {\n  private documenso = getDocumensoService();\n\n  async createAndSendDocument(\n    input: CreateDocumentInput\n  ): Promise\u003CDocumentResult> {\n    \u002F\u002F Validate input\n    const validated = validateCreateDocumentInput(input);\n\n    return withErrorHandling(async () => {\n      \u002F\u002F Create from template\n      const envelope = await this.documenso.getRawClient().envelopes.useV0({\n        templateId: validated.templateId,\n        title: validated.title,\n        recipients: validated.recipients.map((r, i) => ({\n          email: r.email,\n          name: r.name,\n          signerIndex: i,\n        })),\n      });\n\n      \u002F\u002F Send immediately\n      await this.documenso.getRawClient().envelopes.distributeV0({\n        envelopeId: envelope.envelopeId!,\n      });\n\n      return {\n        documentId: envelope.envelopeId!,\n        status: \"SENT\",\n      };\n    });\n  }\n\n  async getDocumentStatus(documentId: string): Promise\u003CDocumentStatus> {\n    const doc = await this.documenso.getDocument(documentId);\n    return {\n      id: doc.id!,\n      status: doc.status!,\n      recipients: doc.recipients?.map((r) => ({\n        email: r.email!,\n        status: r.signingStatus!,\n      })) ?? [],\n    };\n  }\n\n  async downloadSignedDocument(documentId: string): Promise\u003CBuffer> {\n    return withErrorHandling(async () => {\n      const result = await this.documenso.getRawClient().documents.downloadV0({\n        documentId,\n      });\n      \u002F\u002F Handle the download response\n      return Buffer.from(result as any);\n    });\n  }\n}\n\n\u002F\u002F Export singleton\nlet signingService: SigningService | null = null;\n\nexport function getSigningService(): SigningService {\n  if (!signingService) {\n    signingService = new SigningServiceImpl();\n  }\n  return signingService;\n}\n```\n\n### Health Check\n\n```typescript\n\u002F\u002F src\u002Fdocumenso\u002Fhealth.ts\nimport { getDocumensoService } from \".\u002Fclient\";\n\nexport interface HealthStatus {\n  status: \"healthy\" | \"degraded\" | \"unhealthy\";\n  latencyMs: number;\n  error?: string;\n}\n\nexport async function checkDocumensoHealth(): Promise\u003CHealthStatus> {\n  const service = getDocumensoService();\n  const start = Date.now();\n\n  try {\n    await service.getRawClient().documents.findV0({ perPage: 1 });\n    return {\n      status: \"healthy\",\n      latencyMs: Date.now() - start,\n    };\n  } catch (error: any) {\n    return {\n      status: \"unhealthy\",\n      latencyMs: Date.now() - start,\n      error: error.message,\n    };\n  }\n}\n```\n\n## Data Flow Diagram\n\n```\nUser Request\n     │\n     ▼\n┌─────────────┐\n│   API       │\n│   Layer     │\n└──────┬──────┘\n       │\n       ▼\n┌─────────────┐    ┌─────────────┐\n│  Service    │───▶│   Cache     │\n│   Layer     │    │  (Redis)    │\n└──────┬──────┘    └─────────────┘\n       │\n       ▼\n┌─────────────┐    ┌─────────────┐\n│ Documenso   │───▶│   Queue     │\n│   Layer     │    │  (Bull)     │\n└──────┬──────┘    └─────────────┘\n       │\n       ▼\n┌─────────────┐\n│ Documenso   │\n│   API       │\n└─────────────┘\n```\n\n## Webhook Architecture\n\n```\nDocumenso\n    │\n    ▼ POST \u002Fwebhooks\u002Fdocumenso\n┌─────────────┐\n│  Webhook    │\n│  Handler    │\n└──────┬──────┘\n       │\n       ▼\n┌─────────────┐\n│  Event      │\n│  Queue      │\n└──────┬──────┘\n       │\n       ├──▶ Update Database\n       ├──▶ Send Notifications\n       ├──▶ Trigger Workflows\n       └──▶ Update Cache\n```\n\n## Setup Script\n\n```bash\n#!\u002Fbin\u002Fbash\n# scripts\u002Fsetup-documenso-structure.sh\n\n# Create directory structure\nmkdir -p src\u002Fdocumenso\u002Fhandlers\nmkdir -p src\u002Fservices\u002Fsigning\nmkdir -p src\u002Fapi\u002Fsigning\nmkdir -p src\u002Fjobs\u002Fsigning\nmkdir -p src\u002Futils\nmkdir -p tests\u002Funit\u002Fsigning\nmkdir -p tests\u002Fintegration\u002Fsigning\nmkdir -p config\nmkdir -p templates\u002Fpdf\nmkdir -p docs\u002Fsigning\n\n# Create placeholder files\ntouch src\u002Fdocumenso\u002F{client,config,types,errors}.ts\ntouch src\u002Fdocumenso\u002Fhandlers\u002F{webhooks,events}.ts\ntouch src\u002Fservices\u002Fsigning\u002F{index,documents,templates,cache}.ts\ntouch src\u002Fapi\u002Fsigning\u002F{routes,webhook}.ts\ntouch config\u002Fdocumenso.{development,staging,production}.json\n\necho \"Documenso project structure created!\"\n```\n\n## Output\n- Structured project layout\n- Layered architecture implemented\n- Error handling configured\n- Health checks ready\n\n## Error Handling\n| Issue | Cause | Solution |\n|-------|-------|----------|\n| Circular dependencies | Wrong layering | Separate by layer |\n| Config not loading | Wrong paths | Verify file locations |\n| Cache misses | Wrong keys | Check key generation |\n| Test isolation | Shared state | Use dependency injection |\n\n## Resources\n- [Clean Architecture](https:\u002F\u002Fblog.cleancoder.com\u002Funcle-bob\u002F2012\u002F08\u002F13\u002Fthe-clean-architecture.html)\n- [Documenso SDK](https:\u002F\u002Fgithub.com\u002Fdocumenso\u002Fsdk-typescript)\n- [TypeScript Project References](https:\u002F\u002Fwww.typescriptlang.org\u002Fdocs\u002Fhandbook\u002Fproject-references.html)\n\n## Next Steps\nFor multi-environment setup, see `documenso-multi-env-setup`.\n","# Documenso Reference Architecture\n\n## Overview\nProduction-ready architecture patterns for Documenso document signing integrations.\n\n## Prerequisites\n- Understanding of layered architecture\n- Documenso SDK knowledge\n- TypeScript project setup\n- Testing framework configured\n\n## Project Structure\n\n```\nmy-signing-app\u002F\n├── src\u002F\n│   ├── documenso\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│   │   └── signing\u002F\n│   │       ├── index.ts        # Service facade\n│   │       ├── documents.ts    # Document operations\n│   │       ├── templates.ts    # Template operations\n│   │       └── cache.ts        # Caching layer\n│   ├── api\u002F\n│   │   └── signing\u002F\n│   │       ├── routes.ts       # API routes\n│   │       └── webhook.ts      # Webhook endpoint\n│   ├── jobs\u002F\n│   │   └── signing\u002F\n│   │       ├── cleanup.ts      # Draft cleanup job\n│   │       └── sync.ts         # Status sync job\n│   └── utils\u002F\n│       ├── pdf.ts              # PDF utilities\n│       └── validation.ts       # Input validation\n├── tests\u002F\n│   ├── unit\u002F\n│   │   └── signing\u002F\n│   │       ├── documents.test.ts\n│   │       └── templates.test.ts\n│   └── integration\u002F\n│       └── signing\u002F\n│           └── workflows.test.ts\n├── config\u002F\n│   ├── documenso.development.json\n│   ├── documenso.staging.json\n│   └── documenso.production.json\n├── templates\u002F\n│   └── pdf\u002F                    # PDF template files\n│       ├── nda.pdf\n│       ├── contract.pdf\n│       └── agreement.pdf\n└── docs\u002F\n    └── signing\u002F\n        ├── SETUP.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│          Documenso Layer                 │\n│   (Client, Types, Error Handling)        │\n├─────────────────────────────────────────┤\n│         Infrastructure Layer             │\n│    (Cache, Queue, Monitoring)            │\n└─────────────────────────────────────────┘\n```\n\n## Key Components\n\n### Documenso Client Wrapper\n\n```typescript\n\u002F\u002F src\u002Fdocumenso\u002Fclient.ts\nimport { Documenso } from \"@documenso\u002Fsdk-typescript\";\nimport { DocumensoConfig, loadDocumensoConfig } from \".\u002Fconfig\";\nimport { CacheService } from \"..\u002Fservices\u002Fsigning\u002Fcache\";\nimport { MetricsService } from \"..\u002Futils\u002Fmetrics\";\n\nexport class DocumensoService {\n  private client: Documenso;\n  private cache: CacheService;\n  private metrics: MetricsService;\n\n  constructor(config: DocumensoConfig) {\n    this.client = new Documenso({\n      apiKey: config.apiKey,\n      serverURL: config.baseUrl,\n      timeoutMs: config.timeout,\n    });\n    this.cache = new CacheService(config.cacheOptions);\n    this.metrics = new MetricsService(\"documenso\");\n  }\n\n  async getDocument(documentId: string) {\n    return this.cache.getOrFetch(\n      `doc:${documentId}`,\n      () => this.metrics.track(\"getDocument\", () =>\n        this.client.documents.getV0({ documentId })\n      ),\n      { ttl: 300 }\n    );\n  }\n\n  async createDocument(input: CreateDocumentInput) {\n    return this.metrics.track(\"createDocument\", () =>\n      this.client.documents.createV0(input)\n    );\n  }\n\n  \u002F\u002F Expose raw client for advanced use cases\n  getRawClient(): Documenso {\n    return this.client;\n  }\n}\n\n\u002F\u002F Singleton instance\nlet service: DocumensoService | null = null;\n\nexport function getDocumensoService(): DocumensoService {\n  if (!service) {\n    const config = loadDocumensoConfig();\n    service = new DocumensoService(config);\n  }\n  return service;\n}\n```\n\n### Configuration Management\n\n```typescript\n\u002F\u002F src\u002Fdocumenso\u002Fconfig.ts\nimport { z } from \"zod\";\n\nconst ConfigSchema = z.object({\n  apiKey: z.string().min(1),\n  baseUrl: z.string().url().optional(),\n  timeout: z.number().default(30000),\n  cacheOptions: z.object({\n    enabled: z.boolean().default(true),\n    ttl: z.number().default(300),\n  }).default({}),\n});\n\nexport type DocumensoConfig = z.infer\u003Ctypeof ConfigSchema>;\n\nexport function loadDocumensoConfig(): DocumensoConfig {\n  const env = process.env.NODE_ENV ?? \"development\";\n\n  \u002F\u002F Load environment-specific config\n  let fileConfig = {};\n  try {\n    fileConfig = require(`..\u002F..\u002Fconfig\u002Fdocumenso.${env}.json`);\n  } catch {\n    console.warn(`No config file for environment: ${env}`);\n  }\n\n  \u002F\u002F Merge with environment variables\n  const config = {\n    apiKey: process.env.DOCUMENSO_API_KEY ?? \"\",\n    baseUrl: process.env.DOCUMENSO_BASE_URL,\n    ...fileConfig,\n  };\n\n  return ConfigSchema.parse(config);\n}\n```\n\n### Error Boundary\n\n```typescript\n\u002F\u002F src\u002Fdocumenso\u002Ferrors.ts\nexport class DocumensoServiceError extends Error {\n  constructor(\n    message: string,\n    public readonly code: string,\n    public readonly statusCode: number,\n    public readonly retryable: boolean,\n    public readonly originalError?: Error\n  ) {\n    super(message);\n    this.name = \"DocumensoServiceError\";\n  }\n\n  static fromSdkError(error: any): DocumensoServiceError {\n    const statusCode = error.statusCode ?? error.status ?? 0;\n    const retryable = statusCode === 429 || statusCode >= 500;\n\n    return new DocumensoServiceError(\n      error.message,\n      `DOCUMENSO_${statusCode}`,\n      statusCode,\n      retryable,\n      error\n    );\n  }\n}\n\nexport async function withErrorHandling\u003CT>(\n  operation: () => Promise\u003CT>\n): Promise\u003CT> {\n  try {\n    return await operation();\n  } catch (error) {\n    throw DocumensoServiceError.fromSdkError(error);\n  }\n}\n```\n\n### Service Facade\n\n```typescript\n\u002F\u002F src\u002Fservices\u002Fsigning\u002Findex.ts\nimport { getDocumensoService } from \"..\u002F..\u002Fdocumenso\u002Fclient\";\nimport { withErrorHandling } from \"..\u002F..\u002Fdocumenso\u002Ferrors\";\nimport { validateCreateDocumentInput } from \"..\u002F..\u002Futils\u002Fvalidation\";\n\nexport interface SigningService {\n  createAndSendDocument(input: CreateDocumentInput): Promise\u003CDocumentResult>;\n  getDocumentStatus(documentId: string): Promise\u003CDocumentStatus>;\n  downloadSignedDocument(documentId: string): Promise\u003CBuffer>;\n}\n\nexport class SigningServiceImpl implements SigningService {\n  private documenso = getDocumensoService();\n\n  async createAndSendDocument(\n    input: CreateDocumentInput\n  ): Promise\u003CDocumentResult> {\n    \u002F\u002F Validate input\n    const validated = validateCreateDocumentInput(input);\n\n    return withErrorHandling(async () => {\n      \u002F\u002F Create from template\n      const envelope = await this.documenso.getRawClient().envelopes.useV0({\n        templateId: validated.templateId,\n        title: validated.title,\n        recipients: validated.recipients.map((r, i) => ({\n          email: r.email,\n          name: r.name,\n          signerIndex: i,\n        })),\n      });\n\n      \u002F\u002F Send immediately\n      await this.documenso.getRawClient().envelopes.distributeV0({\n        envelopeId: envelope.envelopeId!,\n      });\n\n      return {\n        documentId: envelope.envelopeId!,\n        status: \"SENT\",\n      };\n    });\n  }\n\n  async getDocumentStatus(documentId: string): Promise\u003CDocumentStatus> {\n    const doc = await this.documenso.getDocument(documentId);\n    return {\n      id: doc.id!,\n      status: doc.status!,\n      recipients: doc.recipients?.map((r) => ({\n        email: r.email!,\n        status: r.signingStatus!,\n      })) ?? [],\n    };\n  }\n\n  async downloadSignedDocument(documentId: string): Promise\u003CBuffer> {\n    return withErrorHandling(async () => {\n      const result = await this.documenso.getRawClient().documents.downloadV0({\n        documentId,\n      });\n      \u002F\u002F Handle the download response\n      return Buffer.from(result as any);\n    });\n  }\n}\n\n\u002F\u002F Export singleton\nlet signingService: SigningService | null = null;\n\nexport function getSigningService(): SigningService {\n  if (!signingService) {\n    signingService = new SigningServiceImpl();\n  }\n  return signingService;\n}\n```\n\n### Health Check\n\n```typescript\n\u002F\u002F src\u002Fdocumenso\u002Fhealth.ts\nimport { getDocumensoService } from \".\u002Fclient\";\n\nexport interface HealthStatus {\n  status: \"healthy\" | \"degraded\" | \"unhealthy\";\n  latencyMs: number;\n  error?: string;\n}\n\nexport async function checkDocumensoHealth(): Promise\u003CHealthStatus> {\n  const service = getDocumensoService();\n  const start = Date.now();\n\n  try {\n    await service.getRawClient().documents.findV0({ perPage: 1 });\n    return {\n      status: \"healthy\",\n      latencyMs: Date.now() - start,\n    };\n  } catch (error: any) {\n    return {\n      status: \"unhealthy\",\n      latencyMs: Date.now() - start,\n      error: error.message,\n    };\n  }\n}\n```\n\n## Data Flow Diagram\n\n```\nUser Request\n     │\n     ▼\n┌─────────────┐\n│   API       │\n│   Layer     │\n└──────┬──────┘\n       │\n       ▼\n┌─────────────┐    ┌─────────────┐\n│  Service    │───▶│   Cache     │\n│   Layer     │    │  (Redis)    │\n└──────┬──────┘    └─────────────┘\n       │\n       ▼\n┌─────────────┐    ┌─────────────┐\n│ Documenso   │───▶│   Queue     │\n│   Layer     │    │  (Bull)     │\n└──────┬──────┘    └─────────────┘\n       │\n       ▼\n┌─────────────┐\n│ Documenso   │\n│   API       │\n└─────────────┘\n```\n\n## Webhook Architecture\n\n```\nDocumenso\n    │\n    ▼ POST \u002Fwebhooks\u002Fdocumenso\n┌─────────────┐\n│  Webhook    │\n│  Handler    │\n└──────┬──────┘\n       │\n       ▼\n┌─────────────┐\n│  Event      │\n│  Queue      │\n└──────┬──────┘\n       │\n       ├──▶ Update Database\n       ├──▶ Send Notifications\n       ├──▶ Trigger Workflows\n       └──▶ Update Cache\n```\n\n## Setup Script\n\n```bash\n#!\u002Fbin\u002Fbash\n# scripts\u002Fsetup-documenso-structure.sh\n\n# Create directory structure\nmkdir -p src\u002Fdocumenso\u002Fhandlers\nmkdir -p src\u002Fservices\u002Fsigning\nmkdir -p src\u002Fapi\u002Fsigning\nmkdir -p src\u002Fjobs\u002Fsigning\nmkdir -p src\u002Futils\nmkdir -p tests\u002Funit\u002Fsigning\nmkdir -p tests\u002Fintegration\u002Fsigning\nmkdir -p config\nmkdir -p templates\u002Fpdf\nmkdir -p docs\u002Fsigning\n\n# Create placeholder files\ntouch src\u002Fdocumenso\u002F{client,config,types,errors}.ts\ntouch src\u002Fdocumenso\u002Fhandlers\u002F{webhooks,events}.ts\ntouch src\u002Fservices\u002Fsigning\u002F{index,documents,templates,cache}.ts\ntouch src\u002Fapi\u002Fsigning\u002F{routes,webhook}.ts\ntouch config\u002Fdocumenso.{development,staging,production}.json\n\necho \"Documenso project structure created!\"\n```\n\n## Output\n- Structured project layout\n- Layered architecture implemented\n- Error handling configured\n- Health checks ready\n\n## Error Handling\n| Issue | Cause | Solution |\n|-------|-------|----------|\n| Circular dependencies | Wrong layering | Separate by layer |\n| Config not loading | Wrong paths | Verify file locations |\n| Cache misses | Wrong keys | Check key generation |\n| Test isolation | Shared state | Use dependency injection |\n\n## Resources\n- [Clean Architecture](https:\u002F\u002Fblog.cleancoder.com\u002Funcle-bob\u002F2012\u002F08\u002F13\u002Fthe-clean-architecture.html)\n- [Documenso SDK](https:\u002F\u002Fgithub.com\u002Fdocumenso\u002Fsdk-typescript)\n- [TypeScript Project References](https:\u002F\u002Fwww.typescriptlang.org\u002Fdocs\u002Fhandbook\u002Fproject-references.html)\n\n## Next Steps\nFor multi-environment setup, see `documenso-multi-env-setup`.\n",{"name":5,"author":48,"license":15,"version":49,"description":50,"allowed-tools":51},"Jeremy Longshore \u003Cjeremy@intentsolutions.io>","1.0.0","Implement Documenso reference architecture with best-practice project layout.\nUse when designing new Documenso integrations, reviewing project structure,\nor establishing architecture standards for document signing applications.\nTrigger with phrases like \"documenso architecture\", \"documenso best practices\",\n\"documenso project structure\", \"how to organize documenso\".\n","Read, Grep","main","90b50ed0778745a80fd5bfb13b1843d45b9e82f7","tests\u002Fext_conformance\u002Fartifacts\u002Fplugins-community\u002Fplugins\u002Fsaas-packs\u002Fdocumenso-pack\u002Fskills\u002Fdocumenso-reference-architecture",231,"https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust","https:\u002F\u002Fgithub.com\u002FDicklesworthstone","https:\u002F\u002Fwww.jeffreyemanuel.com\u002F","Building in NY","2026-11-12 03:15:57",{"source":8,"skillName":5,"commands":62,"prompt":72,"zipAvailable":73},[63,66,69],{"tool":64,"command":65},"npx","npx skills add Dicklesworthstone\u002Fpi_agent_rust --skill documenso-reference-architecture",{"tool":67,"command":68},"bunx","bunx skills add Dicklesworthstone\u002Fpi_agent_rust --skill documenso-reference-architecture",{"tool":70,"command":71},"pnpm","pnpm dlx skills add Dicklesworthstone\u002Fpi_agent_rust --skill documenso-reference-architecture","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Fplugins-community\u002Fplugins\u002Fsaas-packs\u002Fdocumenso-pack\u002Fskills\u002Fdocumenso-reference-architecture\u002FSKILL.md",true,[],[76,115,139,165,190,211],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":80,"licenseFileUrl":81,"sourceHtmlUrl":82,"categories":83,"keywords":89,"publishedAt":43},"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.","Apache-2.0","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",[84],{"categoryNo":85,"categoryName":86,"taxonomyType":87,"taxonomyTypeDesc":88},"01JBSEEDCAT000000000000009","前端开发","SCENARIO","使用场景",[90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,37,108,109,110,111,112,26,113,114],"web artifacts builder","web","artifacts","artifacts builder","builder","frontend","css","components","react","component","routing","state management","state","shadcn","file","ui","Tools","Tailwind","html","single-file","simple","ui components","multi","jsx","suite",{"skillNo":116,"name":117,"nameZh":6,"description":118,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":80,"licenseFileUrl":119,"sourceHtmlUrl":120,"categories":121,"keywords":126,"publishedAt":43},"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",[122,125],{"categoryNo":123,"categoryName":124,"taxonomyType":87,"taxonomyTypeDesc":88},"01JBSEEDCAT000000000000008","测试与质量",{"categoryNo":85,"categoryName":86,"taxonomyType":87,"taxonomyTypeDesc":88},[127,128,129,95,130,131,91,132,133,134,105,135,41,136,137,138,26],"testing","webapp testing","webapp","screenshots","playwright","debugging","toolkit","browser","logs","behavior","local","with",{"skillNo":140,"name":141,"nameZh":6,"description":142,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":143,"sourceHtmlUrl":144,"categories":145,"keywords":146,"publishedAt":43},"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",[],[147,148,149,150,151,152,153,154,37,155,156,157,158,159,160,161,138,162,163,164,26,25],"analysis","neuropixels analysis","spike","metrics","data","open","quality","user","recordings","Neural","motion","visual","quality metrics","unit","sorting","curation","recording","load",{"skillNo":166,"name":167,"nameZh":6,"description":168,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":80,"licenseFileUrl":169,"sourceHtmlUrl":170,"categories":171,"keywords":175,"publishedAt":43},"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",[172],{"categoryNo":173,"categoryName":174,"taxonomyType":87,"taxonomyTypeDesc":88},"01JBSEEDCAT000000000000023","Skill与智能体开发",[176,177,178,179,180,181,182,183,39,184,185,186,187,188,138,26,189,25,23],"skill creator","creator","workflows","create","update","capabilities","knowledge","tool","specialized","guide","new skill","existing skill","users","Existing",{"skillNo":191,"name":192,"nameZh":6,"description":193,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":194,"sourceHtmlUrl":195,"categories":196,"keywords":198,"publishedAt":43},"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",[197],{"categoryNo":173,"categoryName":174,"taxonomyType":87,"taxonomyTypeDesc":88},[192,199,200,201,202,203,204,134,205,206,37,207,34,208,209,26,210],"google","browser automation","gemini","automation","auth","code","library","management","only","query","Citation","source",{"skillNo":212,"name":213,"nameZh":6,"description":214,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":80,"licenseFileUrl":215,"sourceHtmlUrl":216,"categories":217,"keywords":224,"publishedAt":43},"01M6FDHPXE10J3XGTCH5HBHS1M","slack-gif-creator","Knowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like \"make me a GIF of X doing Y for Slack.\"","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fenterprise-communication\u002Fslack-gif-creator\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fenterprise-communication\u002Fslack-gif-creator\u002FSKILL.md",[218,221],{"categoryNo":219,"categoryName":220,"taxonomyType":87,"taxonomyTypeDesc":88},"01JBSEEDCAT000000000000005","邮件与沟通",{"categoryNo":222,"categoryName":223,"taxonomyType":87,"taxonomyTypeDesc":88},"01JBSEEDCAT000000000000016","图像与多媒体",[225,226,227,177,228,106,229,230,182,37,231,188,232,233,234,26,235,25],"slack gif creator","slack","gif","validation","constraints","Animation","me","make","Utilities","concepts","request"]