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.
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
Source & Thanks
Created by Etienne Lescot. Licensed under MIT.
n8n-as-code — ⭐ 630+
Thank you to Etienne Lescot for building the definitive bridge between AI agents and n8n automation.
Discussion
Related Assets
Claude-Flow — Multi-Agent Orchestration for Claude Code
Layers swarm and hive-mind multi-agent orchestration on top of Claude Code with 64 specialized agents, SQLite memory, and parallel execution.
ccusage — Real-Time Token Cost Tracker for Claude Code
CLI that reads ~/.claude logs and breaks down Claude Code token spend by day, session, and project — pluggable into your statusline.
SuperClaude — Workflow Framework for Claude Code
Adds 16+ slash commands, 9 cognitive personas, and a smart flag system to Claude Code in one pipx install.