Prompt Engineering Library Builder using Google Gemini and Airtable - n8n Workflow

Use this specialized n8n workflow to automatically generate, categorize, and structure high-quality AI prompts using the Google Gemini model, storing them efficiently in an Airtable database.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • AI Prompt Engineers looking to standardize and scale prompt creation.

  • Content Strategists who need a centralized library of effective n8n prompts.

  • n8n users seeking advanced examples of using Langchain LLM Chains and structured output parsing in an n8n workflow.

  • Teams needing to build or manage internal knowledge bases of high-performance AI instructions.

Overview

Managing effective AI prompts is crucial for consistent AI agent performance. This powerful n8n workflow solves the challenge of manually creating, structuring, and organizing these critical inputs. By leveraging the advanced capabilities of the Google Gemini model within an n8n environment, this automation takes a simple prompt idea and transforms it into a highly structured, battle-tested prompt template, adhering to best practices (defining role, rules, and context).

This entire n8n workflow functions as a prompt library builder. The newly optimized prompt is automatically categorized and named by a secondary AI agent using specialized n8n node configurations, and finally, all the structured data is persisted in Airtable for easy access and reuse. This demonstrates a robust use case for complex, multi-step AI automation built using n8n templates.

How it Works

The entire process is initiated via a chat-based n8n trigger, signaling the start of the n8n workflow when an initial prompt concept is received.


  1. Trigger: The When chat message received n8n trigger starts the workflow based on an incoming chat input (the initial prompt idea).

  2. Prompt Optimization: The Generate a new prompt n8n node uses a highly detailed system prompt within a Langchain LLM Chain to instruct the connected Google Gemini Chat Model to act as an expert prompt engineer. It refines the initial input into a standardized prompt format, ready for deployment in other n8n templates.

  3. Data Preparation: The Edit Fields n8n node captures the newly generated, optimized prompt text.

  4. Categorization & Naming: The Categorize and name Prompt n8n node takes the optimized text and uses a separate AI call (via the Google Gemini Chat Model1) to assign a descriptive name and category.

  5. Structured Output Guarantee: To ensure data quality, this step uses an advanced n8n node combination: the Structured Output Parser defines the strict JSON schema for the name and category, while the Auto-fixing Output Parser ensures the Gemini output conforms perfectly to this schema, preventing data entry errors.

  6. Data Structuring: The set prompt fields n8n node maps the parsed name, category, and the original optimized prompt into required fields.

  7. Storage: The add to airtable n8n node then creates a new record in the specified 'Prompt Library' base, storing the structured AI data.

  8. Completion: The Return results n8n node sends the final generated prompt back to the originating chat service.

Installation Guide

To install this n8n workflow, follow these steps:


  1. Import: Copy the provided JSON and import it directly into your n8n instance as a new n8n workflow.

  2. Credentials Setup:

Google Gemini (PaLM) API: You will need to set up credentials for the Google Gemini (PaLM) API in n8n for the Google Gemini Chat Model nodes. This key enables the AI generation.
Airtable: Set up an Airtable Personal Access Token credential for the add to airtable n8n node. Ensure this token has read/write access to the target Base ('Prompt Library') and Table ('Prompt Library').

  1. Airtable Configuration: Verify the Base ID and Table ID in the add to airtable node match your intended Prompt Library setup.

  2. Trigger Activation: Activate the When chat message received n8n trigger node to make the webhook active and ready to receive inputs. This sophisticated n8n template is now operational.

Node Details

When chat message received (n8n trigger): The starting n8n trigger point for the automation, utilizing the @n8n/n8n-nodes-langchain.chatTrigger to receive initial text inputs.
Generate a new prompt (Langchain LLM Chain n8n node): The core intelligence node. It uses a lengthy, predefined prompt to guide the connected Google Gemini model to refine and structure the user input into a standardized, expert-level AI prompt.
Google Gemini Chat Model: Used by the chain nodes to execute the LLM tasks. Configured to use models/gemini-2.0-flash-lite with high precision settings.
Categorize and name Prompt (Langchain LLM Chain n8n node): Executes a secondary AI task to process the optimized prompt and extract descriptive metadata (name and category).
Structured Output Parser (n8n node): Defines the exact JSON structure (name and category) required from the AI output, crucial for ensuring the n8n workflow handles data consistently.
Auto-fixing Output Parser (n8n node): This acts as a safeguard, using the Google Gemini model to fix any malformed JSON output from the primary categorization call, ensuring the structured data always conforms to the schema defined by the structured n8n node.
set prompt fields (Set n8n node): Maps the structured AI output variables to specific field names (name, category, Prompt) needed for the final Airtable entry.
add to airtable (Airtable n8n node): Performs the final action of the n8n workflow: creating a new record in the specified 'Prompt Library' table, successfully storing the generated and categorized prompt.

Related n8n Workflows

Free

Nodes: 7 Nodes
Updated: December 26 2025
View all
Created by

Automation expert with years of experience helping businesses improve their efficiency and productivity with smart automations that are affordable, scalable, and flexible.

Featured*