n8n-code-python

Writes Python standard library code for n8n Code nodes to transform and validate data.

3|2|Updated Jan 23, 2026
One-click install
npx skills add https://github.com/AeyeOps/aeo-skill-marketplace --skill n8n-code-python-aeyeops
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: n8n-code-python
Source: https://github.com/AeyeOps/aeo-skill-marketplace/tree/main/aeo-n8n/skills/n8n-code-python
Command: npx skills add https://github.com/AeyeOps/aeo-skill-marketplace --skill n8n-code-python-aeyeops

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

n8n code-python enables writing Python logic inside the Code node, while respecting the no-external-libraries limit and leveraging the standard library to perform data transformations, webhook payload handling, and batch processing.

Core Features & Use Cases

  • Safe data access patterns with _input.all(), _input.first(), and _input.item to build robust workflows.
  • Standard library focused tasks: JSON handling, datetime calculations, regex parsing, and basic data transformations without external dependencies.
  • Real-world use cases include aggregating values from multiple items, validating and transforming webhook payloads, and per-item enrichment in a Run Once for Each Item mode.

Quick Start

  • Create a Python Code node, import only the standard library, and access incoming data via _input.all() or _input.first().
  • Return results using the required format: a list of dictionaries each containing a "json" key, e.g., [{"json": {"processed": true}}].
  • Example: compute total from all items and return {"total": total, "count": len(all_items)}.

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 logic inside n8n Code nodes to transform data?▼

To write Python logic inside n8n Code nodes, access incoming data via _input.all() or _input.first(), use Python's standard library for transformations, and return a list of dictionaries each containing a "json" key.

Can I use external Python packages in n8n Code nodes for data transformation?▼

No, you cannot use external Python packages in n8n Code nodes. You must rely exclusively on Python's built-in standard library modules to perform tasks like JSON handling, datetime calculations, and regex parsing.

What is the required return format for Python code in n8n workflows?▼

The required return format for Python code in n8n workflows is a list of dictionaries, where each dictionary contains a "json" key, such as [{"json": {"processed": true}}], ensuring n8n correctly parses the output items.

How do I handle webhook payloads in an n8n Python Code node?▼

To handle webhook payloads in an n8n Python Code node, access the incoming payload data using safe access patterns like _input.first(), validate the fields using standard library tools, and return the transformed data in the required json dictionary format.

Does n8n support per-item processing with Python in Run Once for Each Item mode?▼

Yes, n8n supports per-item processing with Python by using _input.item to access the current item data, allowing you to perform per-item enrichment safely within Run Once for Each Item mode using standard library functions.

How do I aggregate values from multiple items in an n8n Python Code node?▼

To aggregate values from multiple items in an n8n Python Code node, retrieve all items using _input.all(), iterate through the list to compute totals or counts using standard library logic, and return the aggregated result inside a json dictionary.