n8n-code-python

Write standard-library-only Python code for n8n Code nodes.

1|Updated Apr 12, 2026
One-click install
npx skills add https://github.com/rafavital/agile-trends-n8n --skill n8n-code-python-rafavital
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: n8n-code-python
Source: https://github.com/rafavital/agile-trends-n8n/tree/main/.gemini/skills/n8n-code-python
Command: npx skills add https://github.com/rafavital/agile-trends-n8n --skill n8n-code-python-rafavital

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Write Python code in n8n Code nodes with awareness of Python limitations, safe data access patterns, and standard library usage.

Core Features & Use Cases

  • Understand Python usage in n8n Code nodes, including _input/_json/_node access, mode differences (All Items vs Each Item)
  • Learn which standard library modules are available and how to avoid external libraries
  • Troubleshoot common errors with practical patterns and examples
  • Real-world scenario: transform and validate a batch of items from a webhook

Quick Start

Create a Python Code node and begin by using _input.all() or _input.first() according to the DATA_ACCESS.md guidance to start transforming data.

Frequently Asked Questions about n8n-code-python

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

FAQPage Schema
How do I access webhook data in an n8n Python Code node?

Access webhook data in an n8n Python Code node by using _input.all() or _input.first() to retrieve items, then safely extract fields from _json using dictionary .get() methods to prevent missing key errors.

Can I use external Python libraries in n8n Code nodes?

External Python libraries are not available in n8n Code nodes. You must write Python scripts using only the standard library, avoiding third-party imports to ensure workflows execute without module dependency errors.

Why does my Python code in n8n fail to return data correctly?

Python code in n8n fails when it does not return a list of items in the correct n8n format. Ensure your script outputs a list of dictionaries matching the expected JSON structure for successful workflow execution.

What is the difference between All Items and Each Item modes in n8n Python Code nodes?

All Items mode processes the entire batch of input items at once in your Python code, while Each Item mode executes the script individually for every item, affecting how _input and _json data are accessed.

How do I prevent KeyError exceptions when processing n8n items with Python?

Prevent KeyError exceptions in n8n Python Code nodes by using safe dictionary access with the .get() method instead of direct key indexing, ensuring missing fields return None rather than crashing the workflow.

How do I write Python scripts in n8n to transform webhook payloads?

Write Python scripts in n8n to transform webhook payloads by accessing the _input data, applying standard library functions for validation and transformation, and returning a properly formatted list of items.