AutomationFlowsGeneral › AI Code Generation with Claude

AI Code Generation with Claude

Original n8n title: Workflowbuilder

WorkflowBuilder. Uses executeWorkflowTrigger, n8n-nodes-claude-code-cli. Event-driven trigger; 4 nodes.

Event trigger★★★★☆ complexity4 nodesExecute Workflow TriggerN8N Nodes Claude Code Cli
General Trigger: Event Nodes: 4 Complexity: ★★★★☆ Added:

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "settings": {
    "executionOrder": "v1",
    "callerPolicy": "workflowsFromSameOwner",
    "availableInMCP": false
  },
  "name": "WorkflowBuilder",
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "BuildPrompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "BuildPrompt": {
      "main": [
        [
          {
            "node": "Claude Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Claude Code": {
      "main": [
        [
          {
            "node": "FormatOutput",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "nodes": [
    {
      "parameters": {
        "inputSource": "passthrough"
      },
      "name": "Start",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "typeVersion": 1.1,
      "position": [
        0,
        0
      ],
      "id": "wfb-start"
    },
    {
      "parameters": {
        "jsCode": "// Parse input from AI Agent tool call\nconst raw = $input.first().json;\nlet task = '';\ntry {\n  const p = JSON.parse(raw.query || '{}');\n  task = p.task || p.description || p.prompt || raw.query || '';\n} catch(e) {\n  task = raw.task || raw.query || JSON.stringify(raw);\n}\n\nconst prompt = `Du bist ein n8n Workflow-Experte. Deine Aufgabe: einen vollst\u00e4ndigen, funktionierenden n8n Workflow erstellen.\n\nAUFGABE: ${task}\n\nVORGEHEN:\n1. Lies /workspace/n8n-reference/CHEATSHEET.md f\u00fcr API-Zugang, Node-Typen und Workflow-Struktur\n2. Schau dir die Beispiel-Workflows in /workspace/n8n-reference/example-*.json an\n3. Erstelle die Workflow JSON-Datei\n4. Erstelle ggf. n\u00f6tige Credentials via curl (siehe Cheatsheet)\n5. Erstelle den Workflow via curl POST an die n8n API\n6. Aktiviere den Workflow via curl POST\n7. Antworte mit: Workflow-Name, ID, und was er tut\n\nWICHTIG:\n- Nutze curl f\u00fcr alle API-Calls (NICHT MCP)\n- n8n expressions M\u00dcSSEN mit = prefix starten: \"={{ $json.field }}\"\n- Alle Infos stehen im CHEATSHEET.md\n- Baue KOMPLETTE, FUNKTIONALE Workflows - keine Platzhalter!`;\n\nreturn [{json: {prompt, task}}];"
      },
      "name": "BuildPrompt",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        224,
        0
      ],
      "id": "wfb-prompt"
    },
    {
      "parameters": {
        "connectionMode": "ssh",
        "prompt": "={{ $json.prompt }}",
        "permissionMode": "bypassPermissions",
        "toolPermissions": {},
        "model": "sonnet",
        "options": {
          "maxTurns": 25,
          "timeout": 120000,
          "systemPrompt": "Du bist ein n8n Workflow-Experte. REGELN:\n1. Lies ZUERST /workspace/n8n-reference/CHEATSHEET.md\n2. Dann SOFORT handeln \u2014 curl commands ausf\u00fchren, nicht lange planen\n3. Nutze NUR curl und Bash f\u00fcr die n8n API (kein MCP)\n4. Schreib die workflow JSON in eine Datei, dann curl POST\n5. Erstelle n\u00f6tige Credentials ZUERST, dann den Workflow\n6. Aktiviere den Workflow am Ende\n7. Antworte knapp: Was gebaut wurde + Workflow-ID\n\nWICHTIG: Nicht overthinking! Sofort mit dem ersten Bash-Command starten.",
          "additionalArgs": "--model sonnet"
        }
      },
      "name": "Claude Code",
      "type": "n8n-nodes-claude-code-cli.claudeCode",
      "typeVersion": 1,
      "position": [
        448,
        0
      ],
      "id": "wfb-claude",
      "credentials": {
        "claudeCodeSshApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "// Extract Claude Code's response - try all possible fields\nconst result = $input.first().json;\n\n// The node outputs: success, sessionId, output, rawOutput, exitCode, duration, cost, error\n// 'output' should have the text result, 'rawOutput' has the full JSON\nconst output = result.output \n  || result.result \n  || result.text \n  || (result.rawOutput && result.rawOutput.result)\n  || JSON.stringify(result);\n\nreturn [{json: {\n  response: output || 'Claude Code completed but returned no text output. Check n8n execution log for details.',\n  cost: result.cost || (result.rawOutput && result.rawOutput.total_cost_usd) || null,\n  session_id: result.sessionId || (result.rawOutput && result.rawOutput.session_id) || null,\n  success: result.success,\n  duration_s: result.duration ? Math.round(result.duration / 1000) : null,\n  // Debug: include raw keys to diagnose empty outputs\n  _debug_keys: Object.keys(result).join(','),\n  _debug_output_length: (output || '').length\n}}];"
      },
      "name": "FormatOutput",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        672,
        0
      ],
      "id": "wfb-output"
    }
  ]
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

WorkflowBuilder. Uses executeWorkflowTrigger, n8n-nodes-claude-code-cli. Event-driven trigger; 4 nodes.

Source: https://github.com/freddy-schuetz/n8n-claw/blob/9f9b48250bb31d7cbc44ea14130e322ea0fc22b9/workflows/workflow-builder.json — original creator credit. Request a take-down →

More General workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

General

Agendamiento. Uses n8n-nodes-evolution-api, redis, dataTable, executeWorkflowTrigger. Event-driven trigger; 60 nodes.

N8N Nodes Evolution Api, Redis, Data Table +2
General

Prevent concurrent workflow runs using Redis. Uses executeWorkflowTrigger, manualTrigger, stickyNote, executeWorkflow. Event-driven trigger; 43 nodes.

Execute Workflow Trigger, Redis, Stop And Error
General

This workflow sets a small "lock" value in Redis so that only one copy of a long job can run at the same time. If another trigger fires while the job is still busy, the workflow sees the lock, stops e

Execute Workflow Trigger, Redis, Stop And Error
General

Reputation Engine — Site Refresh. Uses httpRequest, executeWorkflowTrigger. Event-driven trigger; 35 nodes.

HTTP Request, Execute Workflow Trigger
General

Using n8n a lot?

Execute Workflow Trigger, XML, Move Binary Data +1