@baselane/packs 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aliases.js +1 -0
- package/package.json +2 -2
- package/packs/database-review/pack.json +75 -9
- package/packs/database-review/rendered/.claude/agents/database-reviewer.md +75 -2
- package/packs/database-review/rendered/.claude/commands/migration-review.md +6 -0
- package/packs/database-review/rendered/.claude/settings.json +11 -0
- package/packs/database-review/rendered/.claude/skills/database-migrations/SKILL.md +431 -0
- package/packs/database-review/rendered/.claude/skills/mysql-patterns/SKILL.md +414 -0
- package/packs/database-review/rendered/.claude/skills/postgres-patterns/SKILL.md +149 -0
- package/packs/database-review/rendered/.github/copilot-instructions.md +1096 -14
- package/packs/database-review/rendered/AGENTS.md +45 -16
- package/packs/database-review/rendered/CLAUDE.md +4 -0
- package/packs/database-review/rendered/GEMINI.md +987 -0
- package/packs/go-rules/pack.json +65 -9
- package/packs/go-rules/rendered/.claude/agents/go-build-resolver.md +90 -0
- package/packs/go-rules/rendered/.claude/agents/go-reviewer.md +72 -2
- package/packs/go-rules/rendered/.claude/commands/go-build.md +6 -0
- package/packs/go-rules/rendered/.claude/commands/go-review.md +1 -1
- package/packs/go-rules/rendered/.claude/commands/go-test.md +6 -0
- package/packs/go-rules/rendered/.claude/settings.json +9 -0
- package/packs/go-rules/rendered/.claude/skills/golang-patterns/SKILL.md +673 -0
- package/packs/go-rules/rendered/.claude/skills/golang-testing/SKILL.md +719 -0
- package/packs/go-rules/rendered/.github/copilot-instructions.md +1783 -7
- package/packs/go-rules/rendered/AGENTS.md +244 -8
- package/packs/go-rules/rendered/CLAUDE.md +5 -0
- package/packs/go-rules/rendered/GEMINI.md +1394 -0
- package/packs/python-rules/pack.json +87 -10
- package/packs/python-rules/rendered/.claude/agents/django-reviewer.md +159 -0
- package/packs/python-rules/rendered/.claude/agents/fastapi-reviewer.md +70 -0
- package/packs/python-rules/rendered/.claude/agents/python-reviewer.md +92 -2
- package/packs/python-rules/rendered/.claude/commands/django-review.md +6 -0
- package/packs/python-rules/rendered/.claude/commands/fastapi-review.md +6 -0
- package/packs/python-rules/rendered/.claude/commands/python-review.md +1 -1
- package/packs/python-rules/rendered/.claude/settings.json +1 -1
- package/packs/python-rules/rendered/.claude/skills/django-security/SKILL.md +642 -0
- package/packs/python-rules/rendered/.claude/skills/django-tdd/SKILL.md +728 -0
- package/packs/python-rules/rendered/.claude/skills/fastapi-patterns/SKILL.md +512 -0
- package/packs/python-rules/rendered/.claude/skills/python-patterns/SKILL.md +749 -0
- package/packs/python-rules/rendered/.claude/skills/python-testing/SKILL.md +815 -0
- package/packs/python-rules/rendered/.github/copilot-instructions.md +3815 -12
- package/packs/python-rules/rendered/AGENTS.md +73 -13
- package/packs/python-rules/rendered/CLAUDE.md +9 -0
- package/packs/python-rules/rendered/GEMINI.md +3448 -0
- package/packs/security-review/pack.json +51 -7
- package/packs/security-review/rendered/.claude/agents/security-reviewer.md +29 -2
- package/packs/security-review/rendered/.claude/settings.json +11 -0
- package/packs/security-review/rendered/.claude/skills/security-review/SKILL.md +302 -0
- package/packs/security-review/rendered/.claude/skills/security-review/cloud-infrastructure-security.md +171 -0
- package/packs/security-review/rendered/.claude/skills/security-scan-config/SKILL.md +56 -0
- package/packs/security-review/rendered/.github/copilot-instructions.md +658 -15
- package/packs/security-review/rendered/AGENTS.md +283 -17
- package/packs/security-review/rendered/CLAUDE.md +2 -0
- package/packs/security-review/rendered/GEMINI.md +352 -0
- package/packs/software-engineer-harness/pack.json +249 -13
- package/packs/software-engineer-harness/rendered/.claude/agents/code-explorer.md +67 -0
- package/packs/software-engineer-harness/rendered/.claude/agents/performance-optimizer.md +444 -0
- package/packs/software-engineer-harness/rendered/.claude/agents/pr-test-analyzer.md +43 -0
- package/packs/software-engineer-harness/rendered/.claude/commands/feature-dev.md +6 -0
- package/packs/software-engineer-harness/rendered/.claude/settings.json +29 -0
- package/packs/software-engineer-harness/rendered/.claude/skills/api-design/SKILL.md +522 -0
- package/packs/software-engineer-harness/rendered/.claude/skills/architecture-decision-records/SKILL.md +178 -0
- package/packs/software-engineer-harness/rendered/.claude/skills/backend-patterns/SKILL.md +560 -0
- package/packs/software-engineer-harness/rendered/.claude/skills/codebase-onboarding/SKILL.md +232 -0
- package/packs/software-engineer-harness/rendered/.claude/skills/deployment-patterns/SKILL.md +426 -0
- package/packs/software-engineer-harness/rendered/.claude/skills/docker-patterns/SKILL.md +363 -0
- package/packs/software-engineer-harness/rendered/.claude/skills/e2e-testing/SKILL.md +325 -0
- package/packs/software-engineer-harness/rendered/.claude/skills/tdd-workflow/SKILL.md +580 -0
- package/packs/software-engineer-harness/rendered/.github/copilot-instructions.md +3948 -2
- package/packs/software-engineer-harness/rendered/AGENTS.md +194 -4
- package/packs/software-engineer-harness/rendered/CLAUDE.md +20 -0
- package/packs/software-engineer-harness/rendered/GEMINI.md +3208 -0
- package/packs/typescript-rules/pack.json +68 -5
- package/packs/typescript-rules/rendered/.claude/agents/react-reviewer.md +165 -0
- package/packs/typescript-rules/rendered/.claude/agents/type-design-analyzer.md +48 -0
- package/packs/typescript-rules/rendered/.claude/commands/react-review.md +6 -0
- package/packs/typescript-rules/rendered/.claude/settings.json +9 -0
- package/packs/typescript-rules/rendered/.claude/skills/react-patterns/SKILL.md +340 -0
- package/packs/typescript-rules/rendered/.claude/skills/react-performance/SKILL.md +573 -0
- package/packs/typescript-rules/rendered/.claude/skills/react-testing/SKILL.md +422 -0
- package/packs/typescript-rules/rendered/.github/copilot-instructions.md +2459 -53
- package/packs/typescript-rules/rendered/AGENTS.md +893 -17
- package/packs/typescript-rules/rendered/CLAUDE.md +6 -0
- package/packs/typescript-rules/rendered/GEMINI.md +1335 -0
- package/packs/ecc-essentials/pack.json +0 -93
- package/packs/ecc-essentials/rendered/.claude/settings.json +0 -37
- package/packs/ecc-essentials/rendered/.github/copilot-instructions.md +0 -110
- package/packs/ecc-essentials/rendered/AGENTS.md +0 -74
- package/packs/ecc-essentials/rendered/CLAUDE.md +0 -14
- package/packs/ecc-essentials/rendered/GEMINI.md +0 -25
- /package/packs/{ecc-essentials → software-engineer-harness}/rendered/.claude/agents/build-error-resolver.md +0 -0
- /package/packs/{ecc-essentials → software-engineer-harness}/rendered/.claude/agents/refactor-cleaner.md +0 -0
- /package/packs/{ecc-essentials → software-engineer-harness}/rendered/.claude/agents/silent-failure-hunter.md +0 -0
- /package/packs/{ecc-essentials → software-engineer-harness}/rendered/.claude/agents/tdd-guide.md +0 -0
- /package/packs/{ecc-essentials → software-engineer-harness}/rendered/.claude/commands/fix-build.md +0 -0
- /package/packs/{ecc-essentials → software-engineer-harness}/rendered/.claude/commands/hunt-silent-failures.md +0 -0
- /package/packs/{ecc-essentials → software-engineer-harness}/rendered/.claude/commands/tdd.md +0 -0
- /package/packs/{ecc-essentials → software-engineer-harness}/rendered/.claude/skills/tdd-red-green-refactor/SKILL.md +0 -0
|
@@ -1,54 +1,290 @@
|
|
|
1
1
|
# AGENTS.md
|
|
2
2
|
|
|
3
|
-
<!-- generated from workflow-pack go-rules
|
|
3
|
+
<!-- generated from workflow-pack go-rules v2.0.0 -->
|
|
4
4
|
<!-- adapted from affaan-m/ECC (MIT) — https://github.com/affaan-m/ECC -->
|
|
5
5
|
|
|
6
6
|
## Go conventions (beyond what the linter enforces)
|
|
7
7
|
|
|
8
|
-
`gofmt`, `goimports`, and `go vet` already catch formatting and the obvious mistakes — this
|
|
8
|
+
`gofmt`, `goimports`, and `go vet` already catch formatting and the obvious mistakes — this is the judgment they can't encode: API shape, error handling, concurrency safety, interface design, package organization, and the anti-patterns a linter waves through. Keep the mechanical checks in CI (`gofmt -l .`, `go vet ./...`, `go test -race ./...`, `gosec ./...`); the reviewer and skills below cover the rest.
|
|
9
|
+
|
|
10
|
+
### Formatting & tooling
|
|
11
|
+
|
|
12
|
+
- `gofmt` and `goimports` are mandatory — no style debates.
|
|
13
|
+
- Recommended `.golangci.yml`:
|
|
14
|
+
|
|
15
|
+
```yaml
|
|
16
|
+
linters:
|
|
17
|
+
enable:
|
|
18
|
+
- errcheck
|
|
19
|
+
- gosimple
|
|
20
|
+
- govet
|
|
21
|
+
- ineffassign
|
|
22
|
+
- staticcheck
|
|
23
|
+
- unused
|
|
24
|
+
- gofmt
|
|
25
|
+
- goimports
|
|
26
|
+
- misspell
|
|
27
|
+
- unconvert
|
|
28
|
+
- unparam
|
|
29
|
+
|
|
30
|
+
linters-settings:
|
|
31
|
+
errcheck:
|
|
32
|
+
check-type-assertions: true
|
|
33
|
+
govet:
|
|
34
|
+
enable:
|
|
35
|
+
- shadow
|
|
36
|
+
|
|
37
|
+
issues:
|
|
38
|
+
exclude-use-default: false
|
|
39
|
+
```
|
|
9
40
|
|
|
10
41
|
### API shape
|
|
11
42
|
|
|
12
43
|
- Accept interfaces, return structs. Define an interface where it is consumed (1-3 methods), never next to the implementation.
|
|
13
44
|
- Use functional options (`type Option func(*Server)`) for constructors with many optional parameters, not a giant config struct or a long positional list.
|
|
14
45
|
- Inject dependencies through constructors (`NewUserService(repo, logger)`), never package-level globals.
|
|
46
|
+
- Make the zero value useful — design types so their zero value is immediately usable without initialization (e.g. `bytes.Buffer`, a mutex-guarded counter).
|
|
47
|
+
- Context is always the first parameter, never a struct field: `func ProcessRequest(ctx context.Context, id string) error`.
|
|
48
|
+
|
|
49
|
+
```go
|
|
50
|
+
// Functional options
|
|
51
|
+
type Option func(*Server)
|
|
52
|
+
|
|
53
|
+
func WithTimeout(d time.Duration) Option {
|
|
54
|
+
return func(s *Server) { s.timeout = d }
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
func NewServer(addr string, opts ...Option) *Server {
|
|
58
|
+
s := &Server{addr: addr, timeout: 30 * time.Second}
|
|
59
|
+
for _, opt := range opts {
|
|
60
|
+
opt(s)
|
|
61
|
+
}
|
|
62
|
+
return s
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
```go
|
|
67
|
+
// Consumer-defined interface, not provider-defined
|
|
68
|
+
package service
|
|
69
|
+
|
|
70
|
+
type UserStore interface {
|
|
71
|
+
GetUser(id string) (*User, error)
|
|
72
|
+
SaveUser(user *User) error
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
type Service struct{ store UserStore }
|
|
76
|
+
```
|
|
15
77
|
|
|
16
78
|
### Errors
|
|
17
79
|
|
|
18
80
|
- Wrap every propagated error with context and `%w` (`fmt.Errorf("create user: %w", err)`). A bare returned `err` with no origin is a defect, not a shortcut.
|
|
81
|
+
- Never discard an error with `_` unless it is truly best-effort and the reason is commented (`_ = writer.Close() // best-effort cleanup, error logged elsewhere`).
|
|
82
|
+
- Use `errors.Is`/`errors.As` to check sentinel/typed errors, not `==` or type assertions.
|
|
83
|
+
- Define sentinel errors (`var ErrNotFound = errors.New(...)`) or custom error types for domain-specific failures the caller needs to branch on.
|
|
84
|
+
- Never `panic` for a recoverable error — return it.
|
|
85
|
+
|
|
86
|
+
```go
|
|
87
|
+
func LoadConfig(path string) (*Config, error) {
|
|
88
|
+
data, err := os.ReadFile(path)
|
|
89
|
+
if err != nil {
|
|
90
|
+
return nil, fmt.Errorf("load config %s: %w", path, err)
|
|
91
|
+
}
|
|
92
|
+
var cfg Config
|
|
93
|
+
if err := json.Unmarshal(data, &cfg); err != nil {
|
|
94
|
+
return nil, fmt.Errorf("parse config %s: %w", path, err)
|
|
95
|
+
}
|
|
96
|
+
return &cfg, nil
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
func HandleError(err error) {
|
|
100
|
+
if errors.Is(err, sql.ErrNoRows) {
|
|
101
|
+
log.Println("no records found")
|
|
102
|
+
return
|
|
103
|
+
}
|
|
104
|
+
var validationErr *ValidationError
|
|
105
|
+
if errors.As(err, &validationErr) {
|
|
106
|
+
log.Printf("validation error on %s: %s", validationErr.Field, validationErr.Message)
|
|
107
|
+
return
|
|
108
|
+
}
|
|
109
|
+
log.Printf("unexpected error: %v", err)
|
|
110
|
+
}
|
|
111
|
+
```
|
|
19
112
|
|
|
20
113
|
### Concurrency
|
|
21
114
|
|
|
22
115
|
- Thread `context.Context` through call chains for cancellation and timeout (`ctx, cancel := context.WithTimeout(ctx, 5*time.Second)`; `defer cancel()`).
|
|
23
116
|
- Every piece of shared state has an explicit owner — a mutex or a channel — or a comment proving why it is safe. "Probably fine" is a race.
|
|
117
|
+
- Always `defer mu.Unlock()` immediately after `mu.Lock()`; never leave an unlock path implicit.
|
|
118
|
+
- Coordinate goroutines with `sync.WaitGroup` or `golang.org/x/sync/errgroup`; a bare `go func(){...}()` with no join point is a leak waiting to happen.
|
|
119
|
+
- A goroutine that sends on an unbuffered channel with no guaranteed receiver blocks forever if the reader gives up — buffer the channel or `select` on `ctx.Done()`.
|
|
120
|
+
|
|
121
|
+
```go
|
|
122
|
+
func WorkerPool(jobs <-chan Job, results chan<- Result, numWorkers int) {
|
|
123
|
+
var wg sync.WaitGroup
|
|
124
|
+
for i := 0; i < numWorkers; i++ {
|
|
125
|
+
wg.Add(1)
|
|
126
|
+
go func() {
|
|
127
|
+
defer wg.Done()
|
|
128
|
+
for job := range jobs {
|
|
129
|
+
results <- process(job)
|
|
130
|
+
}
|
|
131
|
+
}()
|
|
132
|
+
}
|
|
133
|
+
wg.Wait()
|
|
134
|
+
close(results)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Good: handles cancellation instead of leaking
|
|
138
|
+
func safeFetch(ctx context.Context, url string) <-chan []byte {
|
|
139
|
+
ch := make(chan []byte, 1)
|
|
140
|
+
go func() {
|
|
141
|
+
data, err := fetch(url)
|
|
142
|
+
if err != nil {
|
|
143
|
+
return
|
|
144
|
+
}
|
|
145
|
+
select {
|
|
146
|
+
case ch <- data:
|
|
147
|
+
case <-ctx.Done():
|
|
148
|
+
}
|
|
149
|
+
}()
|
|
150
|
+
return ch
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
```go
|
|
155
|
+
import "golang.org/x/sync/errgroup"
|
|
156
|
+
|
|
157
|
+
func FetchAll(ctx context.Context, urls []string) ([][]byte, error) {
|
|
158
|
+
g, ctx := errgroup.WithContext(ctx)
|
|
159
|
+
results := make([][]byte, len(urls))
|
|
160
|
+
for i, url := range urls {
|
|
161
|
+
i, url := i, url // capture loop variables
|
|
162
|
+
g.Go(func() error {
|
|
163
|
+
data, err := FetchWithTimeout(ctx, url)
|
|
164
|
+
if err != nil {
|
|
165
|
+
return err
|
|
166
|
+
}
|
|
167
|
+
results[i] = data
|
|
168
|
+
return nil
|
|
169
|
+
})
|
|
170
|
+
}
|
|
171
|
+
if err := g.Wait(); err != nil {
|
|
172
|
+
return nil, err
|
|
173
|
+
}
|
|
174
|
+
return results, nil
|
|
175
|
+
}
|
|
176
|
+
```
|
|
24
177
|
|
|
25
|
-
###
|
|
178
|
+
### Interface design
|
|
179
|
+
|
|
180
|
+
- Keep interfaces small (1-3 methods) and compose them (`ReadWriteCloser` from `Reader`+`Writer`+`Closer`), rather than one large interface.
|
|
181
|
+
- Define the interface in the consumer's package, not the provider's — the implementation doesn't need to know the interface exists.
|
|
182
|
+
- Optional behavior can be probed with a type assertion (`if f, ok := w.(Flusher); ok { ... }`) instead of a bloated required interface.
|
|
183
|
+
|
|
184
|
+
### Package organization
|
|
185
|
+
|
|
186
|
+
- Standard layout: `cmd/<app>/main.go` (entry point), `internal/` (handler/service/repository/config), `pkg/` (public client), `api/` (proto/OpenAPI), `testdata/`.
|
|
187
|
+
- Package names: short, lowercase, no underscores, no redundant suffix (`user`, not `userService`).
|
|
188
|
+
- Avoid package-level mutable state (`var db *sql.DB` + `init()`) — inject dependencies through a constructor instead.
|
|
189
|
+
- Prefer embedding for composition (`type Server struct { *Logger; addr string }`) over duplicating methods.
|
|
190
|
+
|
|
191
|
+
### Memory & performance
|
|
192
|
+
|
|
193
|
+
- Preallocate slices when the size is known: `make([]T, 0, len(items))` instead of an unbounded `append` loop.
|
|
194
|
+
- Use `strings.Builder` (or `strings.Join`) instead of `+=` string concatenation in a loop.
|
|
195
|
+
- Use `sync.Pool` for frequently allocated short-lived buffers in hot paths.
|
|
196
|
+
- Avoid unnecessary allocations in hot paths; N+1 query patterns and per-item deferred calls in a loop are red flags too.
|
|
197
|
+
|
|
198
|
+
### Boundaries & secrets
|
|
26
199
|
|
|
27
200
|
- Validate external input at the boundary before it reaches business logic; fail fast with a clear message.
|
|
28
201
|
- Read required secrets from the environment and `log.Fatal` on an empty value at startup — never a silent zero value.
|
|
29
202
|
|
|
30
|
-
|
|
203
|
+
```go
|
|
204
|
+
apiKey := os.Getenv("OPENAI_API_KEY")
|
|
205
|
+
if apiKey == "" {
|
|
206
|
+
log.Fatal("OPENAI_API_KEY not configured")
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Security (flag in review — a linter won't catch these)
|
|
211
|
+
|
|
212
|
+
- SQL injection: string concatenation in `database/sql` queries instead of parameterized placeholders.
|
|
213
|
+
- Command injection: unvalidated input passed into `os/exec`.
|
|
214
|
+
- Path traversal: user-controlled file paths used without `filepath.Clean` + a prefix check.
|
|
215
|
+
- `unsafe` package usage without justification.
|
|
216
|
+
- Hardcoded secrets (API keys, passwords) in source.
|
|
217
|
+
- Insecure TLS (`InsecureSkipVerify: true`).
|
|
218
|
+
- Run `gosec ./...` for static security analysis in CI.
|
|
219
|
+
|
|
220
|
+
### Anti-patterns to flag in review (a linter won't)
|
|
31
221
|
|
|
32
|
-
- A propagated error with no `%w` and no context string
|
|
222
|
+
- A propagated error with no `%w` and no context string, or an error discarded with `_`.
|
|
223
|
+
- `panic` used for a recoverable error instead of an error return.
|
|
33
224
|
- An interface defined beside its implementation instead of its consumer.
|
|
34
225
|
- Shared state touched by multiple goroutines with no mutex/channel and no safety comment.
|
|
35
226
|
- A required env var read without an empty-check before use.
|
|
227
|
+
- Naked returns in long functions, mixed value/pointer receivers on the same type, `context.Context` stored in a struct field instead of passed as the first parameter.
|
|
228
|
+
- Functions over ~50 lines or nested more than 4 levels deep — prefer early return over `if/else` chains.
|
|
229
|
+
|
|
230
|
+
### Testing & tooling
|
|
231
|
+
|
|
232
|
+
- Standard `go test` with **table-driven tests**; always run `go test -race ./...` and check coverage with `go test -cover ./...`. See skill `golang-testing` for the full pattern set (TDD workflow, subtests, benchmarks, fuzzing, golden files, HTTP handler tests).
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
go build ./...
|
|
236
|
+
go vet ./...
|
|
237
|
+
staticcheck ./...
|
|
238
|
+
golangci-lint run
|
|
239
|
+
go test -race ./...
|
|
240
|
+
go test -cover ./...
|
|
241
|
+
gofmt -l .
|
|
242
|
+
goimports -l .
|
|
243
|
+
go mod tidy
|
|
244
|
+
go mod verify
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### Quick reference: Go idioms
|
|
248
|
+
|
|
249
|
+
| Idiom | Description |
|
|
250
|
+
|-------|-------------|
|
|
251
|
+
| Accept interfaces, return structs | Functions accept interface params, return concrete types |
|
|
252
|
+
| Errors are values | Treat errors as first-class values, not exceptions |
|
|
253
|
+
| Don't communicate by sharing memory | Use channels for coordination between goroutines |
|
|
254
|
+
| Make the zero value useful | Types should work without explicit initialization |
|
|
255
|
+
| A little copying is better than a little dependency | Avoid unnecessary external dependencies |
|
|
256
|
+
| Clear is better than clever | Prioritize readability over cleverness |
|
|
257
|
+
| gofmt is no one's favorite but everyone's friend | Always format with gofmt/goimports |
|
|
258
|
+
| Return early | Handle errors first, keep happy path unindented |
|
|
259
|
+
|
|
260
|
+
See skills `golang-patterns` (comprehensive idioms, concurrency, package organization) and `golang-testing` (TDD workflow, table-driven tests, benchmarks, fuzzing) for full worked examples.
|
|
36
261
|
|
|
37
262
|
## Workflow pack: Go rules
|
|
38
263
|
|
|
39
|
-
Go conventions
|
|
264
|
+
Comprehensive Go conventions, reviewer, build-error resolver, and skills covering API shape, errors, concurrency, interfaces, package layout, security, and testing — mechanical checks (gofmt/vet/race) stay in CI.
|
|
40
265
|
|
|
41
266
|
### Roles
|
|
42
267
|
|
|
43
|
-
- **go-reviewer** —
|
|
268
|
+
- **go-reviewer** — Expert Go code reviewer specializing in idiomatic Go, concurrency patterns, error handling, and security. Reports file:line + severity across CRITICAL/HIGH/MEDIUM categories. Use for all Go code changes.
|
|
269
|
+
- **go-build-resolver** — Go build, vet, and compilation error resolution specialist. Fixes build errors, go vet issues, and linter warnings with minimal, surgical changes. Use when Go builds fail.
|
|
44
270
|
|
|
45
271
|
### Commands
|
|
46
272
|
|
|
47
273
|
- **/go-review** `[base ref]` — Run the Go reviewer over the current change against this pack's Go standards.
|
|
48
|
-
- How it runs: Invoke the go-reviewer subagent on the changed Go files (the diff since $ARGUMENTS, or the working tree if no ref is given). It checks this pack's conventions
|
|
274
|
+
- How it runs: Invoke the go-reviewer subagent on the changed Go files (the diff since $ARGUMENTS, or the working tree if no ref is given). It checks this pack's conventions -- consumer-defined interfaces, errors wrapped with %w and context, functional options, context threading, explicitly owned shared state, boundary validation, and fail-fast env-var secrets -- plus the security/concurrency/quality priorities in its CRITICAL/HIGH/MEDIUM rubric, and reports file:line + severity. Formatting itself (gofmt) is CI's job; don't re-litigate it. Fix any Critical or High findings before merging.
|
|
275
|
+
- **/go-build** `(no arguments)` — Fix Go build errors, go vet warnings, and linter issues incrementally with minimal, surgical changes.
|
|
276
|
+
- How it runs: Invoke the go-build-resolver subagent to incrementally fix Go build errors, go vet warnings, and linter issues with minimal, surgical changes. It runs go build/go vet/staticcheck/golangci-lint/go mod verify in order, fixes one error at a time, and re-verifies after each change. It will not refactor beyond the fix or change function signatures unless necessary, and stops to report if the same error persists after 3 attempts or the fix requires an architectural change. Run /go-review after the build is green.
|
|
277
|
+
- **/go-test** `<what to build>` — Enforce TDD workflow for Go: write table-driven tests first, then implement. Verify 80%+ coverage with go test -cover.
|
|
278
|
+
- How it runs: Invoke the go-reviewer subagent to drive a TDD session for $ARGUMENTS: scaffold the function/interface signature first, write comprehensive table-driven tests (RED), verify they fail for the right reason, implement the minimal code to pass (GREEN), then refactor while keeping tests green (REFACTOR). Use go test -race ./... and go test -cover ./... to verify; target 80%+ coverage on general code and 100% on critical business logic. Use /go-build first if the package doesn't compile yet.
|
|
49
279
|
|
|
50
280
|
### Guardrails
|
|
51
281
|
|
|
52
282
|
- After an edit, check Go formatting with gofmt when it is installed.
|
|
283
|
+
- After an edit in a Go module, run gofmt and go vet and flag any issues.
|
|
284
|
+
|
|
285
|
+
### Skills
|
|
286
|
+
|
|
287
|
+
- **golang-patterns** — Idiomatic Go patterns, best practices, and conventions for building robust, efficient, and maintainable Go applications — API shape, error handling, concurrency, interface design, package organization, and performance. Use when writing, reviewing, or refactoring Go code, or designing Go packages/modules.
|
|
288
|
+
- **golang-testing** — Go testing patterns including TDD workflow, table-driven tests, subtests, benchmarks, fuzzing, golden files, HTTP handler testing, mocking with interfaces, and coverage targets. Use when writing new Go functions, adding test coverage, creating benchmarks, or following TDD in a Go project.
|
|
53
289
|
|
|
54
290
|
Tool-specific implementations live alongside this file (see `CLAUDE.md` for the Claude Code implementation). Tools without a native subagent/command surface should treat the sections above as operating instructions.
|
|
@@ -4,5 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
This project defines a native Claude Code implementation of this workflow pack:
|
|
6
6
|
- Subagent: `.claude/agents/go-reviewer.md`
|
|
7
|
+
- Subagent: `.claude/agents/go-build-resolver.md`
|
|
7
8
|
- Command: `.claude/commands/go-review.md`
|
|
9
|
+
- Command: `.claude/commands/go-build.md`
|
|
10
|
+
- Command: `.claude/commands/go-test.md`
|
|
8
11
|
- Hooks: see `.claude/settings.json`
|
|
12
|
+
- Skill: `.claude/skills/golang-patterns/SKILL.md` — Idiomatic Go patterns, best practices, and conventions for building robust, efficient, and maintainable Go applications — API shape, error handling, concurrency, interface design, package organization, and performance. Use when writing, reviewing, or refactoring Go code, or designing Go packages/modules.
|
|
13
|
+
- Skill: `.claude/skills/golang-testing/SKILL.md` — Go testing patterns including TDD workflow, table-driven tests, subtests, benchmarks, fuzzing, golden files, HTTP handler testing, mocking with interfaces, and coverage targets. Use when writing new Go functions, adding test coverage, creating benchmarks, or following TDD in a Go project.
|