You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`new(expr)` is available in Go 1.26. The return type is `*T` where `T` is the type of the expression. Use it when it improves clarity for optional scalar pointer values. Do not force it where `&T{...}` or a plain local variable is clearer.
22
+
23
+
## Iterators (1.23+)
24
+
25
+
Use `iter.Seq`/`iter.Seq2` and range-over-func. Prefer stdlib iterator APIs:
Detailed conventions that complement `CLAUDE.md`. The go-rig skill owns process discipline (ATDD/TDD, DI, review workflow). This file owns language-specific patterns and API conventions.
9
+
10
+
## Style
11
+
12
+
- Package names: short, lowercase, no `util`/`common`/`helpers`
Copy file name to clipboardExpand all lines: .claude/skills/go-rig/SKILL.md
+47-51Lines changed: 47 additions & 51 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@ name: go-rig
3
3
description: Use this skill when building, reviewing, or refactoring Go code that must follow strict design discipline — ATDD/TDD workflow, explicit dependency injection, package-boundary discipline, and structured code review. Complements CLAUDE.md by focusing on process and design judgment rather than version-specific Go features.
4
4
metadata:
5
5
short-description: Go design, workflow, and review discipline
6
+
slash-command: enabled
6
7
---
7
8
8
9
# Go Rig
@@ -12,10 +13,12 @@ Strict design and testing discipline for Go projects.
12
13
This skill **complements**`CLAUDE.md`.
13
14
14
15
`CLAUDE.md` owns:
15
-
- Go version and toolchain guidance
16
-
- stdlib and language idioms
17
-
- testing APIs and tooling commands
18
-
- modernization guidance such as `go fix`
16
+
- Go version, toolchain, and commands
17
+
- Key style, error, context, and concurrency rules
18
+
19
+
`.claude/rules/` owns:
20
+
- Go 1.26 idioms and go fix modernizer catalog (`go-idioms.md`)
21
+
- Detailed style, API, documentation, and testing patterns (`go-patterns.md`)
19
22
20
23
This skill adds:
21
24
- ATDD/TDD workflow
@@ -28,6 +31,16 @@ This skill adds:
28
31
29
32
Do not restate or override version-specific guidance from `CLAUDE.md`. If `CLAUDE.md` is stricter on a shared point, follow `CLAUDE.md`.
30
33
34
+
## When to Use
35
+
36
+
Use this skill when:
37
+
38
+
- implementing a new feature or behavior increment
39
+
- refactoring Go code for clearer ownership or testability
40
+
- reviewing package boundaries or dependency flow
41
+
- replacing hidden collaborator construction with explicit injection
42
+
- tightening tests around user-visible or integration behavior
43
+
31
44
## ATDD/TDD Workflow
32
45
33
46
Test-first is a design tool, not an afterthought.
@@ -81,7 +94,6 @@ When applying SRP/DRY/OCP in Go, prefer deleting duplication caused by mixed res
81
94
- If an abstraction adds files, wiring, and names but no clear testability or ownership win, do not add it
82
95
83
96
Avoid:
84
-
- interface-per-struct
85
97
- repositories or services that only forward calls
86
98
- configuration objects passed everywhere to avoid choosing explicit parameters
87
99
- “future-proofing” abstractions without a concrete second implementation or consumer
@@ -90,9 +102,7 @@ Avoid:
90
102
91
103
- A function should usually do one thing: validate, transform, orchestrate, persist, or render
92
104
- If a function mixes business rules with transport, storage, or logging details, split it
93
-
- Prefer early returns over nested condition pyramids
94
105
- Keep parameter lists explicit and intention-revealing; if many values travel together for one reason, introduce a small typed struct
95
-
- Use whitespace to separate logical phases so the control flow reads top to bottom
96
106
97
107
Refactor when a function:
98
108
- needs comments to explain the control flow
@@ -105,26 +115,8 @@ Refactor when a function:
105
115
-**Constructors** for types that must enforce invariants or own long-lived collaborators
106
116
-**Function parameters** for short-lived collaborators and pure logic
107
117
- Never construct DB clients, HTTP clients, loggers, or repositories inside domain methods
108
-
- No DI frameworks — explicit wiring only
109
-
- No hidden globals or singletons
110
118
- Prefer passing dependencies from the composition root (`main`, wiring package, or test setup) instead of looking them up deep inside the call stack
111
119
- Inject seams for time, randomness, process execution, filesystem, and external I/O when behavior depends on them
112
-
- Do not hide dependencies behind package-level variables except in rare compatibility shims
-`internal/platform/` catch-all layers — keep cross-cutting concerns in focused packages
142
133
- packages that combine unrelated domains because they share a datastore or transport
143
-
- "shared" packages that centralize unrelated helpers and create import gravity
144
134
145
135
## Hardcoding And Configuration
146
136
@@ -204,32 +194,38 @@ Treat linting and static analysis as design feedback, not cosmetic cleanup.
204
194
Before finishing any change, verify:
205
195
206
196
-[ ] Package boundaries are coherent — no cross-domain leaks
207
-
-[ ] No premature abstractions — interfaces have real consumers
208
197
-[ ] Dependencies injected explicitly — no hidden construction
209
-
-[ ] No hardcoded runtime values (URLs, ports, credentials, timeouts)
210
-
-[ ] Types are explicit where they protect domain correctness
211
-
-[ ] Functions are readable in one pass
212
-
-[ ] Functions do not mix unrelated responsibilities
213
-
-[ ] Repeated logic is unified only when it shares the same reason to change
214
-
-[ ] Errors wrapped with useful context (`%w`)
198
+
-[ ] Functions are readable in one pass and do not mix unrelated responsibilities
215
199
-[ ] Tests cover acceptance behavior and unit behavior
216
200
-[ ] TDD/ATDD flow was followed as closely as the repo constraints allowed
217
201
-[ ] Behavioral compatibility checked where public APIs, JSON, or persistence shape changed
218
202
-[ ] Nil vs empty behavior is intentional for slices, maps, pointers, and JSON fields
219
203
-[ ] Concurrency changes have a shutdown path and observable ownership
220
-
-[ ] Exported docs and package docs were updated when public behavior changed
221
-
-[ ] Tests are robust against irrelevant formatting churn
222
-
-[ ] Version/tooling guidance from `CLAUDE.md` has been followed
223
-
-[ ] Lint and test gates expected by the repo have been run or consciously deferred
224
-
225
-
## Reject These Patterns
226
-
227
-
- Interface-per-struct without consumer need
228
-
- Giant functions mixing validation, orchestration, and persistence
229
-
- Hardcoded configuration or collaborator selection
230
-
- Weakly typed domain data kept as raw maps or generic blobs without need
231
-
- Comments that restate code
232
-
- Brittle mock-only tests — prefer fakes with real behavior
233
-
- Transport concerns embedded in core domain logic
234
-
- Production design distorted to satisfy a mocking framework
235
-
- Refactors that add indirection without improving correctness, ownership, or testability
204
+
-[ ] Root-package wrappers added/updated for any new `internal/` exports
205
+
-[ ] Lint and test gates (`make check`) have been run or consciously deferred
206
+
207
+
## Project-Specific: Root-Package Facade
208
+
209
+
This project uses a facade pattern where the root `dashboard` package re-exports `internal/` APIs via thin wrappers and type aliases.
210
+
211
+
When adding a new feature:
212
+
1. Implement logic in `internal/app<domain>/` with exported names
213
+
2. Add type aliases (`type X = appfoo.X`) and wrapper functions in the root package
214
+
3. Write tests at both the internal package level (unit) and root level (integration)
215
+
216
+
When modifying an existing internal API:
217
+
- If the signature changes, update the corresponding root-level wrapper
218
+
- Root-level wrappers must remain zero-logic forwarding — no business logic in the facade
219
+
220
+
Legacy note: `CollectTokenUsage` and `CollectTokenUsageWithCache` have 15+ map parameters. New code should use options structs per CLAUDE.md convention. These functions are candidates for future refactoring but are not blocking.
221
+
222
+
## Success Criteria
223
+
224
+
This skill is being followed correctly when:
225
+
226
+
- changes are small, test-backed, and easy to review
227
+
- dependency flow is explicit from the composition root
228
+
- package responsibilities are cleaner after the change, not blurrier
229
+
- the implementation follows the Go standards in `CLAUDE.md`
230
+
- tests speak in behavior terms, not implementation vocabulary
231
+
- the resulting code reads clearly without comments explaining the control flow
description: Use this skill when editing the embedded dashboard frontend in this repository. It focuses on preserving the single-file embedded SPA model, keeping the UI lightweight, and avoiding unnecessary frontend tooling or dependencies.
4
+
---
5
+
6
+
# Frontend Dashboard
7
+
8
+
This is the native Codex frontend skill for the embedded dashboard UI in this repository.
9
+
10
+
Use it when:
11
+
- editing `web/index.html`
12
+
- changing dashboard layout, styling, or interaction behavior
13
+
- improving usability of the embedded SPA
14
+
15
+
## Repository Constraints
16
+
17
+
- The frontend is embedded into the Go binary.
18
+
- Keep the frontend simple and self-contained.
19
+
- Avoid introducing new frontend build systems, frameworks, or third-party packages unless explicitly requested.
20
+
- Preserve compatibility with the Go server contract and embedded asset flow.
21
+
22
+
## UI Direction
23
+
24
+
- Prefer clear information hierarchy over visual noise.
25
+
- Keep interactions fast and obvious.
26
+
- Improve readability of metrics, status, and operational data first.
27
+
- Use intentional spacing, typography, and contrast.
28
+
- Favor small, maintainable JS and CSS over abstraction-heavy patterns.
29
+
30
+
## Change Discipline
31
+
32
+
- Do not turn the SPA into a toolchain-driven frontend without explicit approval.
33
+
- Keep API assumptions explicit.
34
+
- Treat data-shape changes between backend and frontend as contract changes.
35
+
- When in doubt, optimize for operability and clarity instead of novelty.
description: Use this skill when the task is to review Go code in this repository. Focus on bugs, regressions, API compatibility, test gaps, concurrency risks, and violations of the zero-dependency and root-facade constraints.
4
+
---
5
+
6
+
# Go Review
7
+
8
+
This is the native Codex review skill for Go work in this repository.
9
+
10
+
Use it when:
11
+
- the user asks for a review
12
+
- the task is to validate a Go change
13
+
- the task is to assess risks before or after a refactor
14
+
15
+
## Review Priorities
16
+
17
+
Report findings first.
18
+
Prioritize:
19
+
- correctness bugs
20
+
- behavioral regressions
21
+
- API and JSON compatibility changes
22
+
- missing or weak tests
23
+
- concurrency and shutdown risks
24
+
- dependency policy violations
25
+
- facade leakage from root package into domain logic
26
+
27
+
## Repository-Specific Checks
28
+
29
+
- Root package wrappers must stay zero-logic.
30
+
- New behavior belongs in `internal/app<domain>/`.
31
+
- Do not assume third-party helpers are acceptable in this zero-dependency repo.
32
+
- Treat `json:",omitempty"` and `json:",omitzero"` changes as API behavior changes.
33
+
- Check that goroutines have shutdown and ownership semantics.
34
+
35
+
## Review Output
36
+
37
+
- Lead with concrete findings.
38
+
- Use file references.
39
+
- Keep summaries brief.
40
+
- If there are no findings, say that explicitly and mention residual risk or testing gaps.
0 commit comments