n8n-code-python

Write standard-library Python code for n8n Code nodes returning json items.

1|Updated Jan 21, 2026
One-click install
npx skills add https://github.com/nirukk52/ContentEngine-AI-studio --skill n8n-code-python-nirukk52
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: n8n-code-python
Source: https://github.com/nirukk52/ContentEngine-AI-studio/tree/main/.claude-skills/n8n-code-python
Command: npx skills add https://github.com/nirukk52/ContentEngine-AI-studio --skill n8n-code-python-nirukk52

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers understand how to safely write Python in n8n Code nodes, given the environment limitations (no external libraries) and the requirement to return data in the strict n8n format.

Core Features & Use Cases

  • Safe data access: use _input.all(), _input.first(), and _input.item patterns, and safe dictionary access with .get().
  • Webhook handling and batch transformations using Python's standard library only.
  • Clear guidance on when to use Python vs JavaScript in n8n and how to avoid common pitfalls.

Quick Start

Copy the minimal Python Code Node template, ensure you return a list of dictionaries with the json key, and adapt to your input data without external libraries.

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?

To write Python in n8n Code nodes for data transformation, use only the standard library and return a list of items containing a json field. Safe data access patterns like _input.all() and .get() ensure reliable webhook processing and per-item handling.

Can I use external Python libraries in n8n Code nodes?

No, external Python libraries are not supported in n8n Code nodes. You must implement webhook handling and batch transformations using only Python's standard library to avoid runtime errors and ensure reliable cross-node data references.

What is the correct return format for Python data in n8n workflows?

The correct return format for Python data in n8n workflows is a list of dictionaries, where each dictionary must contain a json field. This strict n8n format requirement prevents data pipeline failures when processing webhook payloads or batch items.

Should I use Python or JavaScript for n8n Code node transformations?

Choosing between Python and JavaScript for n8n Code node transformations depends on your environment needs. Python is standard-library only and suited for safe data access, while JavaScript may offer broader compatibility for complex workflow requirements without library restrictions.

Why does my Python Code node in n8n fail during webhook processing?

Your Python Code node in n8n likely fails during webhook processing due to strict return format requirements or unsafe data access. Prevent errors by returning a list of items with a json field and using safe dictionary access methods like .get().

How do I access input data safely in n8n Python Code nodes?

Access input data safely in n8n Python Code nodes by using _input.all(), _input.first(), or _input.item patterns. Combine these with safe dictionary access like .get() to handle missing keys and prevent workflow failures during batch transformations.