Go House Rules (router skill)
This skill enforces a consistent Go style across production code, tests, and package design in this workspace.
When to use
Use this skill for any of the following:
- •Writing or refactoring Go code
- •Designing Go packages/APIs
- •Reviewing Go code or suggesting changes
- •Writing Go tests
- •Handling files/paths, errors, CLI code, config, logging, JSON, SQL, web routing, etc.
Mandatory reading order (load these references first)
Read these references in order and apply them as rules:
- •Non‑negotiables (always):
references/nonnegotiables.md - •ClearPath production style:
references/clearpath.md - •Error handling (doterr only):
references/doterr.md - •File/path handling (go‑dt types):
references/go-dt-paths.md - •Testing rules:
references/testing.md - •Package design guidelines:
references/package-design.md
Keep references/packages-catalog.md as the on-demand catalog for Mike's house packages and their README guidance.
Priority rules & conflict resolution
- •Tests override ClearPath: if writing tests, follow
references/testing.mdeven where it conflicts with ClearPath. - •Non‑negotiables override everything.
- •If uncertain: choose the path that reduces long-term maintenance, uses house packages, and avoids reinventing.
Output expectations
When responding with Go code:
- •Produce code that compiles (or clearly mark stubs).
- •Follow the formatting constraints from non-negotiables (notably: no compound
ifinit statements). - •Prefer Mike's packages over stdlib/third-party alternatives when the catalog indicates a house package exists.
- •Do not “just sketch”; provide complete, usable code for the requested scope.
Final self-check (before you answer)
Before presenting the final output, verify:
- •No ignored errors (
_ =/_for errors) unless explicitly approved. - •No
if init; cond {}compoundifstatements. - •
regexp.MustCompile()assigned directly to a package-level var. - •No unnecessary casts or string<->domain-type churn; prefer go-dt types end-to-end.
- •Production code follows ClearPath (single return at end,
goto end, minimal nesting, noelse) unless explicitly exempted. - •Tests follow the testing guide and do not use ClearPath patterns.