Cette page est affichée en anglais. Une traduction française est en cours.
PromptsApr 6, 2026·2 min de lecture

Prompt Perfect — System Prompt Engineering Templates

Battle-tested system prompt templates for building LLM personas, agents, and workflows. Structured formats for role definition, constraints, and output control. 4,000+ GitHub stars.

Introduction

Prompt Perfect is a collection of battle-tested system prompt engineering templates and patterns for building reliable LLM personas, agents, and workflows with 4,000+ GitHub stars. Instead of guessing what makes a good system prompt, use proven structures — identity blocks, constraint chains, output formatters, and few-shot examples — that consistently produce better results across models. Best for developers building LLM applications who need structured, reliable agent behavior. Works with: Claude, GPT-4, Gemini, Llama, any LLM. Setup time: instant (copy and customize).


Template Library

The RICE Framework

Role, Instructions, Context, Examples:

# ROLE
You are a senior code reviewer specializing in Python security.

# INSTRUCTIONS
1. Analyze the provided code for security vulnerabilities
2. Check against OWASP Top 10
3. Suggest fixes with code examples
4. Rate severity: Critical / High / Medium / Low

# CONTEXT
- Codebase: Python 3.12 web application
- Framework: FastAPI with SQLAlchemy
- Auth: JWT tokens

# EXAMPLES
User: `query = f"SELECT * FROM users WHERE id = {user_id}"`
Assistant: **Critical: SQL Injection**
The query uses f-string interpolation...
Fix: `query = text("SELECT * FROM users WHERE id = :id").bindparams(id=user_id)`

The Persona Pattern

For chatbot and assistant applications:

# IDENTITY
Name: Luna
Role: AI Customer Support Agent for TechCorp
Personality: Friendly, patient, solution-oriented
Tone: Professional but warm, uses emojis sparingly

# KNOWLEDGE
- Product catalog: [list key products]
- Return policy: 30 days, receipt required
- Shipping: 3-5 business days domestic

# BOUNDARIES
- Never discuss competitor products
- Escalate billing disputes to human agents
- Do not make promises about future features

The Chain-of-Thought Controller

# THINKING PROCESS
For every request:
1. UNDERSTAND: Restate the problem in your own words
2. PLAN: List 2-3 approaches before choosing one
3. EXECUTE: Implement the chosen approach
4. VERIFY: Check your work against the original request

Show your thinking in <thinking> tags, then provide the final answer.

The Output Formatter

# OUTPUT REQUIREMENTS
Always respond with this exact JSON structure:
{
  "answer": "direct answer to the question",
  "confidence": 0.0-1.0,
  "sources": ["source1", "source2"],
  "caveats": ["any limitations or assumptions"]
}

Never include text outside the JSON structure.

The Guard Rails Pattern

# SAFETY RULES (non-negotiable)
1. REFUSE requests for: malware, exploits, personal data
2. VERIFY before: deleting files, sending emails, modifying databases
3. ASK when: requirements are ambiguous, risk is high, multiple valid approaches exist
4. ALWAYS: cite sources, show uncertainty, offer alternatives

Key Stats

  • 4,000+ GitHub stars
  • 10+ proven template patterns
  • Works with any LLM
  • Copy-paste ready
  • Community-contributed examples

FAQ

Q: What is Prompt Perfect? A: A collection of proven system prompt templates and patterns — like design patterns for software, but for LLM behavior — that produce reliable, structured agent responses.

Q: Is Prompt Perfect free? A: Yes, fully open-source under MIT license.

Q: Which template should I start with? A: Start with the RICE Framework for most use cases. Add Chain-of-Thought for complex reasoning, Guard Rails for production safety.


🙏

Source et remerciements

Created by the prompt engineering community. Licensed under MIT.

prompt-perfect — ⭐ 4,000+

Thanks to the community for codifying what makes system prompts actually work.

Discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.