Thank you for your interest in contributing to PromptCache! This guide will help you get started.
- Be respectful and inclusive
- Focus on constructive feedback
- Help others learn and grow
Before creating a bug report:
- Check existing issues to avoid duplicates
- Use the latest version to verify the bug still exists
Include in your bug report:
- Clear description of the issue
- Steps to reproduce
- Expected vs actual behavior
- Environment details (OS, Go version, provider used)
- Relevant logs or error messages
Feature requests are welcome! Please:
- Check existing issues/roadmap first
- Clearly describe the use case
- Explain why it benefits the project
- Be open to discussion and feedback
- Fork and clone the repository
- Create a branch from
main:git checkout -b feature/your-feature-name
# Install dependencies
go mod download
# Run tests
make test
# Run with your changes
make run-
Write clear, idiomatic Go code
- Follow Go conventions and best practices
- Keep functions small and focused
- Use meaningful variable names
-
Add tests for new features
# Run tests go test ./... # Run specific package tests go test ./internal/semantic/ # Run with coverage go test -cover ./...
-
Update documentation
- Update README.md if needed
- Add/update code comments
- Update docs/ if user-facing changes
-
Run benchmarks (for performance-related changes)
make benchmark
- Use
gofmtto format your code - Run
go vetto catch common issues - Keep lines under 120 characters when reasonable
- Write clear commit messages
Follow conventional commits format:
type(scope): brief description
Longer explanation if needed.
Fixes #123
Types:
feat: New featurefix: Bug fixdocs: Documentation changestest: Test additions/changesrefactor: Code refactoringperf: Performance improvementschore: Maintenance tasks
Examples:
feat(semantic): add support for Gemini provider
fix(cache): resolve race condition in concurrent access
docs(api): update provider configuration examples
test(semantic): add benchmark for FindSimilar
- Push your branch to your fork
- Create a pull request against
main - Fill out the PR template completely
- Link related issues using "Fixes #123" or "Relates to #456"
Your PR should:
- Pass all tests
- Include tests for new functionality
- Update relevant documentation
- Have a clear description of changes
- Address reviewer feedback promptly
prompt-cache/
├── cmd/api/ # Main application entry point
├── internal/
│ ├── cache/ # Cache logic
│ ├── semantic/ # Semantic similarity & providers
│ └── storage/ # Storage backends
├── docs/ # Documentation
└── scripts/ # Utility scripts
To add a new embedding/LLM provider:
-
Create provider file in
internal/semantic/:// newprovider_provider.go package semantic type NewProviderProvider struct { apiKey string } func (p *NewProviderProvider) Embed(text string) ([]float64, error) { // Implementation } func (p *NewProviderProvider) CheckSimilarity(prompt1, prompt2 string) (bool, error) { // Implementation }
-
Update provider factory in
semantic.go:case "newprovider": return &NewProviderProvider{apiKey: apiKey}, nil
-
Add tests in
provider_test.go -
Update documentation:
- docs/providers.md
- README.md
- docker-compose.yml
- Write unit tests for all new functions
- Use table-driven tests for multiple scenarios
- Mock external API calls in tests
- Aim for >80% code coverage
- Test edge cases and error conditions
Example test structure:
func TestNewFeature(t *testing.T) {
tests := []struct {
name string
input string
want string
wantErr bool
}{
{"valid input", "test", "expected", false},
{"invalid input", "", "", true},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := NewFeature(tt.input)
if (err != nil) != tt.wantErr {
t.Errorf("NewFeature() error = %v, wantErr %v", err, tt.wantErr)
return
}
if got != tt.want {
t.Errorf("NewFeature() = %v, want %v", got, tt.want)
}
})
}
}- Benchmark performance-critical code
- Avoid unnecessary allocations
- Use proper concurrency patterns
- Consider cache implications
- Profile before optimizing
Documentation lives in docs/ directory:
# Test docs locally
cd docs
bundle install
bundle exec jekyll serve
# Visit http://localhost:4000/prompt-cache- Use clear, concise language
- Include code examples
- Add comments for complex logic
- Keep README.md up to date
- Update CHANGELOG.md for releases
Maintainers handle releases, but contributors should:
- Update CHANGELOG.md with changes
- Update version numbers if applicable
- Ensure all tests pass
- Update documentation
- Questions? Open a discussion or issue
- Stuck? Ask for help in your PR
- Ideas? We love to hear them!
By contributing, you agree that your contributions will be licensed under the MIT License.
Every contribution helps make PromptCache better. We appreciate your time and effort! 🚀