Skip to content
SkillModel-led2,755 tokens in use

n8n Code Python

A guide to native Python in n8n 2.x Code nodes: the two input variables, blocked imports, denied builtins, accepted return shapes and how errors interact with onError.

6,686 stars on the repository MIT Licenseczlonkowski/n8n-skills · skills/n8n-code-python
/plugin install czlonkowski/n8n-skills
View source

Install command as written in the repository's README

Skill label

measured from its files

What installing n8n Code Python costs

226tokens idle
2,755tokens in use
5,186tokens, up to

Idle is what sits in context while the skill is installed. In use is its instructions, loaded when it runs. Up to adds the files its instructions link. Counts are approximate, made offline with cl100k_base.

Model dependence Model-led

Script-ledMixedModel-led

Mostly instructions, so how well it works depends on the model that follows them.

This describes the skill's structure, how much of it is scripts. It does not say how well it works.

Touches

Nothing detected: no shell, network, file writes, git or credentials in its files.

Declared tags come from the skill's frontmatter; detected ones from its scripts, its code blocks and the commands it names in inline code. This is detected, not audited.

How it scores

Quality

How well the skill is written, counted from its own files: its frontmatter, its steps, examples, stated output and constraints, its size and whether every file it ships is one it names.How we score it →
Good
  • Frontmatter12/15
  • Structure17/25
  • Examples12/15
  • Output15/15
  • Size13/15
  • Resources7/15

Security

Starts at 100 and loses points for each thing in the skill's files that a reader should look at first.How we score it →
Excellent

No findings.

Repository health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
Good
  • Development activity88
  • Maintenance92
  • Community60
  • Maturity36
  • Momentum40

n8n Code Python is a skill for Claude that covers the native Python runner in n8n 2.x Code nodes. Python there has two variables, _items and _item, dict-only access and no imports by default, so code copied from older Pyodide examples tends to fail.

The skill explains the sandbox limits, the return shapes n8n accepts in each mode, how output values are converted, and the cases where a failed node still passes unchanged input downstream. It sends most jobs to JavaScript or native nodes first.

What You Get

  • A quick start for All Items mode with _items and Each Item mode with _item
  • A migration table from legacy Pyodide names such as _input, _json and _node
  • The rule that every import is blocked unless the instance allowlists it, with import-free alternatives
  • A table of denied builtins and constructs with what to use for each
  • Verified return shapes for both modes and the value conversions for sets and datetimes
  • A checklist and a reference file of twelve import-free patterns

Common Use Cases

  • Porting an old Python Code node that fails with NameError after an n8n 2.x upgrade
  • Fixing the Security violations detected message caused by an import
  • Debugging a Code node that shows success but passed its input through untouched
  • Filtering, grouping or deduplicating items in Python without any imports

What Makes It Unique

It records behaviour observed on a live n8n instance, including undocumented auto-wrapping and the silent passthrough on static rejection. It tells Claude to prefer JavaScript, an expression or a native node, and to confirm with a real test run because validation misses most Python traps. Custom Code Tool Python goes to a separate skill.

Under The Hood

The skill is instructions and one reference markdown file of patterns, with no scripts. It points Claude to run test executions and read node output through the n8n-mcp tools against your n8n server. The Python it teaches runs in n8n’s task runner sandbox with no imports by default, so it works only on the workflow items passed in. It also tells Claude to check the self-hosted task runner settings for the Python runner and allowed modules.

Join founders building with open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on SubstackJoin 750+ subscribers