n8n-code-python

Write Python in n8n Code nodes using standard library and safe data access.

Updated Feb 2, 2026
One-click install
npx skills add https://github.com/Test-perelman/Mailtrix --skill n8n-code-python-test-perelman
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: n8n-code-python
Source: https://github.com/Test-perelman/Mailtrix/tree/main/n8n-skills/skills/n8n-code-python
Command: npx skills add https://github.com/Test-perelman/Mailtrix --skill n8n-code-python-test-perelman

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill clarifies how to write Python in n8n Code nodes, focusing on safe data access, standard library usage, and correct return formatting.

Core Features & Use Cases

  • Safe data access patterns: _input.all(), _input.first(), and webhook body handling.
  • Standard library usage: Describes available modules and typical transformations without external libraries.
  • Return format guidance: Always return a list of items with the "json" key for downstream nodes.

Quick Start

Follow these steps to start quickly:

  • Create a Python Code node and use _input.all() to access items.
  • Return results as a list of dictionaries with "json" keys.
  • Do not import any external libraries; rely on Python's standard library.

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 in an n8n Code node to transform data?

To write Python in an n8n Code node, use _input.all() to safely access incoming data and return results as a list of dictionaries wrapped in a "json" key for downstream nodes to process.

Can I use external Python libraries in n8n Code nodes?

No, you cannot use external Python libraries in n8n Code nodes. You must rely exclusively on Python's built-in standard library for data transformations, validations, and aggregations.

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

The correct return format for Python Code nodes in n8n is a list of items where each item is a dictionary containing a "json" key, ensuring downstream nodes receive properly structured data.

How do I access webhook body data using Python in n8n?

To access webhook body data using Python in n8n, apply safe data access patterns like _input.first() or _input.all() within your Code node to retrieve and parse the incoming payload.

What Python standard library modules are available in n8n Code nodes?

n8n Code nodes support Python's standard library modules for typical data transformations. You can use built-in modules for tasks like data validation and aggregation without importing external packages.

Why does my Python Code node in n8n fail to pass data downstream?

Python Code nodes in n8n fail to pass data downstream when the output is not formatted as a list of dictionaries with a "json" key, or when attempting to import unsupported external libraries.