n8n-code-python

Write Python code in n8n Code nodes using data access patterns and error prevention.

Updated Feb 25, 2026
One-click install
npx skills add https://github.com/MaizeCobra/agentic-setup --skill n8n-code-python-maizecobra
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: n8n-code-python
Source: https://github.com/MaizeCobra/agentic-setup/tree/main/.opencode/skills/n8n-code-python
Command: npx skills add https://github.com/MaizeCobra/agentic-setup --skill n8n-code-python-maizecobra

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides guidance and patterns for writing Python code within n8n Code nodes, enabling custom data transformations and logic execution directly within your workflows.

Core Features & Use Cases

  • Python Code Execution: Write and run Python scripts directly inside n8n.
  • Data Access Patterns: Learn how to access input data using _input.all(), _input.first(), and _input.item.
  • Error Prevention: Avoid common pitfalls like ModuleNotFoundError, KeyError, and incorrect return formats.
  • Use Case: Transform incoming webhook data by parsing JSON, cleaning fields, and aggregating results using Python's standard library before passing it to subsequent nodes.

Quick Start

Use the n8n-code-python skill to write a Python script that processes all incoming items, extracts the 'name' field, and returns a list of uppercase names.

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 an n8n Code node to transform data?

To write Python code in an n8n Code node, use `_input.all()` to access incoming items, apply standard library functions for data transformation or validation, and return a formatted list of items for subsequent nodes.

Why does my Python script in n8n throw a ModuleNotFoundError?

A ModuleNotFoundError in n8n Python scripts occurs because external libraries are not supported. The n8n-code-python Skill addresses this limitation by providing solutions using only Python's built-in standard library.

Can I use external Python libraries in n8n workflows?

External Python libraries cannot be used in n8n Code nodes. The Skill guides users on performing data transformation, JSON manipulation, and validation tasks using only the Python standard library.

What is the correct way to access input data in n8n Python Code nodes?

Input data in n8n Python Code nodes is accessed using `_input.all()` for all items, `_input.first()` for the initial item, or `_input.item` for the current item. The Skill details these patterns to prevent `KeyError` and incorrect return formats.

How do I parse and clean incoming webhook data using Python in n8n?

Parsing and cleaning webhook data in n8n involves using Python's standard library to parse JSON, extract fields like 'name', and aggregate results. The Skill provides patterns for transforming this data before passing it to subsequent workflow nodes.