n8n-as-code — AI Agent Superpowers for n8n
Give your AI agent n8n superpowers with 537 node schemas, 7,700+ templates, and TypeScript workflow definitions. Works with Claude Code, Cursor, VS Code, and OpenClaw. MIT license.
Review-first install path
This asset needs a review step. The copied prompt tells the agent to dry-run, show the writes, then proceed only after confirmation.
npx -y tokrepo@latest install 9de58e04-c1b8-401d-ab38-57553197bb55 --target codexDry-run first, confirm the writes, then run this command.
What it is
n8n-as-code is a plugin that gives AI coding agents access to n8n's entire workflow automation ecosystem. It provides 537 node schemas (one for each n8n integration), 7,700+ workflow templates, and TypeScript definitions for building n8n workflows programmatically. The plugin works with Claude Code, Cursor, VS Code, and other AI coding tools.
n8n-as-code is designed for developers who use n8n for automation and want their AI agent to build, modify, and debug n8n workflows without switching to the n8n GUI.
How it saves time or tokens
Building n8n workflows in the GUI requires clicking through nodes, configuring fields, and connecting triggers manually. n8n-as-code lets your AI agent generate complete workflow definitions in TypeScript or JSON from natural language descriptions. The agent has access to all 537 node schemas, so it knows the exact fields, options, and connections each node supports. A workflow that takes 30 minutes to build in the GUI can be generated in seconds.
How to use
- Install for Claude Code:
/plugin marketplace add EtienneLescot/n8n-as-code
/plugin install n8n-as-code@n8nac-marketplace
- For VS Code or Cursor, install 'n8n-as-code' from the VS Code Marketplace.
- Ask your AI agent to build a workflow:
Create an n8n workflow that:
1. Triggers on a webhook POST to /new-lead
2. Sends a Slack notification to #sales
3. Creates a HubSpot contact
4. Sends a welcome email via SendGrid
Example
A generated n8n workflow definition:
import { IWorkflowDefinition } from 'n8n-as-code';
const workflow: IWorkflowDefinition = {
name: 'New Lead Pipeline',
nodes: [
{
type: 'n8n-nodes-base.webhook',
parameters: { path: 'new-lead', httpMethod: 'POST' },
position: [250, 300],
},
{
type: 'n8n-nodes-base.slack',
parameters: {
channel: '#sales',
text: 'New lead: {{$json.name}} ({{$json.email}})',
},
position: [450, 200],
},
{
type: 'n8n-nodes-base.hubspot',
parameters: {
operation: 'create',
email: '={{$json.email}}',
firstName: '={{$json.name}}',
},
position: [450, 400],
},
],
connections: { /* ... */ },
};
Related on TokRepo
- Automation tools — Browse workflow automation tools
- No-code tools — Explore low-code and no-code platforms
Common pitfalls
- Not having n8n credentials configured for the nodes you use. The generated workflow definition is correct, but it needs credentials set up in your n8n instance for each service (Slack, HubSpot, etc.).
- Generating workflows without testing them. Always import the generated workflow into n8n and test with sample data before connecting to production services.
- Using outdated node schemas. Update the n8n-as-code plugin regularly to get the latest node definitions that match your n8n version.
Frequently Asked Questions
For generating workflow definitions, no. The plugin provides schemas locally. For deploying and running workflows, you need an n8n instance. Import the generated workflow via n8n's API or GUI.
n8n-as-code includes schemas for all 537 n8n node types, covering integrations with services like Slack, GitHub, Google Sheets, HubSpot, Stripe, and hundreds more.
Yes. Export your existing workflow from n8n as JSON, have your AI agent read and modify it, then import the updated workflow back into n8n.
Yes. The generated workflow definitions are compatible with any n8n instance, whether self-hosted or using n8n Cloud. The plugin generates standard n8n workflow JSON.
n8n-as-code works with Claude Code (via plugin marketplace), Cursor and VS Code (via VS Code Marketplace), and any AI coding tool that can read TypeScript type definitions.
Citations (3)
- n8n-as-code GitHub— n8n-as-code provides 537 node schemas for AI agents
- n8n Documentation— n8n workflow automation platform
- n8n Integrations— n8n integrations and node types
Related on TokRepo
Discussion
Related Assets
n8n MCP Server — Build Automations with AI, 1,396 Nodes
MCP server giving AI agents access to 1,396 n8n nodes and 2,709 workflow templates. Build and manage n8n automations through natural language.
Crawl4AI MCP — Web Crawling Server for AI Agents
MCP server that gives AI agents web crawling superpowers. Crawl4AI MCP enables Claude Code and Cursor to scrape, extract, and process web content through tool calls.
Self-Hosted AI Starter Kit — Local AI with n8n
Docker Compose template by n8n that bootstraps a complete local AI environment with n8n workflow automation, Ollama LLMs, Qdrant vector database, and PostgreSQL. 14,500+ stars.
n8n — AI-Native Workflow Automation
Open-source workflow automation with 400+ integrations and built-in AI capabilities. Build AI agents, RAG pipelines, and automation workflows with a visual editor.