n8n-code-python

n8n-code-python is a skill for Claude Code from neurawork-git/n8n-autopilot. It costs 52 tokens per session (1,349 once invoked), scanned A, original, MIT.

Guidance for writing Python in n8n Code nodes, the parts of n8n workflows where code processes incoming data. It explains the input and output format, available standard-library tools, and important limitations.

In plain words
What is it for?
Use it when transforming workflow items with Python, accessing n8n input data, handling webhook bodies, or deciding whether JavaScript would be a better choice.
Why use it?
It prevents common mistakes such as returning the wrong data shape, reading webhook data from the wrong place, or importing libraries that n8n does not provide.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter.

Part of the n8n-autopilot plugin — 24 skills, 12 agents, 5 hooks shipped together

Good fit Use it when transforming workflow items with Python, accessing n8n input data, handling webhook bodies, or deciding whether JavaScript would be a better choice.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/neurawork-git/n8n-autopilot/n8n-code-python
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add neurawork-git/n8n-autopilot --skill n8n-code-python
Clone the repo
git clone --depth 1 https://github.com/neurawork-git/n8n-autopilot

Made for: Claude Code.

Or install n8n-autopilot, the plugin that ships this one along with the rest of its 24 skills, 12 agents, 5 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for n8n-code-python

README.md
[![agentmods](https://agentmods.dev/badge/skills/neurawork-git/n8n-autopilot/n8n-code-python/github.svg)](https://agentmods.dev/skills/neurawork-git/n8n-autopilot/n8n-code-python)
Your own site
<a href="https://agentmods.dev/skills/neurawork-git/n8n-autopilot/n8n-code-python"><img src="https://agentmods.dev/badge/skills/neurawork-git/n8n-autopilot/n8n-code-python/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for n8n-code-python

Your own site · 80×15
<a href="https://agentmods.dev/skills/neurawork-git/n8n-autopilot/n8n-code-python"><img src="https://agentmods.dev/badge/skills/neurawork-git/n8n-autopilot/n8n-code-python.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 52 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,349 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00052 $0.01349
Opus 5.5 $0.00021 $0.00540
Sonnet 5.5 $0.00010 $0.00270
Haiku 4.5 $0.00005 $0.00135

Measured 1mo ago against content hash 237e194803dd, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

n8n-code-python scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

import urllib.parse
skills/n8n-code-python/SKILL.md · 224 lines

How it starts

The opening of the file, as written. The whole thing — 224 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Python Code Node (Beta)

Expert guidance for writing Python code in n8n Code nodes.


JavaScript First

Use JavaScript for 95% of use cases. Only use Python when:

  • You need specific Python standard library functions (e.g. statistics)
  • You're significantly more comfortable with Python syntax
  • You're doing data transformations better suited to Python

JavaScript has $helpers.httpRequest(), Luxon DateTime, and better n8n docs.


Quick Start

# Basic template for Python Code nodes
items = _input.all()

processed = []
for item in items:
    processed.append({
        "json": {
            **item["json"],
            "processed": True,
            "timestamp": datetime.now().isoformat()
        }
    })

return processed

Essential Rules

  1. Consider JavaScript first
  2. Access data: _input.all(), _input.first(), _input.item
  3. CRITICAL: Return [{"json": {...}}] format
  4. CRITICAL: Webhook data is under _json["body"]
  5. CRITICAL LIMITATION: No external libraries — no requests, pandas, numpy

CRITICAL: No External Libraries

# ❌ NOT AVAILABLE
import requests   # ModuleNotFoundError
import pandas     # ModuleNotFoundError

# ✅ AVAILABLE (standard library only)
import json
import datetime
import re
import base64
import hashlib
import urllib.parse
import math
import random
import statistics

Workarounds:

  • Need HTTP requests? → Use HTTP Request node before Code node (or switch to JavaScript)
  • Need pandas? → Use statistics module for basic stats, or switch to JavaScript

Data Access

# All items
all_items = _input.all()

# First item
first_item = _input.first()
data = first_item["json"]

# Each item mode
current_item = _input.item

# Other nodes
webhook_data = _node["Webhook"]["json"]
http_data = _node["HTTP Request"]["json"]

CRITICAL: Webhook Data

# ❌ WRONG
name = _json["name"]        # KeyError!

# ✅ CORRECT
name = _json["body"]["name"]

# ✅ SAFER
name = _json.get("body", {}).get("name", "Unknown")

Read the full file on GitHub · 224 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 224 lines · 52 tokens per session scan A 237e194803dd

Subscribe to this mod's changes

n8n-code-python is a skill published in the GitHub repository neurawork-git/n8n-autopilot (18 stars, last pushed 10d ago), licensed MIT. It adds 52 tokens to every session and 1,349 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

n8n-code-tool

Write JavaScript or Python for the n8n Custom Code Tool (@n8n/n8n-nodes-langchain.toolCode) — the AI-agent-callable tool, NOT the workflow Code node. Use when building a Code Tool attached to an AI Agent, writing code that an LLM will invoke, parsing the query input, returning a string result, defining an input schema…

czlonkowski/n8n-skills · 221 tokens

n8n-code-python

Write Python in n8n Code nodes (native Python, language pythonNative, n8n 2.x). Use when the user explicitly wants Python in a Code node, when migrating old Pyodide/"Python (Beta)" code that used input/json/node/now, or when a Python Code node fails with NameError, "Security violations detected", "Import of standard…

czlonkowski/n8n-skills · 228 tokens

n8n-code-python

Write Python code in n8n Code nodes. Use when writing Python in n8n, using input/json/node syntax, working with standard library, or need to understand Python limitations in n8n Code nodes. Use this skill when the user specifically requests Python for an n8n Code node. Note — JavaScript is recommended for 95% of use…

czlonkowski/n8n-mcp · 157 tokens

shiny-py-optimize

Diagnose and fix performance problems in Shiny for Python apps — slow startup, sluggish interactions, blocking operations, and apps that struggle beyond a handful of concurrent users. Use when a Shiny for Python app is slow, hangs, recomputes too much, times out, or must support more users; when the user asks to…

posit-dev/skills · 105 tokens

cloudflare-workers-multi-lang

Multi-language Workers development with Rust, Python, and WebAssembly. Use when building Workers in languages other than JavaScript/TypeScript, or when integrating WASM modules for performance-critical code.

secondsky/claude-skills · 45 tokens

tia-python

Reference for Siemens TIA Scripting Python V1.4.3. Load only when the user explicitly chooses Python TIA Scripting or the TIA roadmap routes to it.

Czarnak/totally-integrated-claude · 39 tokens