From coding-guidelines
Prohibits package-level mutable variables and init() functions for state management in Go, enforcing dependency injection instead. Use when writing or reviewing Go packages that need configuration or shared resources. Do not use for package-level constants or type registrations that are genuinely immutable.
How this skill is triggered — by the user, by Claude, or both
Slash command
/coding-guidelines:avoid-global-state-and-initThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Avoid using package-level variables (Globals) for application state (like Database connections, Configs, Loggers) and avoid `init()` functions for side-effects. Instead, use **Dependency Injection**: pass dependencies explicitly to your structs or functions (controllers/handlers).
Avoid using package-level variables (Globals) for application state (like Database connections, Configs, Loggers) and avoid init() functions for side-effects. Instead, use Dependency Injection: pass dependencies explicitly to your structs or functions (controllers/handlers).
init() execution order can be subtle and hard to debug. Explicit wiring (main.go) is predictable.var db *sql.DB at package level.func init() { config.Load() }.main.go.var db *sql.DB
func init() {
db = connect() // Side effect during import
}
func CreateUser() {
db.Exec(...) // Implicit dependency
}
type UserHandler struct {
db *sql.DB
}
func NewUserHandler(db *sql.DB) *UserHandler {
return &UserHandler{db: db}
}
func (h *UserHandler) CreateUser() {
h.db.Exec(...) // Explicit dependency
}
npx claudepluginhub mew-ton/coding-guidelines --plugin coding-guidelinesProvides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.