A fast, zero-dependency CLI tool (written in Go) that compiles .spec.promptc files into a single instructions.promptc output. Stop copy-pasting instructions between projects and tools.
As developers using AI coding assistants, we face a few recurring problems:
- Scattered instructions: The same guidance gets duplicated across repos and tool-specific files.
- No reusability: Common patterns such as REST APIs, testing, and security are copied by hand.
- Inconsistency: Instructions drift between projects over time.
- No composition: It is hard to build on shared prompt libraries.
promptc gives you a simple compiler flow:
- Write instructions once in
.spec.promptc - Import reusable prompt libraries
- Compile to a single model-agnostic
instructions.promptc - Optionally run
promptc buildto fetch resources and execute an agent in a sandbox
[Reusable Prompt Libraries] + [Project Spec] → Compiler → instructions.promptc
curl -fsSL https://raw.githubusercontent.com/Geogboe/promptc/main/install.sh | shInstalls to /usr/local/bin if writable, otherwise ~/.local/bin. Override with PROMPTC_INSTALL_DIR.
irm https://raw.githubusercontent.com/Geogboe/promptc/main/install.ps1 | iexInstalls to %USERPROFILE%\.local\bin and adds it to your user PATH automatically. Override with $env:PROMPTC_INSTALL_DIR.
The install scripts resolve published release assets from the GitHub release metadata instead of guessing archive names.
go install github.com/Geogboe/promptc/cmd/promptc@latestDownload the latest release archive for your platform from the releases page.
git clone https://github.com/Geogboe/promptc.git
cd promptc
task build
# Or: go build -o bin/promptc.exe ./cmd/promptcThe examples/ directory is the canonical place to learn promptc through real workflows.
Start with examples/README.md for runnable examples and expected outputs.
promptc init myapp.spec.promptc --template=web-apiimports:
- patterns.rest_api
- constraints.security
context:
language: go
framework: fiber
database: postgresql
features:
- api_endpoint: "User authentication and JWT tokens"
constraints:
- no_hardcoded_secrets
- comprehensive_test_coveragepromptc validate myapp.spec.promptc
promptc compile myapp.spec.promptcPatterns:
patterns.rest_api- REST API best practicespatterns.testing- Testing guidelinespatterns.database- Database design and queriespatterns.async_programming- Async/await patterns
Constraints:
constraints.security- Security best practicesconstraints.code_quality- Code quality standardsconstraints.performance- Performance optimizationconstraints.accessibility- WCAG compliance
Initialize projects with templates:
promptc init myapp.spec.promptc --template=basic # Basic template
promptc init myapp.spec.promptc --template=web-api # Web API template
promptc init myapp.spec.promptc --template=cli-tool # CLI tool templatepromptc validate myapp.spec.promptcpromptc compile myapp.spec.promptc
promptc compile myapp.spec.promptc --output=./output
promptc compile myapp.spec.promptc --debug
promptc compile myapp.spec.promptc --no-validatepromptc build myapp.spec.promptc --dry-run
promptc build myapp.spec.promptcpromptc list
promptc list --verbosepromptc init [name.spec.promptc] --template=<template>Prompts are resolved from multiple locations in order:
- Project-local:
./prompts/in your project - Global:
~/.prompts/in your home directory - Built-in: Embedded in the binary
Exclude specific imports with the ! prefix:
imports:
- patterns.rest_api
- !patterns.rest_api.verbose_loggingCreate your own reusable libraries:
~/.prompts/company/standards.prompt:
# Company Coding Standards
## Code Review
- All PRs require 2 approvals
- Must pass CI/CD pipeline
Use in any project:
imports:
- company.standardsShare prompt libraries across your team:
# Create team prompts repository
mkdir ~/.prompts/team
# Everyone uses the same standards
imports:
- team.api_standardsThe Go rewrite provides significant advantages:
- ✅ Single binary - No Python runtime or dependencies needed
- ✅ Fast startup - Instant compilation (< 10ms for most operations)
- ✅ Cross-platform - Easy distribution for Linux, macOS, Windows
- ✅ Small footprint - ~8MB static binary
- ✅ Embedded resources - Built-in libraries compiled into binary
- Language: Go 1.21+
- Binary Size: ~8MB (static binary)
- Dependencies: Zero runtime dependencies
- Built-in Libraries: Embedded using go:embed
- Performance: Sub-10ms compilation for most operations
- CLI Framework: Cobra
- YAML Parser: gopkg.in/yaml.v3
task build # Build for current platform
task build-all # Build for all platforms
task test # Run tests
task clean # Clean build artifactsgo test ./... # Run all tests
go test -v ./internal/... # Verbose output- Core compilation engine
- Generic
instructions.promptcoutput - Built-in prompt libraries (8 libraries)
- Project templates
- Validation system
- Go rewrite for performance
- Build pipeline with resource fetching and sandboxed agent execution
- Examples directory for real workflows
- Watch mode for auto-recompilation
- Library versioning
- Published library packages
- VSCode extension
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
MIT License - see LICENSE file for details
As AI-assisted development becomes standard, managing instructions across different tools is a growing pain. promptc treats prompts as code:
- Fast & Portable - Single binary, no dependencies
- Version controlled - Track changes to your instructions
- Composable - Build on reusable libraries
- Testable - See exactly what you're sending to the LLM
- Shareable - Collaborate on prompt engineering
Just like we don't copy-paste code between projects, we shouldn't copy-paste prompts. Compile them instead.