← ClaudeAtlas

primitive-obsession-checklistlisted

Use when adding a parameter to an existing Go function or writing a new function signature in stapler-squad, to catch same-typed parameter piles (two or more parameters of the same primitive type representing distinct domain concepts) before they merge — the exact failure mode newtypes like RepoRef/AccountRef exist to prevent.
tstapler/stapler-squad · ★ 1 · AI & Automation · score 64
Install: claude install-skill tstapler/stapler-squad
# Primitive Obsession — Catch Same-Typed Parameter Piles Before They Merge This repo is written almost entirely with Claude Code. LLMs default to long parameter lists of interchangeable primitives (`func f(host, owner, repo, username string)`) instead of bundling related values into a named type. Review every new or migrated function signature against this checklist before merging. ## When to Use This Skill - Before adding a parameter to an existing Go function - Before writing a new Go function whose signature would take two or more parameters of the same primitive type - Reviewing a PR or diff that touches a function signature with multiple `string`/`int`/ `float64` parameters ## The Smell A function takes **two or more parameters of the same underlying type** (`string`, `int`, `float64`) that represent distinct domain concepts and could be silently swapped at a call site with no compiler error. **Wrong:** ```go func GetIssue(ctx context.Context, host, username, owner, repo string, number int) (*Issue, error) // GetIssue(ctx, owner, repo, host, username, number) compiles. Nothing catches the swap. ``` **Right:** ```go func GetIssue(ctx context.Context, account AccountRef, repo RepoRef, number int) (*Issue, error) // AccountRef{Host, Username} and RepoRef{owner, repo} — distinct types, can't be swapped ``` ## The Precedent in This Repo `github/repo_ref.go`'s `RepoRef` (unexported `owner`/`repo` fields, constructed only via `NewRepoRef(owner, repo string) (RepoRe