n8n-code-python

Write standard-library Python code for n8n Code nodes with underscore-prefixed data access.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/mtdmarg/presalesViola --skill n8n-code-python-mtdmarg
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: n8n-code-python
Source: https://github.com/mtdmarg/presalesViola/tree/main/.agents/skills/n8n-code-python
Command: npx skills add https://github.com/mtdmarg/presalesViola --skill n8n-code-python-mtdmarg

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Python in n8n Code nodes is constrained to the standard library with no external packages, and data access relies on _input/_json/_node patterns, which can be error-prone without guidance. This skill clarifies what is possible, what isn't, and how to structure code for reliable data transformations inside n8n.

Core Features & Use Cases

  • Safe data access patterns using _input.all(), _input.first(), and _input.item
  • Webhook data handling guidance for data under ["body"]
  • Standard library-only workflows with examples for json, datetime, re, base64, hashlib
  • Clear return format guidance: always return a list of items with "json" keys
  • Error prevention and best practices references to reduce common mistakes

Quick Start

Add a Python Code node, read all items with _input.all(), transform them, and return a list of dictionaries under the json key.

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 for data transformation?

Python in n8n Code nodes is limited to the standard library with no external packages, and data is accessed using underscore-prefixed patterns like _input.all(), _input.first(), or _input.item for transformations.

How do I handle webhook body data in an n8n Python Code node?

Webhook body data in an n8n Python Code node is accessed under the body key, requiring safe dictionary access methods to parse incoming payloads and return them as a list of json objects.

Can I use external Python libraries in n8n Code nodes?

External Python libraries cannot be used in n8n Code nodes; execution is constrained to Python's standard library, including modules like json, datetime, re, base64, and hashlib for workflows.

What is the correct return format for Python code in n8n?

The correct return format for Python code in n8n is a list of items where each item is a dictionary containing a json key, ensuring downstream nodes can properly parse the transformed data.

Why does my Python code node in n8n throw an error when accessing input data?

Python code node errors in n8n typically occur when using incorrect data access patterns; use _input.all() for batch items, _input.item for single entries, and apply safe dictionary access to prevent exceptions.

What's the best way to process batch operations with Python in n8n?

Batch operations with Python in n8n are best handled by reading all items with _input.all(), iterating through them with standard library functions, and returning the transformed results as a list of json objects.