home / skills / lookatitude / beluga-ai / create_package
/.agent/skills/create_package
This skill guides you to create a standardized Go package in Beluga AI, including structure, interfaces, metrics, and validation.
npx playbooks add skill lookatitude/beluga-ai --skill create_packageReview the files below or copy the command above to add this skill to your agents.
---
name: Create New Package
description: Guide to creating a new standardized package in Beluga AI.
---
# Create New Package
This skill ensures your new package follows the strict Beluga AI architecture.
## Steps
1. **Create Directory Structure**
```bash
mkdir -p pkg/<package_name>/{iface,internal,providers}
```
2. **Create Required Files**
- `pkg/<package_name>/<package_name>.go`: Main entry point / interfaces.
- `pkg/<package_name>/config.go`: Configuration structs and validation.
- `pkg/<package_name>/metrics.go`: OTEL metrics setup.
- `pkg/<package_name>/errors.go`: Custom error definitions.
- `pkg/<package_name>/test_utils.go`: Test helpers and mocks.
3. **Define Interfaces**
- Place primary interfaces in `iface/` or the root package file.
4. **Implement OTEL Metrics**
- In `metrics.go`, define `NewMetrics(meter)`.
- Create counters/histograms for operations.
5. **Add Documentation**
- Create `pkg/<package_name>/README.md`.
## Validation
- Run `make lint` to ensure no linting errors.
- Run `go test ./pkg/<package_name>/...` to verify tests.
This skill guides you through creating a new standardized Go package that conforms to Beluga AI architecture. It explains the required directory layout, mandatory files, and validation steps so new packages are consistent, testable, and observable. Follow the checklist to reduce integration friction and maintain code quality.
The guide prescribes a directory layout under pkg/<package_name> with iface, internal, and providers subpackages and a set of required files (entry point, config, metrics, errors, test helpers). It also details implementing OTEL metrics, defining interfaces, adding documentation, and running linting and tests to validate the new package. The result is a package ready for integration with the rest of the system.
Where should I place package-level interfaces?
Put primary interfaces in the iface/ subpackage or the package root file so consumers depend on abstractions, not implementations.
What metrics should I create in metrics.go?
Create counters for operation counts and histograms for latencies. Expose NewMetrics(meter) to wire them into the global OTEL meter.