From go-studio
Add JWT + magic link + OAuth (Google/GitHub) + optional TOTP auth to an existing Go app.
How this skill is triggered — by the user, by Claude, or both
Slash command
/go-studio:build-authThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Adds a complete authentication system to an existing Go SaaS app.
Adds a complete authentication system to an existing Go SaaS app.
Confirm with user before proceeding:
Read patterns:
go-stack: pattern://auth-jwt.mdgo-stack: pattern://auth-magic-link.mdgo-stack: pattern://auth-oauth.md (if OAuth enabled)pquerna/otp library — no dedicated pattern file yet, follow go-stack: guide://review-checklists.md security sectionAdd dependencies to go.mod:
github.com/golang-jwt/jwt/v5golang.org/x/oauth2 (if OAuth)github.com/pquerna/otp (if TOTP)Write migration: internal/migrations/002_auth.sql
magic_link_tokens table (id, user_id, token_hash, expires_at, used_at)refresh_tokens table (id, user_id, token_hash, expires_at)totp_secrets table (if TOTP)Write internal/repositories/auth.go:
FindUserByEmail(ctx, email)CreateMagicLinkToken(ctx, userID, tokenHash, expiresAt)ConsumeMagicLinkToken(ctx, tokenHash) — marks used, returns userCreateRefreshToken(ctx, userID, tokenHash)RotateRefreshToken(ctx, oldHash, newHash)Write internal/services/auth.go:
SendMagicLink(ctx, email) — generates token, sends via ResendVerifyMagicLink(ctx, token) — returns JWT pairRefreshTokens(ctx, refreshToken) — rotates and returns new pairOAuthCallback(ctx, provider, code) (if OAuth)Write internal/handlers/auth.go:
POST /auth/magic-link — request magic linkGET /auth/verify?token=... — verify and set cookiesPOST /auth/refresh — rotate tokensGET /auth/logout — clear cookiesGET /auth/oauth/{provider} (if OAuth)GET /auth/oauth/{provider}/callback (if OAuth)Write internal/middleware/auth.go:
RequireAuth middleware — validates JWT from cookie, sets user in contextOptionalAuth middleware — sets user if token present, continues either wayWrite auth Templ pages:
internal/ui/pages/login.templ — email form for magic linkinternal/ui/pages/verify-sent.templ — "check your email" confirmationWire auth handler to chi router in cmd/server/main.go
Add auth config fields to internal/config/config.go:
JWTSecret, JWTAccessExpiry, JWTRefreshExpiryMagicLinkExpiry, BaseURLGoogleClientID, GoogleClientSecret (if OAuth)GitHubClientID, GitHubClientSecret (if OAuth)Run go build ./... + templ generate
go build ./... passesRequireAuth middleware available for protecting routesnpx claudepluginhub dvrd/ui-studio --plugin dvrdSecures Go HTTP API endpoints with JWT Bearer token validation using auth0/go-jwt-middleware/v3. Handles scope checks, stateless auth, and DPoP token binding for REST APIs from frontends or mobile apps.
Scaffold signin and signup authentication endpoints for a project. Use when the user wants to add authentication, create login/register flows, or set up auth from scratch.
Implements fullstack auth flows: login/signup/forgot-password pages, JWT+refresh tokens, session auth, social login (Google/GitHub/Apple), MFA/2FA, protected routes via middleware, role-based UI. Use for adding auth/authorization.