Generic Constructor-Pattern agent kit for Claude Code. Zero personal data, fully English, MIT-licensed. Contents: - 34 reusable blocks (baseline, rules, stack/deploy/domain/api/scraper) - 14 cross-project agent manifests (code/ml/infra/researcher/critic/...) - 6 portable skills (/new-agent, /research, /test-gen, /debug-deep, /pr-review, /refactor) - Rust assembler (single binary, ~500 KB) - 3 hooks (auto-reassemble, pre-commit validate, no-hand-edit) - install.sh (idempotent, cargo-builds on first run) - MIT LICENSE All 6 sanity greps pass: 0 Russian text, 0 specific project names, 0 incident numbers, 0 user paths, 0 hardcoded IPs, 0 API keys. cargo check + assemble --validate: both pass on 14 manifests. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
25 lines
1.4 KiB
Markdown
25 lines
1.4 KiB
Markdown
# STACK — Go server
|
|
|
|
Use when the project is Go-locked (existing codebase) or the domain fits — networking daemons, agents, cloud-native tooling.
|
|
|
|
**Modules:** `go.mod` + `go.sum` committed. Go ≥ 1.22 (range-over-func, better `slices`/`maps` stdlib).
|
|
|
|
**HTTP:** prefer `net/http` stdlib + `http.ServeMux` (Go 1.22 pattern matching routes). Add a framework (chi, echo) only when the feature gap is concrete and documented — not "for ergonomics".
|
|
|
|
**Context propagation (non-negotiable):**
|
|
- Every handler, DB call, outbound request takes `ctx context.Context` as FIRST arg.
|
|
- `ctx` threads through stack without interruption — no `context.Background()` mid-call except at the edge.
|
|
- `context.WithTimeout` on every external I/O.
|
|
|
|
**Errors:**
|
|
- Return `error`; sentinels via `errors.Is`, typed via `errors.As`. NEVER `strings.Contains(err.Error(), "...")` — string match breaks on wrapping.
|
|
- Wrap with `%w`: `fmt.Errorf("ctx: %w", err)`.
|
|
|
|
**Concurrency:**
|
|
- `go vet` + `go test -race` MANDATORY in CI.
|
|
- Channels for ownership transfer, mutexes for protecting state — not both on the same data.
|
|
- Goroutines started in handlers must have a clear lifecycle (parent ctx cancellation).
|
|
|
|
**Logging:** `log/slog` (structured). NO `fmt.Println` in prod paths.
|
|
|
|
**Forbidden:** string-match on error messages; goroutine leaks (no ctx cancellation path); `init()` doing I/O; `go test` without `-race`; `panic()` as control flow in library code.
|