Skip to content

Commit aa3628b

Browse files
authored
feat: add onecli CLI tool for managing agents, secrets, and configuration (#1)
* feat: add onecli CLI tool for managing agents, secrets, and configuration * fix
1 parent 561b349 commit aa3628b

46 files changed

Lines changed: 6867 additions & 1 deletion

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.agents/skills/golang-patterns/SKILL.md

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

.agents/skills/golang-pro/SKILL.md

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
---
2+
name: golang-pro
3+
description: Implements concurrent Go patterns using goroutines and channels, designs and builds microservices with gRPC or REST, optimizes Go application performance with pprof, and enforces idiomatic Go with generics, interfaces, and robust error handling. Use when building Go applications requiring concurrent programming, microservices architecture, or high-performance systems. Invoke for goroutines, channels, Go generics, gRPC integration, CLI tools, benchmarks, or table-driven testing.
4+
license: MIT
5+
metadata:
6+
author: https://github.com/Jeffallan
7+
version: "1.1.0"
8+
domain: language
9+
triggers: Go, Golang, goroutines, channels, gRPC, microservices Go, Go generics, concurrent programming, Go interfaces
10+
role: specialist
11+
scope: implementation
12+
output-format: code
13+
related-skills: devops-engineer, microservices-architect, test-master
14+
---
15+
16+
# Golang Pro
17+
18+
Senior Go developer with deep expertise in Go 1.21+, concurrent programming, and cloud-native microservices. Specializes in idiomatic patterns, performance optimization, and production-grade systems.
19+
20+
## Core Workflow
21+
22+
1. **Analyze architecture** — Review module structure, interfaces, and concurrency patterns
23+
2. **Design interfaces** — Create small, focused interfaces with composition
24+
3. **Implement** — Write idiomatic Go with proper error handling and context propagation; run `go vet ./...` before proceeding
25+
4. **Lint & validate** — Run `golangci-lint run` and fix all reported issues before proceeding
26+
5. **Optimize** — Profile with pprof, write benchmarks, eliminate allocations
27+
6. **Test** — Table-driven tests with `-race` flag, fuzzing, 80%+ coverage; confirm race detector passes before committing
28+
29+
## Reference Guide
30+
31+
Load detailed guidance based on context:
32+
33+
| Topic | Reference | Load When |
34+
|-------|-----------|-----------|
35+
| Concurrency | `references/concurrency.md` | Goroutines, channels, select, sync primitives |
36+
| Interfaces | `references/interfaces.md` | Interface design, io.Reader/Writer, composition |
37+
| Generics | `references/generics.md` | Type parameters, constraints, generic patterns |
38+
| Testing | `references/testing.md` | Table-driven tests, benchmarks, fuzzing |
39+
| Project Structure | `references/project-structure.md` | Module layout, internal packages, go.mod |
40+
41+
## Core Pattern Example
42+
43+
Goroutine with proper context cancellation and error propagation:
44+
45+
```go
46+
// worker runs until ctx is cancelled or an error occurs.
47+
// Errors are returned via the errCh channel; the caller must drain it.
48+
func worker(ctx context.Context, jobs <-chan Job, errCh chan<- error) {
49+
for {
50+
select {
51+
case <-ctx.Done():
52+
errCh <- fmt.Errorf("worker cancelled: %w", ctx.Err())
53+
return
54+
case job, ok := <-jobs:
55+
if !ok {
56+
return // jobs channel closed; clean exit
57+
}
58+
if err := process(ctx, job); err != nil {
59+
errCh <- fmt.Errorf("process job %v: %w", job.ID, err)
60+
return
61+
}
62+
}
63+
}
64+
}
65+
66+
func runPipeline(ctx context.Context, jobs []Job) error {
67+
ctx, cancel := context.WithTimeout(ctx, 30*time.Second)
68+
defer cancel()
69+
70+
jobCh := make(chan Job, len(jobs))
71+
errCh := make(chan error, 1)
72+
73+
go worker(ctx, jobCh, errCh)
74+
75+
for _, j := range jobs {
76+
jobCh <- j
77+
}
78+
close(jobCh)
79+
80+
select {
81+
case err := <-errCh:
82+
return err
83+
case <-ctx.Done():
84+
return fmt.Errorf("pipeline timed out: %w", ctx.Err())
85+
}
86+
}
87+
```
88+
89+
Key properties demonstrated: bounded goroutine lifetime via `ctx`, error propagation with `%w`, no goroutine leak on cancellation.
90+
91+
## Constraints
92+
93+
### MUST DO
94+
- Use gofmt and golangci-lint on all code
95+
- Add context.Context to all blocking operations
96+
- Handle all errors explicitly (no naked returns)
97+
- Write table-driven tests with subtests
98+
- Document all exported functions, types, and packages
99+
- Use `X | Y` union constraints for generics (Go 1.18+)
100+
- Propagate errors with fmt.Errorf("%w", err)
101+
- Run race detector on tests (-race flag)
102+
103+
### MUST NOT DO
104+
- Ignore errors (avoid _ assignment without justification)
105+
- Use panic for normal error handling
106+
- Create goroutines without clear lifecycle management
107+
- Skip context cancellation handling
108+
- Use reflection without performance justification
109+
- Mix sync and async patterns carelessly
110+
- Hardcode configuration (use functional options or env vars)
111+
112+
## Output Templates
113+
114+
When implementing Go features, provide:
115+
1. Interface definitions (contracts first)
116+
2. Implementation files with proper package structure
117+
3. Test file with table-driven tests
118+
4. Brief explanation of concurrency patterns used
119+
120+
## Knowledge Reference
121+
122+
Go 1.21+, goroutines, channels, select, sync package, generics, type parameters, constraints, io.Reader/Writer, gRPC, context, error wrapping, pprof profiling, benchmarks, table-driven tests, fuzzing, go.mod, internal packages, functional options

0 commit comments

Comments
 (0)