When should you use it?
- An AI step in your workflow sometimes returns extra text, empty results or broken JSON
- You want to publish articles through n8n without a person rebuilding each one
- Model costs in a content workflow are hard to predict
Not for: Publishing straight to a live site with no human review; Topics where facts must be checked by an expert, unless that check is a step in the workflow; One-off articles, which are quicker to write with a chat assistant
What do you need, and what do you get?
You need
- An n8n instance with an AI model credential
- A keyword or topic list and your style rules
- A CMS that accepts drafts through its API
You get
- Separate AI nodes for brief, outline, section drafts and metadata
- Structured JSON from each AI step, checked before use
- Retries, error alerts with a link to the failed run, and draft posts awaiting review
How does it work, step by step?
- Split the jobUse one AI node each for the keyword brief, the outline, the sections (looping over the outline) and the title, description and slug.
- Require a formatTurn on structured output for each chain, attach a parser with the exact fields and length limits, and add an auto-fix parser if the model wraps its JSON.
- Write prompts as specsGive each system prompt a role, a one-sentence task, firm rules and the exact output, and pass earlier results in with expressions.
- Check and retryEnable retry with a pause on AI and HTTP nodes, add an IF check for empty, short or incomplete output, and connect an error workflow that alerts you.
- Publish as draftsSend finished articles to the CMS as drafts and approve them by hand before they go live.
The prompt
Our own prompt, inspired by Amin_Mahmodi and written to work in n8n. Values in lime are placeholders.
Fill in the blanks (optional; the copied prompt uses your values)
You are the {step_name} step in an article workflow for {site}. Task: {one_sentence_task}. Rules: write in {language} for {audience}; paragraphs of at most three sentences; no generic opening; never state a figure that is not in the input. Input from earlier steps: {previous_output}. Return only JSON matching this schema, with no other text: {schema}. If the input is missing something you need, return {"error": "<what is missing>"} instead of guessing.
Inspired by Amin_Mahmodi: n8n Community: prompting AI nodes for reliable output, lessons from a production content pipeline. The prompt above is written by playbooks.bot in our own words; nothing from the original is quoted.
What can go wrong?
- One big prompt for the whole article fails in ways you cannot trace. Keep each node to one job.
- A parser only checks shape, not truth. Add a human review or fact-check step for claims and figures.
- Retries on an HTTP publish step can create duplicate posts. Check for an existing draft before creating one.
- Without token caps, a long section loop can surprise you on cost. Set a maximum per node.
Our take
Mahmodi's main point is one that most people learn the hard way: the prompt is half the job, and the scaffolding that inspects the model's output is the other half. His pipeline treats the model like an unreliable contractor whose work is inspected at every handoff. Each step has a single responsibility, returns a fixed JSON shape with length limits, and is checked before the next node touches it. That makes failures boring and traceable, which is exactly what you want in a workflow that runs unattended. We also like that the cost advice is specific, spending on the strong model only where writing quality matters, and that draft-first publishing keeps a person in the loop. Our additions: a structured parser proves the output has the right fields, not that its claims are true, so add a fact-check pass for figures, and guard the publish step against duplicates when retries fire. In our dry run of our prompt on a fictional tutoring company's keyword, the four steps returned valid JSON, the length check caught a 74-character title, and the retry produced a compliant one.
Where the time goes back: Articles arrive as reviewable drafts instead of broken runs you have to debug, and the checks and alerts mean you only step in when something actually fails.
FAQ
Why so many small AI nodes?
Which model should each step use?
Does it publish automatically?
Source and credit
Inspired by Amin_Mahmodi. We describe the idea in our own words, link to the original, and wrote the prompt ourselves; nothing is quoted.
- Inspired by
- n8n Community: prompting AI nodes for reliable output, lessons from a production content pipeline
- Creator
- Amin_Mahmodi
- Published on
- n8n Community
- Original date
- Nov 4, 2026
- License
- Not openly licensed (the poster keeps all rights), so we quote nothing and link to the original
- Originally for
- n8n
- AI dry run
- Nov 5, 2026: passed. Dry-run tested by our AI test agent on sample input. Valid JSON per step, the length check caught an overlong title and the retry fixed it, and missing input produced an error object rather than a guess.
AI dry run on sample data; not run with live connected accounts. The playbooks.bot test agent filled the prompt with synthetic inputs, produced the output and checked it against the page's stated outputs and guardrails. - Verified
- Nov 5, 2026: source link resolves to the original, the credited creator published it, our excerpt or prompt matches it, and the license allows our use.
Are you the creator? Claim or correct this page.