n8n-code-python

Write standard-library Python code for n8n Code nodes with required output format.

1|Updated Feb 3, 2026
One-click install
npx skills add https://github.com/JulioBorges/ag-n8n-skills --skill n8n-code-python-julioborges
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: n8n-code-python
Source: https://github.com/JulioBorges/ag-n8n-skills/tree/main/.agent/.skills/n8n-automation/n8n-code-python
Command: npx skills add https://github.com/JulioBorges/ag-n8n-skills --skill n8n-code-python-julioborges

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you write Python code in n8n Code nodes while respecting the platform's limitations, such as no external libraries and the need to format results correctly. It clarifies how to access input data, work with webhook payloads under the body property, and produce the required output shape.

Core Features & Use Cases

  • Python Modes: Python (Beta) and Python Native with guidance on when to use each.
  • Data Access: Learn to read data with _input.all(), _input.first(), and _input.item, and to safely access webhook payload under _json["body"].
  • Safety & Compliance: No external libraries; use standard library (json, datetime, re, base64, hashlib, urllib, math, random, statistics) and return the required format [{"json": {...}}].
  • Use Cases: data transformation, validation, parsing, and simple automation within n8n workflows.

Quick Start

In a Code node, read all inputs with _input.all(), perform your transformation, and return a properly formatted array like [{"json": { ... }}]. For webhooks, access payload via _json.get("body", {}) and always use .get() for safe access.

Frequently Asked Questions about n8n-code-python

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write Python code in n8n Code nodes without external dependencies?

To write Python code in n8n Code nodes without external dependencies, use only the Python standard library modules like json, datetime, re, and math, then return your results formatted as an array of objects with a json field.

How do I access webhook payload data in n8n Python Code nodes?

Access webhook payload data in n8n Python Code nodes by referencing the _json object and safely extracting the body property using .get(), such as _json.get("body", {}), to prevent missing key errors.

Can I use external Python libraries in n8n workflows?

You cannot use external Python libraries in n8n workflows, as the environment enforces a strict no external libraries rule and limits you to the standard library for safe data transformation and validation.

What is the correct output format for Python Code nodes in n8n?

The correct output format for Python Code nodes in n8n is a list of items formatted as an array of objects, specifically [{"json": { ... }}], ensuring your transformed data integrates properly with subsequent workflow nodes.

How do I read input data in n8n Python Code nodes?

Read input data in n8n Python Code nodes using built-in methods like _input.all() for all items, _input.first() for the initial item, or _input.item for the current item during batch operations.

What's the difference between Python (Beta) and Python Native modes in n8n?

Python (Beta) and Python Native modes in n8n offer different execution environments for your code, with the Skill providing specific guidance on when to use each mode for data transformation and webhook payload processing.