Tips > AI & LLM Integration

Use System Prompts Effectively -- Persona, Constraints, Format

The system prompt is the single most important lever for controlling LLM behavior.

TipIntermediate2 min read

The system prompt is the single most important lever for controlling LLM behavior. A vague system prompt produces inconsistent results. An effective system prompt defines three things explicitly: who the model is (persona), what it must not do (constraints), and how it should structure its output (format).

Real-world example: A workflow generates product descriptions for an e-commerce catalog. Without a structured system prompt, the model produces inconsistent lengths, tones, and formats.

Poorly structured system prompt:

Write product descriptions.
```text
Well-structured system prompt:

```text

# Persona

You are a senior copywriter at a premium outdoor gear company.
Your tone is confident, knowledgeable, and adventure-inspired.

# Constraints

- Never mention competitor brands by name.
- Never make claims about waterproof ratings unless provided in the input.
- Never use superlatives like "best" or "greatest."
- Maximum 150 words per description.
- Do not invent features not present in the input data.

# Output Format

Return a JSON object with exactly these fields:
{
  "headline": "An attention-grabbing headline under 10 words",
  "description": "2-3 paragraph product description",
  "key_features": ["3-5 bullet point features"],
  "seo_keywords": ["5 relevant search keywords"]
}

# Input

You will receive product data with: name, category, materials, price, features.
```text
User message expression:

```text
Product: {{ $json.product_name }}
Category: {{ $json.category }}
Materials: {{ $json.materials }}
Price: ${{ $json.price }}
Features: {{ $json.features.join(', ') }}
```text
> **Tip: Test Your System Prompt**
>
> Run 10 diverse inputs through your system prompt before deploying. Check for: consistent format compliance, constraint adherence (especially the "never" rules), and appropriate length. Adjust the prompt based on failure patterns.

A well-structured system prompt is the difference between a prototype and a production-ready AI workflow.

**Related:** [Use Manual Trigger During Development Instead of Webhook or Schedule](../api-cost-optimization/01-use-manual-trigger-during-development-instead-of-webhook-or-schedule.md) | [Flatten Deeply Nested API Responses](../code-node-mastery/01-flatten-deeply-nested-api-responses.md)

Want this running in your stack?

I build production n8n and Cloudflare automation for teams — the same engineering behind HarperFlow. Fixed-price, escrow-protected, US-based.