Getting an LLM to write n8n workflow JSON is easy. Getting JSON that imports cleanly, uses node versions that exist, and does what you asked is harder. Models invent fields, mix up node versions, and wire things to nodes that aren't there.
So I built a workflow that treats generation as the first step, not the last. You describe an automation in one sentence in chat, and the workflow builds it, checks it, tests or reviews it, and saves it to your n8n instance.
You type something like:
Alert me when GitHub has any incident. Send alerts to https://webhook.site/your-id
A bit later the chat replies with the result, the test results or checks, a link to the new workflow, and the next steps.
- Request to spec. Claude turns your sentence into a spec. A health check on a service becomes a monitor. Anything else (forms, digests, AI steps, syncs between apps) becomes a blueprint. If you give an endpoint, it's called once first, so the checks fit what it really returns.
- Spec to workflow JSON. Claude builds the workflow. For blueprints, the prompt includes the exact node types, versions, and fields from n8n's official node catalog, pinned to one package version.
- Validation. The draft is checked for node types, fields for each version, required values, wiring, expression syntax, and node references. Safe mistakes are repaired automatically. Anything else goes back to Claude with clear feedback, for up to 3 build rounds by default.
- Testing or review. Monitors run through hidden test cases against a built-in mock: errors, timeouts, DNS failures, failed alerts, and each check in the spec, plus one check of the real endpoint. Blueprints get a second Claude review against your original request, with one repair round.
- Deployment. The workflow is created through the n8n API. A monitor with an alert webhook is activated. Blueprints are saved inactive, with a Setup note listing the accounts to connect and the values to fill in.
A workflow that writes workflows needs guardrails:
- Built workflows never contain credentials.
- Code, command, file, and self-API nodes are blocked.
- Monitors can't target private or local network addresses.
- Blueprints are always saved inactive, so you review them before they run.
- If no draft passes the checks, the last one is still saved inactive, with its open problems listed in the Setup note.
You need an n8n instance (Cloud or self-hosted) with public webhook URLs, an n8n API key, an Anthropic API key or AI credits on n8n Cloud, and outbound access to cdn.jsdelivr.net for the node catalog and output schemas.
- Connect Claude to the three model nodes: Anthropic Model (Spec), Anthropic Model (Build), and Anthropic Model (Review).
- Create an n8n API key under Settings > n8n API and add it as a credential to Create Workflow and Activate Workflow. The base URL is your instance URL plus
/api/v1. - Open the Settings node. Leave
PUBLIC_URL empty to detect your instance URL automatically, or set it if you run behind a proxy. - Save and publish the workflow. The sections call the published version, so publish again after every edit.
- Open the Chat Trigger, copy the chat URL, and try the GitHub example above.
To limit access, set the Chat Trigger's authentication to Basic Auth.
MAX_ATTEMPTS and TIME_BUDGET_MINUTES set the number of build rounds and the time before the loop stops.DAILY_RUNS_PER_CHAT and DAILY_RUNS_TOTAL limit usage when the chat is public.CORE_NODES_VERSION and AI_NODES_VERSION pin the node catalog to the n8n version you run. Change both together.- You can swap the Claude model in the three model nodes, for example a smaller model for lower cost.
The template is free on n8n: Build and deploy tested workflows from chat with Claude Sonnet.
If you try it, tell me on LinkedIn what you asked it to build and whether the result held up.
This is the kind of build we do for clients too. You can see the packages on our automation packages page, or get in touch if you want one built for your own stack.