| name | scaffold-n8n-doc-pipeline |
| description | Generate an n8n workflow JSON that takes a webhook payload, renders a document via the user's chosen rendering engine, and stores or returns the resulting PDF. Use when the user wants to "set up automated invoicing in n8n", "build an n8n doc-gen workflow", or otherwise wire programmatic document generation into an n8n pipeline. |
scaffold-n8n-doc-pipeline
Produce a ready-to-import n8n workflow JSON that wires a webhook → render call → storage step for the user's chosen engine.
When to use
Auto-trigger when the user wants n8n to handle document generation end-to-end. If they haven't picked an engine yet, route to recommend-rendering-service first.
Inputs
- Engine — read from
preferences.json (see path below). If unset, prompt and consider running onboarding.
- Document type — invoice, statement, certificate, etc. Drives the example payload shape.
- Trigger — webhook (default), schedule, or queue.
- Storage destination — return inline / S3 / Google Drive / local disk / email attachment / multiple.
- Authentication — credentials reference name(s) for the engine and storage; never hardcode keys.
Path resolution
DATA_ROOT="${CLAUDE_USER_DATA:-${XDG_DATA_HOME:-$HOME/.local/share}/claude-plugins}/programmatic-doc-generation"
ENGINE=$(jq -r '.default_engine // empty' "$DATA_ROOT/preferences.json" 2>/dev/null)
Pull engine-specific request details from $DATA_ROOT/engines/$ENGINE/reference.md and any saved n8n-snippet.json under that directory.
Workflow shape
The generated workflow has these nodes (adjust per engine and storage choice):
- Trigger — Webhook (POST, with example payload).
- Validate — Function node that checks required fields against the schema and short-circuits with a 400 on missing data.
- Render — HTTP Request to the chosen engine, or for self-hosted Typst, an Execute Command node that invokes
typst compile.
- Persist — write to the user's chosen storage backend.
- Respond — webhook response with the storage URL or the PDF inline.
- Error branch — Error Trigger or per-node
onError continuing into a notification step (email / Slack), so failed renders don't fail silently.
Output
<output-dir>/
├── workflow.json # importable n8n workflow
├── example-payload.json # what to POST to the webhook
├── credentials-checklist.md # which credentials to create in n8n before importing
└── README.md # import + activation steps
<output-dir> is user-chosen. Default suggestion: ~/Documents/n8n-workflows/<doc-type>/.
Engine notes
- Typst CLI: render via Execute Command in a self-hosted n8n instance, or via an HTTP call to a containerised Typst service. Cloud n8n instances can't shell out to Typst directly — flag this clearly if the user's on n8n cloud.
- Carbone / PDFMonkey / APITemplate / DocRaptor / Docmosis / Adobe: HTTP Request node with the engine-specific auth header + body shape from the reference docs.
- PDFMonkey: there's a community n8n node — prefer it over raw HTTP if installed.
After scaffolding
- Tell the user the credentials they need to create in n8n before importing.
- Tell them how to test: import → activate → POST the example payload → verify the rendered PDF.
- Don't try to deploy the workflow for them; that requires their n8n credentials.