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 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


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


Context is Key: Solving LLM Memory Loss in Coding Sessions with the Claude-mem Agent

Here is a friendly, detailed explanation from a software engineer's perspective on how this tool can be beneficial, how to implement it


From Prompting to Pipelines: Upgrading Human Productivity with Fabric

Think of this not just as a collection of scripts, but as a "second brain" architecture. For engineers, it’s about moving away from "chatting with a bot" and moving toward "building a pipeline for your life


Building AI Agents with Koog: A Software Engineer's Guide

From a software engineer's perspective, Koog is particularly valuable because it solves some of the most common and complex challenges in building AI-powered applications


Your AI Toolkit: Getting Started with the Microsoft AI-For-Beginners Curriculum

Even if you're not an AI specialist, understanding these concepts is becoming increasingly important. The AI for Beginners curriculum helps you


How Flyde Bridges the Gap Between Code and Collaboration

Let's dive into Flyde, a fascinating open-source tool that's been gaining a lot of traction. As a software engineer, I'm always on the lookout for tools that make our lives easier and our teams more collaborative