n8n-code-python

Write Python in n8n Code nodes with standard library and data access patterns.

Updated Apr 21, 2026
One-click install
npx skills add https://github.com/withwooyong/n8n-with-ai --skill n8n-code-python-withwooyong
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: n8n-code-python
Source: https://github.com/withwooyong/n8n-with-ai/tree/main/.claude/skills/n8n-code-python
Command: npx skills add https://github.com/withwooyong/n8n-with-ai --skill n8n-code-python-withwooyong

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Helps developers safely write Python in n8n Code nodes by clarifying Python's limitations and the required data-access patterns.

Core Features & Use Cases

  • Language limitations awareness: No external libraries; standard library only.
  • Data access guidance: Use _input.all(), _input.first(), _input.item, and _node references.
  • Webhook payload handling: Access payloads under body via _json['body'] and adhere to webhook data structure.
  • Return format enforcement: Always return a list of items with a json key, e.g., [{"json": {...}}].

Quick Start

Create a Python Code node and start by pulling data with _input.all() or _input.first(), then return results in the required format.

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 safely?

To safely write Python in an n8n Code node, use only the standard library without external dependencies, access data via _input references, and enforce a return format of a list containing json keys.

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

The correct return format for Python in n8n Code nodes is a list of items with a json key, such as [{"json": {...}}]. Enforcing this structure prevents common errors and ensures the workflow processes the data correctly.

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

To access webhook payload data using Python in n8n, you must retrieve it from the body by referencing _json['body']. This adheres to the required webhook data structure and ensures safe payload handling within the Code node.

Can I use external Python libraries in n8n Code nodes?

No, you cannot use external Python libraries in n8n Code nodes. The environment is restricted to the standard library only, meaning you must write production-quality code using built-in modules and avoid external package dependencies.

When should I use Python versus JavaScript in n8n Code nodes?

You should choose Python versus JavaScript in n8n Code nodes based on language limitations and data access patterns. Python is viable for standard library tasks, while JavaScript may be preferable for broader ecosystem compatibility within n8n workflows.

Why does my Python Code node in n8n throw a KeyError or IndexError?

Your Python Code node in n8n throws a KeyError or IndexError due to incorrect data access patterns. To fix this, ensure you safely pull data using _input.all() or _input.first() and validate structures before returning data in the required [{json}] format.