📦 PackC
PromptPack Compiler - Package and optimize prompts for production
What is PackC?
PackC is a compiler that helps you:
- Compile prompts from YAML/JSON into optimized
.pack.jsonfiles - Validate structure to ensure schema compliance
- Optimize for production with minification and preprocessing
- Version and package prompts for distribution
- Integrate with CI/CD for automated builds
Quick Start
# Install PromptKit (includes PackC)
brew install promptkit
# Or with Go
go install github.com/AltairaLabs/PromptKit/tools/packc@latest
# Create a prompt source file
cat > my-prompt.yaml <<EOF
name: "my-app"
version: "1.0.0"
prompts:
- id: "greeting"
system: "You are helpful."
template: "Greet the user."
EOF
# Compile the pack
packc compile my-prompt.yaml --output my-app.pack.json
# Validate the result
packc validate my-app.pack.json
Next: Your First Compilation Tutorial
Documentation by Type
📚 Tutorials (Learn by Doing)
Step-by-step guides for learning PackC:
- First Compilation - Compile in 5 minutes
- CI/CD Pipeline - Automate pack builds
🔧 How-To Guides (Accomplish Specific Tasks)
Focused guides for specific PackC tasks:
- Installation - Get PackC running
- Compile Packs - Compilation options
- Validate Packs - Validation strategies
- Optimize Packs - Size and performance
- Automate Builds - CI/CD integration
💡 Explanation (Understand the Concepts)
Deep dives into PackC design:
- Why Compile? - Benefits of compilation
- Pack Format - Understanding .pack.json
- Optimization - How optimization works
📖 Reference (Look Up Details)
Complete command and format specifications:
- CLI Commands - All PackC commands
- Pack Specification - Schema definition
- Compiler Options - Configuration flags
Key Features
Compilation
Transform YAML/JSON prompts into optimized packs:
packc compile prompts/my-app.yaml \
--output dist/my-app.pack.json \
--optimize \
--version 1.0.0
Validation
Ensure pack integrity:
packc validate my-app.pack.json --strict
Checks:
- ✅ Schema compliance
- ✅ Required fields present
- ✅ Template syntax valid
- ✅ Metadata complete
Optimization
Production-ready output:
packc compile prompts/*.yaml --optimize
- Minify JSON output
- Remove comments and whitespace
- Validate templates
- Check for common errors
CI/CD Integration
Automate pack builds:
# GitHub Actions
- name: Build Packs
run: packc compile prompts/*.yaml --output-dir dist/
Use Cases
For DevOps Engineers
- Package prompts for deployment
- Version and distribute packs
- Integrate into build pipelines
- Validate before deployment
For Release Managers
- Create versioned prompt releases
- Track changes between versions
- Ensure quality with validation
- Distribute to teams
For Prompt Engineers
- Package tested prompts
- Share prompts with teams
- Ensure consistency
- Prepare for production
CLI Commands
compile
Compile prompt source files into packs:
packc compile [files...] [options]
Options:
--output, -o- Output file path--output-dir- Output directory for multiple files--optimize- Enable optimization--version- Set pack version--strict- Fail on warnings
validate
Validate pack structure:
packc validate [files...] [options]
Options:
--strict- Fail on warnings--schema-version- Specify schema version--verbose- Detailed output
version
Show PackC version:
packc version
Pack Format
A compiled pack is JSON with this structure:
{
"name": "my-app",
"version": "1.0.0",
"description": "My application prompts",
"prompts": [
{
"id": "greeting",
"system": "You are helpful.",
"template": "Greet the user.",
"variables": [],
"metadata": {}
}
],
"metadata": {
"compiled_at": "2025-11-16T12:00:00Z",
"compiler_version": "1.0.0",
"schema_version": "2.0"
}
}
Integration Examples
Makefile
.PHONY: build-packs
build-packs:
packc compile prompts/*.yaml --output-dir dist/packs/
.PHONY: validate-packs
validate-packs:
packc validate dist/packs/*.pack.json
GitHub Actions
- name: Compile PromptPacks
run: |
packc compile prompts/*.yaml --output-dir dist/
packc validate dist/*.pack.json
Docker
FROM golang:1.22
RUN go install github.com/AltairaLabs/PromptKit/tools/packc@latest
COPY prompts/ /prompts/
RUN packc compile /prompts/*.yaml --output-dir /packs/
Best Practices
Version Management
- Use semantic versioning (MAJOR.MINOR.PATCH)
- Update version on breaking changes
- Keep changelog of prompt changes
Quality Assurance
- Always run validation after compilation
- Use
--strictmode in CI/CD - Test packs before distribution
Build Optimization
- Cache compiler binary in CI
- Compile only changed files
- Use parallel builds for large projects
Getting Help
- Quick Start: Getting Started Guide
- Questions: GitHub Discussions
- Issues: Report a Bug
- Examples: PackC Examples
Related Tools
- Arena: Test prompts before compiling
- SDK: Use compiled packs in applications
- Complete Workflow: See all tools together
Was this page helpful?