---
title: "AI Document Generation + E-Signature in One Flow | TurboDocx"
description: "Generate the document and send it for signature in a single AI-built flow. Combine HTML-to-DOCX generation with TurboSign e-signatures using one Skill."
url: "https://www.turbodocx.com/blog/vibecode-docs-and-signatures"
---

# Vibecode AI Document Generation and E-Signatures

> Most e-signature tools start with a file you already have. The more useful flow generates the document and sends it for signature in one pass. You can vibecode both halves. Combine HTML-to-DOCX generation with TurboSign e-signatures using one Quickstart Skill.

By Alex Martinez (Developer Relations & Automation Lead, TurboDocx). Published June 5, 2026. 6 min read. Category: AI for Developers.

A signature is the last step of a document, not the whole story. The real workflow usually starts earlier: take some data, turn it into a contract or invoice, then collect a signature on it. Most e-signature products only handle the second half, so you end up gluing a document generator to a signing API yourself.

TurboDocx covers both halves, and its [Quickstart Skill](https://www.turbodocx.com/quickstart.md) ships two pieces that an AI agent can wire together: `@turbodocx/html-to-docx` for turning HTML into Word documents, and `turbodocx-sdk` for TurboSign e-signatures. One install, one flow.

## The generate-then-sign pipeline

1. **Generate the document.** Render your contract, invoice, or SOW from HTML into a real .docx or PDF with @turbodocx/html-to-docx.
2. **Send it for signature.** Hand the generated file straight to TurboSign with the recipients and fields you want.
3. **React on completion.** A webhook fires when it is signed. Store the final PDF and audit trail wherever you keep records.

## One install, both skills

The same command installs both pieces. When the CLI asks which skills to add, pick both:

```bash
npx skills add TurboDocx/quickstart
```

Then describe the whole flow to your agent: "Generate a contract from this HTML template and send it for signature with TurboSign." The agent uses `@turbodocx/html-to-docx` to produce the file and `turbodocx-sdk` to send it, passing the generated document straight through. Step-by-step signing setup is in the [Claude Code guide](https://www.turbodocx.com/guides/add-esignature-with-claude-code.md) and [Cursor guide](https://www.turbodocx.com/guides/add-esignature-with-cursor.md), and the open-source generator is covered on the [open-source tools page](https://www.turbodocx.com/products/open-source.md).

## The end-to-end flow in code

Here is the whole pipeline in two short steps. First, generate the document. You pass an HTML string to `@turbodocx/html-to-docx` and get back a real Word file. Notice the `{signature1}` placeholder in the markup: that is the anchor TurboSign will look for when it places the signature field.

`generate-doc.ts`

```typescript
import HtmlToDocx from '@turbodocx/html-to-docx';

// Build the contract from data. The {signature1} placeholder
// is where TurboSign will drop the signature field later.
const html = `<!DOCTYPE html>
  <html>
    <body>
      <h1>Partnership Agreement</h1>
      <p>This agreement is between Acme Inc. and the partner.</p>
      <p>Signed: {signature1}</p>
    </body>
  </html>`;

// In Node this returns an ArrayBuffer (a Blob in the browser).
const docx = await HtmlToDocx(html);
const fileBuffer = Buffer.from(docx);
```

Now send that same buffer for signature with `turbodocx-sdk`. You never write the file to disk or upload it anywhere: the document you just generated becomes the `file` argument to `sendSignature`, and the field `anchor` points at the exact `{signature1}` placeholder you wrote into the HTML.

`send-signature.ts`

```typescript
import { TurboSign } from '@turbodocx/sdk';

TurboSign.configure({
  apiKey: process.env.TURBODOCX_API_KEY,
  orgId: process.env.TURBODOCX_ORG_ID,
  senderEmail: process.env.TURBODOCX_SENDER_EMAIL,
  senderName: process.env.TURBODOCX_SENDER_NAME,
});

// Hand the file we just generated straight to TurboSign.
const result = await TurboSign.sendSignature({
  file: fileBuffer,
  documentName: 'Partnership Agreement',
  recipients: [
    { name: 'John Doe', email: 'john@example.com', signingOrder: 1 },
  ],
  fields: [
    {
      type: 'signature',
      recipientEmail: 'john@example.com',
      template: { anchor: '{signature1}', placement: 'replace' },
    },
  ],
});

console.log('Sent for signature:', result.documentId);
```

That is the entire flow: data in, signed document on the way out. The recipient gets an email with a signing link, and a webhook fires when it is complete. For the signing half on its own (API key setup, recipients, fields, and webhooks), the [JavaScript signing guide](https://www.turbodocx.com/guides/sign-documents-with-javascript.md) walks through every option, and the [Quickstart Skill](https://www.turbodocx.com/quickstart.md) lets your agent write this code for you.

## Why generation and signing belong together

When generation and signing come from the same place, the handoff is a function call, not a file upload and a second integration. There is no intermediate storage to manage, no format mismatch between what you generated and what the signing tool accepts, and one set of credentials instead of two. For an AI agent, that also means a single skill can reason about the whole flow rather than stitching two unrelated APIs.

That is the part most signing tools cannot do, and the reason the generate-then-sign pattern is worth building on. To see the signing half end to end, read [Vibecode an E-Signature Flow](https://www.turbodocx.com/blog/vibecode-an-esignature-flow.md).

## Related Resources

- [Vibecode an E-Signature Flow](https://www.turbodocx.com/blog/vibecode-an-esignature-flow.md): The signing half, from blank project to first signature.
- [Open-Source Tools](https://www.turbodocx.com/products/open-source.md): @turbodocx/html-to-docx, the generation half of the flow.

## Generate and sign in one flow

Install the Quickstart Skill, pick both skills, and let your agent build the pipeline. Your first 5 signatures each month are free.

- [Explore the open-source tools](https://www.turbodocx.com/products/open-source.md)

[Install the Quickstart Skill](https://www.turbodocx.com/quickstart.md)
