The Document Generation Backend for AI Coding Agents
Connect Google Antigravity, Claude Code, Cursor, and custom LLM pipelines directly to high-fidelity Word templates and high-throughput batch generation APIs.
TRYDOKU Document Generation Skill
A drop-in agent skill for Google Antigravity (.agents/skills/), Claude Code, and Cursor. Teaches agents exact API contracts and placeholder rules.
---
name: "trydoku-generation"
description: "Batch document generation using TRYDOKU REST API and Word templates (.docx)."
---
# TRYDOKU Document Generation Skill
Use this skill to automate batch document generation (invoices, contracts, agreements, reports) from Microsoft Word (`.docx`) templates and structured datasets (Excel, CSV, JSON).
## API Specification & Contracts
- **Base URL:** `https://www.trydoku.com/api/v1`
- **Authentication:** Bearer token via `TRYDOKU_API_TOKEN` environment variable.
- **Header:** `Authorization: Bearer <TRYDOKU_API_TOKEN>`
- **Content-Type:** `application/json`
- **Accept:** `application/json`
### 1. Submit Generation Batch
- **Method:** `POST /api/v1/generate`
- **Payload Schema:**
```json
{
"template_base64": "<base64_encoded_docx_file_string>",
"data": [
{
"client_name": "Acme Corp",
"invoice_id": "INV-001",
"amount": "$1,200.00",
"is_discounted": true,
"items": [
{ "description": "Consulting Services", "rate": "$800.00" },
{ "description": "System Integration", "rate": "$400.00" }
]
}
]
}
```
- **Response Schema (Pending):**
```json
{
"data": {
"id": "batch_abc123",
"status": "pending",
"setup_status": "ready",
"total_items": 1,
"processed_items": 0,
"failed_items": 0,
"links": {
"self": "https://www.trydoku.com/api/v1/batches/batch_abc123",
"zip": null
}
}
}
```
### 2. Poll Batch Status
- **Method:** `GET /api/v1/batches/{id}`
- **Response Schema (Completed):**
```json
{
"data": {
"id": "batch_abc123",
"status": "completed",
"setup_status": "ready",
"total_items": 1,
"processed_items": 1,
"failed_items": 0,
"links": {
"self": "https://www.trydoku.com/api/v1/batches/batch_abc123",
"zip": "https://www.trydoku.com/api/v1/batches/batch_abc123/zip"
}
}
}
```
## Template Placeholder Syntax Rules
1. **Scalars:** `{{ variable_name }}` (Must use letters, numbers, and underscores).
2. **Repeating Table Rows / Loops:**
- In Word table cell 1: `{> items }}`
- Inside row columns: `{{ description }}`, `{{ price }}`
- In Word table last cell: `{< items }}`
3. **Conditional Sections:** `{% if is_discounted %} ... {% else %} ... {% endif %}`
## Agent Execution Best Practices
1. **Verify Variables First:** Before submitting bulk batches, inspect template placeholders or parse variables using TRYDOKU's free client-side tool at `https://www.trydoku.com/tools/word-template-variable-parser`.
2. **Handle Rate Limiting:** Apply exponential backoff (2s → 4s → 8s) when receiving HTTP 429 status codes.
3. **Credit Management:** Generation consumes 1 credit per non-empty row in the `data` array upon batch submission. Polling batch status (`GET /batches/{id}`) is completely free.
4. **Data Privacy & Retention:** Payload rows are encrypted at rest during queue processing, automatically cleared (`input_data = null`) immediately upon successful generation, and subject to an automated 72-hour pruning window for incomplete or failed batches. Encrypt tokens in environment variables and never commit secrets to repositories.
.agents/skills/trydoku/SKILL.md
CLAUDE.md or Project Knowledge
.cursorrules as reference context
AI Developer Series
Using TRYDOKU with Google Antigravity: Automate Document Generation with AI
Connect Google's agentic IDE with TRYDOKU's template-based document engine. Learn how to configure custom agent skills and execute automated batch workflows.
Using TRYDOKU with Claude Code: Build an AI-Driven Document Generator
Integrate Anthropic's Claude Code CLI and Claude.ai Projects with TRYDOKU using OpenAPI schemas to assemble contracts and invoices automatically.
Programmatically Generate Contracts & NDAs with the TRYDOKU API
Learn how to scale legal agreement generation and NDA creation with zero data retention, webhook notifications, and automated Word templates.
Built for LLMs, Crawlers & Agentic IDEs
TRYDOKU provides standardized machine-readable context files adhering to the llms.txt specification, enabling AI systems to discover our API capabilities without hallucinations.
AI Document Generation: Best Practices
Follow these 5 architectural principles to build reliable, cost-effective agentic document rendering pipelines.
Anchor Agents with the OpenAPI Schema
Always feed /llms-full.txt or the OpenAPI JSON schema directly into your agent's system prompt or workspace context. This anchors the model to exact endpoint URLs (POST /api/v1/generate) and payload properties (template_base64, data), preventing URL and parameter hallucinations.
Strict Template Syntax Rules
Use standardized placeholder syntax: {{ var }} for single values, {> loop }} ... {< loop }} for table row repeats, and {% if var %} ... {% endif %} for conditionals. Avoid inventing unsupported custom delimiters.
Pre-Validate with Client-Side Tools
Before executing automated batch runs, inspect templates using the free Word Template Variable Parser. It extracts all placeholders client-side in browser RAM and exports a matching Excel template (.xlsx) with zero server uploads.
Batching Economics & Idempotency
TRYDOKU credits are billed per accepted row in your data array at batch creation time. Submitting 100 rows in a single batch request is significantly faster and more reliable than dispatching 100 individual single-row requests. Polling batch status is always free.
Resilient Rate Limiting & Backoff
Ensure your agentic scripts handle HTTP 429 rate limit responses gracefully. Implement exponential backoff (e.g. initial delay of 2 seconds, multiplied by 1.5 up to 8 seconds) rather than aggressively spamming generation endpoints.