n8n-code-python

Write Python code for n8n Code nodes using only the standard library.

6|1|Updated Apr 7, 2026
One-click install
npx skills add https://github.com/kmshihab7878/claude-code-setup --skill n8n-code-python-kmshihab7878
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: n8n-code-python
Source: https://github.com/kmshihab7878/claude-code-setup/tree/main/skills/n8n/czlonkowski/skills/n8n-code-python
Command: npx skills add https://github.com/kmshihab7878/claude-code-setup --skill n8n-code-python-kmshihab7878

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Helps engineers and automation authors write correct, production-ready Python inside n8n Code nodes by clarifying data access, return formats, available standard library modules, and common failure modes so workflows don't break at runtime.

Core Features & Use Cases

  • Explains _input/_json/_node access patterns and mode selection (All Items vs Each Item) for reliable data transformation.
  • Documents the critical limitation of no external libraries and provides standard-library alternatives and node-based workarounds.
  • Presents 10 production-tested patterns (aggregation, regex parsing, JSON comparison, CRM normalization, top-N filtering) and a top-5 error prevention guide for common runtime failures.
  • Ideal for processing webhook payloads, transforming arrays of items, validating and normalizing records, and producing correctly formatted outputs for downstream nodes.

Quick Start

Use this skill when you need to write Python for an n8n Code node to parse webhook body data, transform items, and return results in the required [{"json": {...}}] 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 return correctly formatted data from a Python Code node in n8n?

Python Code nodes in n8n require returning results in the specific [{"json": {...}}] format so downstream nodes can parse the items reliably. Use the provided templates to ensure your output matches this structure.

Can I use external Python libraries in n8n Code nodes?

No, n8n Code nodes enforce a standard-library-only constraint for Python. You must use built-in modules and apply node-based workarounds for functionality requiring external dependencies.

How do I access webhook payload data inside an n8n Python Code node?

Access webhook payload data inside an n8n Python Code node using the _input, _json, and _node access patterns. Selecting the correct mode (All Items vs Each Item) ensures reliable data transformation.

What is the best way to transform arrays of items in n8n using Python?

The best way to transform arrays of items in n8n using Python is applying production-tested patterns like aggregation, regex parsing, and CRM normalization within the Code node's Each Item mode for batch processing.

Why does my n8n Python Code node fail at runtime?

Your n8n Python Code node likely fails at runtime due to incorrect return formats, improper mode selection, or unsupported external library calls. Apply the top-5 error prevention strategies to resolve common failures.