AI-Powered Automated Workflow Node Renaming - n8n Workflow

Use this advanced n8n workflow to automatically rename confusing nodes using AI (Gemini or Claude). Improve readability and maintainability for any n8n template.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • n8n developers seeking to enforce clear naming conventions.

  • Users importing complex n8n templates or workflows with generic node names (e.g., 'Set1', 'HTTP Request2').

  • Automation specialists who need easily maintainable and debuggable n8n workflows.

  • Teams prioritizing code quality and documentation standards within their n8n environment.

Overview

Maintaining clear and descriptive node names is crucial for workflow health, especially in large and complex n8n implementations. Generic names significantly hinder debugging and collaboration. This advanced n8n workflow solves this problem by leveraging powerful LLMs (like Gemini or Claude) to analyze the structure, type, and parameters of every n8n node in a target workflow. It then automatically suggests concise, functional names, applies them to the underlying JSON, and, critically, updates all cross-node references ($('NodeName')) to ensure the newly renamed n8n workflow functions perfectly.

This process creates a clean, readable copy of the original n8n workflow, dramatically improving its long-term maintainability. It is one of the most powerful self-management n8n templates available, designed for technical users who frequently manage or customize n8n workflows.

How it Works

This comprehensive n8n workflow operates by treating the target n8n workflow as data, performing complex analysis and transformation, and then managing the creation and activation of the new version via the n8n API.


  1. Initiation and Configuration: The n8n trigger starts the process. The 'Set Renamed Workflow Suffix' n8n node defines a naming suffix (e.g., ' - new node names').

  2. Data Retrieval: The 'Get Current Workflow JSON' n8n node uses the n8n API to fetch the complete JSON data for the target n8n workflow (specified by ID).

  3. AI Analysis: The 'AI Generate Name Suggestions' LangChain n8n node sends the raw workflow JSON, alongside a specialized prompt, to the selected AI model (either Gemini or Claude). The prompt explicitly instructs the AI expert to analyze the node's type and parameters to generate a list of optimal, concise new names in a strict JSON mapping format.

  4. Parsing: The 'Parse JSON Response Structure' n8n node validates and parses the AI's output, ensuring the required originalName to newName mapping structure is correct.

  5. Core Transformation (Code Node): The 'Apply Names and Update References' Code n8n node executes complex JavaScript logic. It uses the AI-generated map to update the .name property for every n8n node. Crucially, it then iterates through all parameters within the workflow and automatically updates any expressions containing old node names, such as $('OldName') or $items('OldName'), replacing them with the new names. This ensures all internal node dependencies are preserved in the new n8n workflow.

  6. Workflow Creation: The 'Create New Workflow Copy' n8n node posts the updated workflow JSON back to the n8n API, creating a clean, newly named n8n workflow copy.

  7. Final Management: The workflow then uses two final n8n nodes: 'Deactivate Old Workflow' and 'Activate Renamed Workflow', completing the rollout and making the new, clearly named n8n workflow live.

Installation Guide

To utilize this self-managing n8n workflow, follow these steps:


  1. Import: Import the provided n8n workflow JSON into your n8n instance.

  2. API Credentials: You must provide n8n API credentials (API key or basic authentication) to all four n8n node instances that interact with the n8n API (Get, Create, Deactivate, Activate). These credentials must allow read/write access to your workflows.

  3. AI Credentials: Configure the required AI credentials:

For Gemini: Set up the Google Gemini API credentials.
For Claude Sonnet: Set up the OpenRouter API credentials (as used in the template).

  1. Target Workflow ID: In the 'Get Current Workflow JSON' n8n node, manually replace the placeholder Workflow ID (W9Zl6OSnvKpmCbPr) with the unique ID of the n8n workflow you wish to rename.

  2. Execution: Run the 'Start Workflow Manually' n8n trigger. The process will execute, and a new, renamed n8n workflow will appear in your list.

Node Details

Start Workflow Manually (n8n trigger): Initiates the entire automated renaming process.
Get Current Workflow JSON (n8n node):
Function: Retrieves the entire JSON definition of the target n8n workflow via the n8n API.
Key Configuration: Requires the explicit ID of the workflow to be renamed.
AI Generate Name Suggestions (LangChain LLM):
Function: Sends the target workflow JSON to an LLM to generate descriptive node names.
Key Configuration: Contains a highly structured prompt that acts as an expert n8n consultant, requiring the output to be a precise JSON array mapping old names to new names, specifically formatted to be applied to the JSON structure.
Claude Sonnet AI Model / Gemini AI Model (LangChain Models): Provides the language model backbone for the AI Generate Name Suggestions n8n node, allowing flexibility in AI choice.
Parse JSON Response Structure (LangChain Output Parser):
Function: Enforces structural validation of the AI's output to ensure it matches the required format for the subsequent Code node.
Apply Names and Update References (Code n8n node):
Function: The central processing unit. It applies the AI's recommended names to the node objects, and then executes custom JavaScript to find and replace all instances of the old node names within connection definitions and parameter expressions (like $('Node Name')) throughout the entire n8n workflow JSON.
Create New Workflow Copy (n8n node):
Function: Uses the n8n API to create a new, inactive workflow based on the output JSON from the Code node.
Deactivate Old Workflow (n8n node):
Function: Uses the n8n API to deactivate the original n8n workflow. Configured to continue even if an error occurs (e.g., if the original workflow was already inactive).
Activate Renamed Workflow (n8n node):
Function: Activates the newly created, clearly named n8n workflow copy, finalizing the process.

Related n8n Workflows

Free

Nodes: 9 Nodes
Updated: December 26 2025
View all
Created by
Dr. Christoph Schorsch
Dr. Christoph Schorsch

AI Automations Manager with nature scientific background and experience in haeding departments in R&D.

Featured*