Concept #76Mediumextended-ai-concepts

Which AI models support pre-defined instructions (system prompts, docs, links)?

#gen-ai#prompt-engineering

Answer

AI Models That Support Predefined Instructions (System Prompts)

System prompts let you give an AI model persistent instructions before any user message.

All Major Models Support System Prompts

ModelProviderHow to Pass System Prompt
ClaudeAnthropic
text
system
parameter in API
GPT-4oOpenAI
text
{"role": "system"}
in messages
Gemini 1.5 ProGoogle
text
system_instruction
parameter
Llama 3.1MetaSystem role in messages array
MistralMistral AISystem role in messages
DeepSeekDeepSeekOpenAI-compatible system role
Command R+Cohere
text
preamble
parameter

Implementation Examples

python
# Anthropic Claude
import anthropic
client = anthropic.Anthropic()

response = client.messages.create(
    model="claude-opus-4-6",
    system="You are a senior Python engineer. Always use type hints and docstrings.",
    messages=[{"role": "user", "content": "Write a function to parse JSON safely"}]
)
python
# OpenAI GPT-4o
from openai import OpenAI
client = OpenAI()

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[
        {"role": "system", "content": "You are a concise technical assistant."},
        {"role": "user", "content": "Explain transformers in 3 lines"}
    ]
)
python
# Google Gemini
import google.generativeai as genai
model = genai.GenerativeModel(
    model_name="gemini-1.5-pro",
    system_instruction="You are a Python expert. Be concise and use type hints."
)
response = model.generate_content("Write a binary search function")

Persistent Instructions via Config Files

Beyond API system prompts, tools support persistent per-project instructions:

ToolConfig FileScope
Claude Code
text
CLAUDE.md
Project directory
Gemini CLI
text
GEMINI.md
Project directory
Cursor
text
.cursorrules
Coding style rules
Aider
text
.aider.conf.yml
Coding conventions

System Prompt Best Practices

  • Define role: "You are a senior backend engineer specializing in FastAPI"
  • Set output format: "Always respond with code examples and type hints"
  • Add constraints: "Never suggest deprecated Python 2 syntax"
  • Include context: "This project uses PostgreSQL 15 and SQLAlchemy 2.0"
  • Keep it under 1000 tokens for most use cases