Skip to content
Back to skills

N8n Code Python

ASecurity

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.

  • 8 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 7, 2026
developmentjavascriptpythonjavanodeexpressgitdocumentation

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned November 7, 2026

npx -y skills add huytran1120/vietnam-agentic-skills --skill n8n-code-python --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of N8n Code Python?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for N8n Code Python
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/huytran1120-n8n-code-python/badge)](https://www.skillsdirectory.com/skills/huytran1120-n8n-code-python)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: n8n-code-python
description: 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.
risk: critical
source: community
date_added: "2026-01-30"
---

# Python Code Node (Native)

## When to Use

Use for bounded Python transformations in an n8n Code node when native nodes or
expressions are insufficient. Check the installed n8n version and task runner first.

## Runtime contract

n8n 2 removed the legacy Pyodide runtime. Native Python uses `_items` in all-items
mode and `_item` in per-item mode; legacy `_input`, `_json`, `_node` and `_now`
helpers are unavailable. Self-hosted imports depend on installed runner packages
and explicit allowlists. Cloud imports may be unavailable, including standard
modules. JavaScript imports are restricted too; switching languages does not
provide unrestricted filesystem, networking or package access.

## Examples

All-items mode, with no imports:

```python
return [
    {"json": {"id": item["json"].get("id"), "processed": True},
     "pairedItem": {"item": index}}
    for index, item in enumerate(_items)
    if item["json"].get("active")
]
```

Per-item mode:

```python
return {"json": {**_item["json"], "name_upper": (_item["json"].get("name") or "").upper()}}
```

Validate actual input types before string operations. Use HTTP Request nodes with
managed credentials for remote calls and enforce allowed destinations. Do not log
payloads/tokens or execute code supplied by webhook users. Keep item count, input
size and runtime bounded; prepare changes in an inactive test workflow before
activating workflows that send messages, spend money or modify external systems.

## Detailed Guide

Read [the guide](references/detailed-guide.md) for transformation patterns and
migration caveats. The referenced upstream auxiliary files are not bundled.

## Limitations

No workflow or runner is included. Import availability and output normalization
must be checked in the deployed version; item linking, binary data and aggregation
require explicit handling. No runtime tests are established by these examples.

Primary runtime reference: [n8n Code node documentation source](https://github.com/n8n-io/n8n-docs/blob/main/docs/reusable-content/.gitbook/includes/integrations/builtin/core-nodes/code-node.md).

Files in this skill

  • SKILL.md2.3 KB
  • references/detailed-guide.md14.4 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.