From Leak to Logic: Customizing LLM Behavior with System Prompt Insights


From Leak to Logic: Customizing LLM Behavior with System Prompt Insights

asgeirtj/system_prompts_leaks

2025-10-16

This repository is a collection of extracted System Prompts from popular Large Language Models (LLMs) like ChatGPT, Claude, and others.

For a software engineer, this repository is a goldmine for understanding and improving how we interact with LLMs in applications. Here's how it helps

Learning the "Secrets"
System prompts are the "internal rules" that define an LLM's personality, constraints, safety measures, and overall behavior. By seeing the official prompts, you can learn best practices for structuring your own system messages, roles, and instructions.

Reverse Engineering Behavior
If a model behaves in a certain way (e.g., always uses a specific tone, avoids controversial topics), its system prompt is likely the reason. Analyzing these leaked prompts helps you understand why a model performs certain actions, allowing you to design more effective and predictable prompts for your own application's specific needs.

Understanding Vulnerabilities
The primary risk of system prompt leaks is that malicious actors can find "gaps" or "escape routes" to bypass the model's safety and behavioral constraints (i.e., Prompt Injection attacks).

Building Defenses
As a defensive engineer, this repository provides the "attack vector." You can use this knowledge to

Test your own applications against injection attempts that exploit the revealed constraints.

Design more robust prompt sanitization and validation layers before sending user input to the LLM.

Creating Custom LLM Personas
If you're fine-tuning an open-source model or developing an internal one, these prompts serve as expert templates. You can adapt the structure and complexity of the leaked prompts to create highly specific, reliable, and consistent "system rules" for your own AI agents.

Tool Use and API Integration
Many modern system prompts include instructions on how the LLM should use external tools (like a calculator, web search, or a custom API). Seeing how major providers instruct their models on tool-use is invaluable for integrating LLMs into complex software architectures.

Since this is a GitHub repository, the introduction is super straightforward!

Go to the Repository
Navigate to the GitHub page
https://github.com/asgeirtj/system_prompts_leaks.

Clone or Download

Clone (Recommended)
Use git to clone the repository to your local machine

git clone https://github.com/asgeirtj/system_prompts_leaks.git
cd system_prompts_leaks

Download
You can also click the green "Code" button on GitHub and choose "Download ZIP."

Browse the Files
The repository is organized into folders by the AI vendor (e.g., Anthropic, Google, OpenAI). Dive into the Markdown (.md) or text (.txt) files to read the actual leaked system prompts.

You won't directly use the leaked system prompt text in your application. Instead, you'll use the insights gained from them to improve your own code's prompt structure.

Let's imagine you've learned from a leaked prompt that clear instructions on output format are crucial. You'll apply that knowledge to your own new system prompt.

# A hypothetical LLM client library (e.g., OpenAI, Anthropic, or an internal one)

def generate_code_snippet(user_request):
    
    # INSIGHT APPLIED: A strict system prompt ensures a consistent,
    # developer-friendly output format (JSON).
    
    system_prompt = """
    You are an expert Python developer assistant. 
    Your primary function is to generate clean, idiomatic, and documented Python code.
    
    CRITICAL CONSTRAINT: You MUST respond ONLY with a single JSON object.
    The JSON object MUST have two keys:
    1. "title": A short, descriptive title for the code.
    2. "code": The full, runnable Python code snippet, formatted in a markdown code block.
    
    Do not include any conversational text or explanation outside of the JSON structure.
    """
    
    messages = [
        {"role": "system", "content": system_prompt},
        {"role": "user", "content": user_request}
    ]
    
    try:
        # Assume 'llm_client' is initialized elsewhere
        response = llm_client.chat.create(messages=messages, model="your-llm-model")
        
        # Further application logic would parse the guaranteed JSON output
        return response.json_content
        
    except Exception as e:
        print(f"Error during LLM call: {e}")
        return None

# Example usage:
request = "Write a function to calculate the factorial of a number."
result = generate_code_snippet(request)
print(result)

# Expected, structured output based on the strict system prompt:
# {
#   "title": "Factorial Calculation Function",
#   "code": "```python\ndef factorial(n):\n    if n == 0:\n        return 1\n    else:\n        return n * factorial(n-1)\n```"
# }

asgeirtj/system_prompts_leaks




Scale Your Ideas, Not Your Bills: Exploring Free LLM Resources

The repository you mentioned, cheahjs/free-llm-api-resources, is basically a "gold mine" for developers. It’s a curated list of providers that offer free access to Large Language Models (LLMs) via API


Developer's Guide to the AI Cookbook

As software engineers, we're constantly looking for ways to efficiently integrate powerful new technologies into our projects


Building LLM Agents with parlant: A Software Engineer's Guide

Parlant is useful because it addresses common pain points in developing LLM-powered applicationsReal-World Application It's built for practical use cases


Beyond Bug-Fixing: Unleashing Open-SWE for Software Development

Hello! As a software engineer, you're always looking for tools that can automate and streamline your workflow. The langchain-ai/open-swe project


Beyond Static LLMs: How Hermes-Agent Grows With Your Codebase

In the world of LLMs, we often deal with "static" models—they know what they were trained on, and that’s about it. Hermes-Agent is designed to break that mold


Exploring SillyTavern: An LLM Frontend for Software Engineers

SillyTavern is essentially a highly customizable and powerful frontend for Large Language Models (LLMs). Think of it as a specialized web interface that allows power users to interact with various LLMs in a much more nuanced and controlled way than typical chat applications


Implementing DeepChat: Secure Backend Integration for Conversational AI

DeepChat is essentially a highly customizable, open-source chat component designed to connect your application's frontend with various powerful AI models and services (like OpenAI


TT-Metal: Programming Tenstorrent Hardware from a Developer's Perspective

TT-Metal is a software stack designed to program Tenstorrent hardware, which is a new type of AI accelerator. Think of it as the CUDA or ROCm for Tenstorrent's hardware


From RAG to Agents: A Practical Look at awesome-ai-apps for Developers

Think of awesome-ai-apps as a curated gallery of best practices and inspiring examples for building real-world AI applications


Navigating the World of AI and ML Servers with awesome-mcp-servers

Hello there, fellow software engineers!Let's talk about a very useful resource that you might find interesting, especially if you're involved in machine learning