SkillAgentSearch skills...

PCompiler

A declarative prompt engineering framework that transforms high-level DSL definitions into optimized, model-specific LLM prompts.

Install / Use

/learn @marcosjimenez/PCompiler
About this skill

Quality Score

0/100

Supported Platforms

Zed

README

pCompiler

Python License

pCompiler is a declarative prompt engineering framework that transforms high-level DSL definitions into optimized, model-specific LLM prompts. It bridges the gap between raw text prompting and structured, versioned, and secure prompt management.


🌟 What the project does

pCompiler allows developers to treat prompts as code. By defining prompts in a structured YAML Domain Specific Language (DSL), you can:

  • Generate starting specifications from natural language descriptions.
  • Advanced Templating: Support for Jinja2 in user input templates (loops, conditionals).
  • Validate prompts for ambiguities, contradictions, and security risks.
  • Optimize content for specific LLM backends (OpenAI, Anthropic, Gemini).
  • Estimate Costs before execution with real-time pricing and latency analytics.
  • Automate quality control with built-in evaluation suites.
  • Deploy versioned, reproducible prompt payloads to your applications.

✨ Why pCompiler?

In a world where LLM prompts are increasingly complex and critical to application logic, pCompiler provides the tools to make them robust:

  • Type Safety & Validation: Uses Pydantic to ensure your specifications are always valid.
  • Smart Optimization: Automatically applies semantic compression, Chain-of-Thought policies, and section reordering tailored to each model's strengths.
  • Security by Design: Native protection against prompt injection and system prompt leakage.
  • Collaborative Engineering: Versioned YAML files make it easy for teams to track changes and collaborate via Git.
  • RAG Ready: Built-in support for multiple context sources, including local files, vector stores, and web search.

🚀 How to get started

Installation

# Clone the repository
git clone https://github.com/marcosjimenez/pCompiler.git
cd pCompiler

# Install in editable mode with dev dependencies
pip install -e ".[dev]"

Quick Start

  1. Auto-generate a DSL spec:

    pcompile create "Summarize a medical report focusing on patient history." --output medical.yaml
    
  2. Refine your DSL specification (medical.yaml):

    task: summarize
    model_target: gpt-4o
    constraints:
      tone: professional
      cot_policy: auto
    instructions:
      - text: "Highlight patient history and active medications."
        priority: 100
    
  3. Compile to a model-ready payload:

    pcompile compile medical.yaml --target gpt-4o
    
  4. Run automated evaluations:

    pcompile eval medical.yaml --mock
    

📖 Where to get help

👥 Who maintains & contributes

Maintainer

Contributing

We welcome contributions! Please feel free to open an issue or pull request to suggest improvements or report bugs.


pCompiler — Optimize your prompts, automate your evaluations.

View on GitHub
GitHub Stars8
CategoryProduct
Updated27d ago
Forks0

Languages

Python

Security Score

90/100

Audited on Mar 12, 2026

No findings