go-bootstrap

Wire clean-architecture features into a Go Gin app via DI registry and route registration.

2|Updated Sep 2, 2022
One-click install
npx skills add https://github.com/silvioubaldino/personal-finance --skill go-bootstrap-silvioubaldino
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: go-bootstrap
Source: https://github.com/silvioubaldino/personal-finance/tree/main/.claude/skills/go-bootstrap
Command: npx skills add https://github.com/silvioubaldino/personal-finance --skill go-bootstrap-silvioubaldino

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Adding a new feature to a Go clean-architecture backend requires touching many wiring points — the DI registry, per-feature setup files, and route registration in main.go — and mistakes in ordering or auth middleware placement can silently expose or lock down routes. This Skill encodes the exact conventions so new features are wired correctly the first time. ## Core Features & Use Cases - Feature wiring guidance: Enforces the pattern of creating internal/bootstrap/{feature}/setup.go with a Setup(r, reg) function and registering it in SetupCleanArchComponents. - Registry conventions: Mandates lazy nil-check-then-construct Get{X}Repository() accessors and forbids memoizing external gateways like Stripe or Firebase on the registry. - Auth-aware route registration: Explains the three bootstrap entrypoints (SetupInternalJobs with x-api-key, SetupPublicComponents unauthenticated, SetupCleanArchComponents behind Firebase auth) and how registration order in setupGin determines authentication. - Use Case: When adding a new invoicing feature, follow the six-step checklist to create the repository, usecase, API handler, registry accessor, bootstrap setup file, and the Setup call — then verify with go build and make linter. ## Quick Start Ask the AI to wire a new clean-architecture feature into the Go app, including its registry accessor, bootstrap setup file, and route registration with the correct auth level.

Frequently Asked Questions about go-bootstrap

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new feature to a Go clean-architecture backend?▼

Create the repository, usecase, and API handler layers, then add a lazy Get{X}Repository() accessor to the registry, write internal/bootstrap/{feature}/setup.go with a Setup(r, reg) function, and register it in SetupCleanArchComponents. Verify with go build ./... and make linter.

How do I register routes with Firebase authentication in Gin?▼

Register authenticated routes through SetupCleanArchComponents, which runs after r.Use(authenticator.Authenticate()) is attached in setupGin. Anything registered before that middleware call is unauthenticated, so registration order determines auth.

Should external API clients like Stripe be stored in a DI registry?▼

No. External gateways and HTTP clients such as Stripe, MercadoPago, Firebase, and Expo push are stateless and should be constructed directly inside the feature's Setup() function. Only repositories belong on the registry, via lazy nil-check getters.

Can I store request-scoped data like user ID on a dependency registry?▼

No. The registry is a process-lifetime singleton built once per bootstrap entrypoint, so storing per-request state on it causes data leaks between requests. Pass request-scoped data such as user_id through the request context instead.

How do I protect internal job routes with an API key in Gin?▼

Add the job via SetupInternalJobs, which registers routes under /jobs protected by InternalAPIKeyAuth checking the x-api-key header. Call the feature's SetupJobs(jobsGroup, reg) so the group's middleware covers it automatically.