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.
What it looks like
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.
How it works
1. 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.
2. 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.
3. 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.
4. 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.
5. 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.
Safety by design
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.
Setup
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_URLempty 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.
Things you can tune
-
MAX_ATTEMPTSandTIME_BUDGET_MINUTESset the number of build rounds and the time before the loop stops. -
DAILY_RUNS_PER_CHATandDAILY_RUNS_TOTALlimit usage when the chat is public. -
CORE_NODES_VERSIONandAI_NODES_VERSIONpin 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.
Try it
The template is free on n8n: https://n8n.io/workflows/20211-build-and-deploy-tested-workflows-from-chat-with-claude-sonnet/
If you try it, tell me in the comments what you asked it to build and whether the result held up.
About the author
I'm Mychel Garzon, founder of AutomiQ, an AI automation consultancy based in Helsinki. We build n8n workflows and AI agents for businesses. Our client work covers M365 governance, LLM orchestration, and legacy IBM i banking integrations.
- n8n Verified Creator with 40+ published templates
- Helsinki n8n Community Ambassador
- Winner of the Junction 2025 n8n Tech Challenge
More from me
Need a custom n8n workflow or AI automation? Write to info@automiq.fi
Top comments (0)