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.