- Home
- Skills
- Lookatitude
- Beluga Ai
- Design Component
design_component_skill
- Go
5
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill lookatitude/beluga-ai --skill design_component- SKILL.md6.3 KB
Overview
This skill guides designing a new Go component using SOLID principles (ISP, DIP, SRP) and pragmatic patterns for configuration, error handling, and observability. It produces a concise design spec, interface set, dependency plan, and checklist to ensure maintainable, testable components. The guidance fits layered architectures and favors constructor injection and small focused interfaces.
How this skill works
The skill walks you through defining purpose, responsibilities, non-responsibilities, and the architecture layer for the component. It prescribes segregated interfaces, dependency inversion via interface types and constructor injection, validated configuration with defaults and functional options, structured error types, OTEL-ready observability, and extension points such as provider registries. It outputs a ready-to-use design document and checklist.
When to use it
- When creating a new service or library component in a layered Go codebase
- When refactoring a monolithic interface into smaller, testable interfaces
- When needing a clear dependency graph and constructor-based wiring
- When adding configuration, metrics, or tracing to a component
- When planning multiple implementations or a plugin/provider model
Best practices
- Keep interfaces narrow; prefer single-method -er interfaces for behavior
- Depend on interfaces not concrete types; inject via constructors
- Validate and provide sensible defaults for Config structs
- Return context.Context as the first parameter and error last
- Define structured error codes and attach operation context
- Plan OTEL metrics and tracing spans early, expose hooks for logging/metrics
Example use cases
- Designing a storage adapter with Reader/Writer/Lister/Watcher small interfaces
- Implementing an Agent that depends on an LLMCaller interface instead of a vendor SDK
- Building a retriever component with configuration, retries, and observability
- Creating a provider registry to support multiple backend implementations
- Refactoring a large component into single-responsibility pieces with clear boundaries
FAQ
Group methods by cohesive behavior; prefer many small interfaces over one large god interface and name single-method ones with -er suffix when appropriate.
When is a provider registry appropriate?
Use a registry when you expect multiple implementations selectable at runtime or via configuration, and keep the registry concurrency-safe and minimal.