What This Workflow Does
This workflow gets an AI prompt template from GitHub. It finds all placeholder variables and checks they have values. It changes these placeholders into real project details automatically. If some variables are missing, the workflow stops with an error message. The final prompt is sent to an AI Agent to create content or answers based on it.
This saves time and avoids mistakes from copying and editing prompts manually.
Who Should Use This Workflow
This workflow works well for marketers, writers, or anyone who uses AI prompts stored in GitHub. It’s good if you need to update prompt details dynamically. It helps if you want to reduce errors and speed up prompt preparation.
Tools And Services Used
- n8n: Runs the workflow automation.
- GitHub API: Fetches prompt files from repositories.
- Langchain AI Agent: Processes final prompts and generates content.
- Ollama Chat Model (optional): Supports advanced AI chat responses.
Inputs, Processing, And Output
Inputs
- GitHub repository details: account, repo name, path, and prompt file.
- Project-specific variables such as company name, product, features, sector.
Processing Steps
- Download the markdown prompt file from GitHub.
- Extract prompt text from the markdown file.
- Check all prompt variables have matching values set.
- If missing variables found, stop and show an error message.
- Replace all placeholders dynamically with real variable values.
- Send the full prompt text to AI Agent for processing.
Output
- Ready-to-use AI prompt with project details filled in.
- AI-generated content or answers based on the customized prompt.
Beginner Step-by-Step: How To Use This Workflow In n8n
Importing The Workflow
- Download the workflow file using the Download button on this page.
- Open your n8n editor.
- Use the Import from File option to load the workflow JSON.
Setting Up Credentials And Variables
- Add your GitHub API credentials in the GitHub node.
- Add credentials for the Langchain AI Agent or other AI nodes.
- Check the setVars node and update values like Account, repo, path, prompt, company, product, features, sector to match your project.
- If needed, update any IDs, emails, or channels if the workflow uses messaging nodes.
Running The Workflow
- Click the manual trigger node called When clicking ‘Test workflow’ to run the flow for testing.
- Watch the execution logs and output for errors or successful prompt generation.
- If errors appear about missing variables, fix the setVars node keys or the prompt placeholders.
Activating For Production
- Turn the workflow toggle ON inside n8n to activate it.
- Optionally, set up webhook or schedule triggers to run it automatically.
- Consider self-host n8n for full control if needed.
Step Breakdown Of Key Nodes
setVars Node
Sets all project-specific values used for variable replacement like company, product, features.
GitHub Node
Fetches the raw markdown prompt file using API credentials and dynamic path constructed from setVars.
Extract from File Node
Extracts plain text from markdown content to prepare for variable checks.
Check All Prompt Vars Present Code Node
Reads the prompt, finds all variables with {{ }}, checks if their values are set. Stops if missing keys detected.
Replace Variables Code Node
Replaces all {{ variable }} placeholders in the prompt text with the corresponding values from setVars.
AI Agent Node
Receives final prompt and processes it to generate AI content.
Customization Ideas
- Add more keys and variables in setVars to fit your prompt needs.
- Change repo or path values in setVars to use different prompt templates from GitHub.
- Adapt Extract from File node to handle other prompt file formats.
- Swap or add other AI nodes like OpenAI or Ollama for different output.
- Add logging with Set or Webhook node to save prompts or errors for review.
Common Issues And Troubleshooting
GitHub Node Shows 404 Not Found
Check that the Account, repo, and file path match actual GitHub repo and file names. Verify folder case and spelling.
Missing Variables Error
Make sure all placeholders in prompt files exist as keys in setVars. Adjust the replace logic if variable names differ.
Empty Or Bad AI Response
Inspect the final prompt text in Set Completed Prompt. Fix any leftover placeholders or formatting issues.
Pre-Production Checklist
- Verify every placeholder in your prompt has a matching variable in setVars.
- Ensure GitHub API key can access the prompt repository.
- Run manual tests using the trigger node to check the workflow outputs.
- Confirm AI credentials and connectivity are working.
- Keep backups of your GitHub prompts and workflow JSON files in case rollback is needed.
Summary Of Benefits And Results
✓ Saves over 10 hours weekly by automating prompt preparation.
✓ Eliminates human errors from manual copying and editing.
✓ Produces fully completed, project-specific AI prompts on demand.
✓ Integrates easily with GitHub and AI services like Langchain or Ollama.
✓ Allows customization and logging for workflow control.
➔ You get accurate, ready-to-use prompts every time.
➔ You reduce manual work and get consistent AI outputs.
➔ You can deploy this workflow quickly inside n8n using import.
