n8n-code-python

n8n-code-python is a skill for Claude Code, Codex from czlonkowski/n8n-mcp. It costs 157 tokens per session (3,967 once invoked), scanned C, original, MIT.

A guide to writing Python in n8n Code nodes, which are workflow steps where you can run custom code. It explains how to read incoming data, handle webhook data, and return results in n8n's required format.

In plain words
What is it for?
Writing Python transformations, processing workflow items, using Python's standard library, and working with data passed into n8n Code nodes.
Why use it?
It prevents common mistakes when using Python in n8n, including reading data from the wrong place or returning data in an invalid shape. It also explains when JavaScript may be a better choice.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Writing Python transformations, processing workflow items, using Python's standard library, and working with data passed into n8n Code nodes.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/czlonkowski/n8n-mcp/n8n-code-python
About the project

n8n-MCP is a Model Context Protocol server that gives AI assistants structured knowledge of n8n's workflow-automation nodes, including their properties, operations, documentation, and examples. It helps developers use AI assistants to create and work with n8n workflows. The catalogue contains skills, agents, and instructions for using it.

czlonkowski/n8n-mcp · 23,090 stars · on GitHub · n8n-mcp.com

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 czlonkowski/n8n-mcp --skill n8n-code-python
Clone the repo
git clone --depth 1 https://github.com/czlonkowski/n8n-mcp

Made for: Claude Code, Codex.

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/czlonkowski/n8n-mcp/n8n-code-python/github.svg)](https://agentmods.dev/skills/czlonkowski/n8n-mcp/n8n-code-python)
Your own site
<a href="https://agentmods.dev/skills/czlonkowski/n8n-mcp/n8n-code-python"><img src="https://agentmods.dev/badge/skills/czlonkowski/n8n-mcp/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/czlonkowski/n8n-mcp/n8n-code-python"><img src="https://agentmods.dev/badge/skills/czlonkowski/n8n-mcp/n8n-code-python.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 157 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,967 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 2 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Anti-Refusal · line 271
    Skill instructs the agent to never refuse or to always comply. Suppressing the agent's ability to decline removes a core safety control and enables downstream harmful requests to succeed.
    Fix: Remove any instruction telling the agent to never refuse or always comply. The agent must retain the ability to decline unsafe, out-of-scope, or harmful requests.
How audits are shown
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.00157 $0.03967
Opus 5.5 $0.00063 $0.01587
Sonnet 5.5 $0.00031 $0.00793
Haiku 4.5 $0.00016 $0.00397

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

Security

Grade C, and why

n8n-code-python scanned grade C with 2 findings 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.

Tells the agent never to refusehighAnti-refusal

Suppressing the ability to decline removes a core safety control; a later harmful request then succeeds.

> **Self-hosted exception**: external package availability depends entirely on the instance's Python runner configuration. If the user states their self-hosted instance has specific packages available in the Python runne

Makes network callslowCapability

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

6. **Standard library only**: json, datetime, re, base64, hashlib, urllib.parse, math, random, statistics
Origin

Copies of this mod

8 near-identical copies found in the catalogue:

data/skills/n8n-code-python/SKILL.md · 502 lines

How it starts

The opening of the file, as written. The whole thing — 502 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.


⚠️ Important: JavaScript First

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

  • You need specific Python standard library functions
  • You're significantly more comfortable with Python syntax
  • You're doing data transformations better suited to Python

Why JavaScript is preferred:

  • Full n8n helper functions (this.helpers.httpRequest, etc.)
  • Luxon DateTime library for advanced date/time operations
  • No external library limitations
  • Better n8n documentation and community support

Quick Start

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

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

return processed

Essential Rules

  1. Consider JavaScript first - Use Python only when necessary
  2. Access data: _input.all(), _input.first(), or _input.item
  3. CRITICAL: Must return [{"json": {...}}] format
  4. CRITICAL: Webhook data is under _json["body"] (not _json directly)
  5. CRITICAL LIMITATION: No external libraries (no requests, pandas, numpy)
  6. Standard library only: json, datetime, re, base64, hashlib, urllib.parse, math, random, statistics

Mode Selection Guide

Same as JavaScript - choose based on your use case:

Run Once for All Items (Recommended - Default)

Use this mode for: 95% of use cases

  • How it works: Code executes once regardless of input count
  • Data access: _input.all() or _items array (Native mode)
  • Best for: Aggregation, filtering, batch processing, transformations
  • Performance: Faster for multiple items (single execution)
# Example: Calculate total from all items
all_items = _input.all()
total = sum(item["json"].get("amount", 0) for item in all_items)

return [{
    "json": {
        "total": total,
        "count": len(all_items),
        "average": total / len(all_items) if all_items else 0
    }
}]

Read the full file on GitHub · 502 lines

Files

What ships with it

5 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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 · 502 lines · 157 tokens per session scan C cae740351f90

Subscribe to this mod's changes

n8n-code-python is a skill published in the GitHub repository czlonkowski/n8n-mcp (23,090 stars, last pushed 2d ago), licensed MIT. It adds 157 tokens to every session and 3,967 once invoked, about $0.0006 per session on Opus 5.5. A static security scan graded it C with 2 findings (tells the agent never to refuse, 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

idapython

IDA Pro Python scripting for reverse engineering. Use when writing IDAPython scripts, analyzing binaries, working with IDA's API for disassembly, decompilation (Hex-Rays), type systems, cross-references, functions, segments, or any IDA database manipulation. Covers ida modules (50+), idautils iterators, and common…

mrexodia/ida-pro-mcp · 77 tokens

vibeue

Unreal Engine 5 development using the VibeUE Python API. Use when working in Unreal Engine — blueprints, state trees, materials, actors, landscapes, animation, niagara, widgets, sound, foliage, gameplay tags, enhanced input, skeletons, PCG (procedural content generation), and more. VibeUE is an extension of Unreal's…

kevinpbuckley/VibeUE · 82 tokens

python-api

This skill should be used when writing, editing, or debugging Python code that runs inside TouchDesigner — scripts, expressions, DAT callbacks, Extensions, or one-off snippets passed to executepythonscript — or whenever there is uncertainty about a td class's methods, members, or module-level API. Trigger phrases…

8beeeaaat/touchdesigner-mcp · 117 tokens

quantum-vqe

A runnable guide to the variational quantum eigensolver (VQE), a quantum algorithm that estimates the lowest energy of a mathematical system by adjusting a parameterized circuit. It uses Pauli Hamiltonians, a specified circuit form, and SciPy optimization.

xi-zhao/OpenQuantum · 53 tokens

quantum-vqls

A runnable guide to the variational quantum linear solver (VQLS), a quantum method that estimates a solution to a system of linear equations by optimizing a parameterized circuit. It uses Qiskit and reports the numerical residual and why optimization stopped.

xi-zhao/OpenQuantum · 56 tokens

python-design-pattern

Python design patterns and anti-patterns. Use when designing new components, refactoring, reviewing code for common mistakes, choosing abstractions, or evaluating pull requests for structural issues like tight coupling, leaking internal types, or error handling problems.

AI-Riksarkivet/ra-mcp · 51 tokens