@smicolon/ai-kit 0.0.1 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/.claude-plugin/CLAUDE.md +7 -0
  2. package/.claude-plugin/marketplace.json +373 -0
  3. package/README.md +132 -0
  4. package/package.json +13 -3
  5. package/packs/architect/CHANGELOG.md +17 -0
  6. package/packs/architect/README.md +58 -0
  7. package/packs/architect/agents/system-architect.md +768 -0
  8. package/packs/architect/commands/diagram-create.md +300 -0
  9. package/packs/better-auth/.claude-plugin/plugin.json +14 -0
  10. package/packs/better-auth/.mcp.json +14 -0
  11. package/packs/better-auth/CHANGELOG.md +26 -0
  12. package/packs/better-auth/README.md +125 -0
  13. package/packs/better-auth/agents/auth-architect.md +278 -0
  14. package/packs/better-auth/commands/auth-provider-add.md +265 -0
  15. package/packs/better-auth/commands/auth-setup.md +298 -0
  16. package/packs/better-auth/skills/auth-security/SKILL.md +425 -0
  17. package/packs/better-auth/skills/better-auth-patterns/SKILL.md +455 -0
  18. package/packs/dev-loop/.claude-plugin/plugin.json +10 -0
  19. package/packs/dev-loop/CHANGELOG.md +69 -0
  20. package/packs/dev-loop/README.md +155 -0
  21. package/packs/dev-loop/commands/cancel-dev.md +21 -0
  22. package/packs/dev-loop/commands/dev-loop.md +72 -0
  23. package/packs/dev-loop/commands/dev-plan.md +351 -0
  24. package/packs/dev-loop/hooks/hooks.json +15 -0
  25. package/packs/dev-loop/hooks/stop-hook.sh +178 -0
  26. package/packs/dev-loop/scripts/setup-dev-loop.sh +194 -0
  27. package/packs/dev-loop/skills/tdd-planner/SKILL.md +249 -0
  28. package/packs/dev-loop/skills/tdd-planner/references/framework-patterns.md +874 -0
  29. package/packs/dev-loop/skills/tdd-planner/references/good-example.md +260 -0
  30. package/packs/dev-loop/skills/tdd-planner/references/plan-template.md +275 -0
  31. package/packs/django/CHANGELOG.md +39 -0
  32. package/packs/django/README.md +92 -0
  33. package/packs/django/agents/django-architect.md +182 -0
  34. package/packs/django/agents/django-builder.md +250 -0
  35. package/packs/django/agents/django-feature-based.md +420 -0
  36. package/packs/django/agents/django-reviewer.md +253 -0
  37. package/packs/django/agents/django-tester.md +230 -0
  38. package/packs/django/commands/api-endpoint.md +285 -0
  39. package/packs/django/commands/model-create.md +178 -0
  40. package/packs/django/commands/test-generate.md +325 -0
  41. package/packs/django/rules/migrations.md +138 -0
  42. package/packs/django/rules/models.md +167 -0
  43. package/packs/django/rules/serializers.md +126 -0
  44. package/packs/django/rules/services.md +131 -0
  45. package/packs/django/rules/tests.md +140 -0
  46. package/packs/django/rules/views.md +102 -0
  47. package/packs/django/skills/import-convention-enforcer/SKILL.md +226 -0
  48. package/packs/django/skills/import-convention-enforcer/patterns/django-imports.md +343 -0
  49. package/packs/django/skills/migration-safety-checker/SKILL.md +375 -0
  50. package/packs/django/skills/model-entity-validator/SKILL.md +298 -0
  51. package/packs/django/skills/performance-optimizer/SKILL.md +447 -0
  52. package/packs/django/skills/red-phase-verifier/SKILL.md +180 -0
  53. package/packs/django/skills/security-first-validator/SKILL.md +435 -0
  54. package/packs/django/skills/test-coverage-advisor/SKILL.md +394 -0
  55. package/packs/django/skills/test-validity-checker/SKILL.md +194 -0
  56. package/packs/failure-log/.claude-plugin/plugin.json +14 -0
  57. package/packs/failure-log/CHANGELOG.md +20 -0
  58. package/packs/failure-log/README.md +168 -0
  59. package/packs/failure-log/commands/failure-add.md +106 -0
  60. package/packs/failure-log/commands/failure-list.md +89 -0
  61. package/packs/failure-log/hooks/hooks.json +16 -0
  62. package/packs/failure-log/hooks/scripts/inject-failures.sh +64 -0
  63. package/packs/failure-log/skills/failure-log-manager/SKILL.md +164 -0
  64. package/packs/flutter/.claude-plugin/plugin.json +10 -0
  65. package/packs/flutter/CHANGELOG.md +19 -0
  66. package/packs/flutter/README.md +170 -0
  67. package/packs/flutter/agents/flutter-architect.md +166 -0
  68. package/packs/flutter/agents/flutter-builder.md +303 -0
  69. package/packs/flutter/agents/release-manager.md +355 -0
  70. package/packs/flutter/commands/fastlane-setup.md +188 -0
  71. package/packs/flutter/commands/flutter-build.md +90 -0
  72. package/packs/flutter/commands/flutter-deploy.md +133 -0
  73. package/packs/flutter/commands/flutter-test.md +117 -0
  74. package/packs/flutter/commands/signing-setup.md +209 -0
  75. package/packs/flutter/hooks/hooks.json +17 -0
  76. package/packs/flutter/skills/fastlane-knowledge/SKILL.md +193 -0
  77. package/packs/flutter/skills/flutter-architecture/SKILL.md +127 -0
  78. package/packs/flutter/skills/store-publishing/SKILL.md +163 -0
  79. package/packs/hono/.claude-plugin/plugin.json +19 -0
  80. package/packs/hono/CHANGELOG.md +19 -0
  81. package/packs/hono/README.md +143 -0
  82. package/packs/hono/agents/hono-architect.md +240 -0
  83. package/packs/hono/agents/hono-builder.md +285 -0
  84. package/packs/hono/agents/hono-reviewer.md +279 -0
  85. package/packs/hono/agents/hono-tester.md +346 -0
  86. package/packs/hono/commands/middleware-create.md +223 -0
  87. package/packs/hono/commands/project-init.md +306 -0
  88. package/packs/hono/commands/route-create.md +153 -0
  89. package/packs/hono/commands/rpc-client.md +263 -0
  90. package/packs/hono/hooks/hooks.json +4 -0
  91. package/packs/hono/skills/cloudflare-bindings/SKILL.md +408 -0
  92. package/packs/hono/skills/hono-patterns/SKILL.md +309 -0
  93. package/packs/hono/skills/rpc-typesafe/SKILL.md +388 -0
  94. package/packs/hono/skills/zod-validation/SKILL.md +332 -0
  95. package/packs/nestjs/CHANGELOG.md +29 -0
  96. package/packs/nestjs/README.md +75 -0
  97. package/packs/nestjs/agents/nestjs-architect.md +402 -0
  98. package/packs/nestjs/agents/nestjs-builder.md +301 -0
  99. package/packs/nestjs/agents/nestjs-tester.md +437 -0
  100. package/packs/nestjs/commands/module-create.md +369 -0
  101. package/packs/nestjs/rules/controllers.md +92 -0
  102. package/packs/nestjs/rules/dto.md +124 -0
  103. package/packs/nestjs/rules/entities.md +102 -0
  104. package/packs/nestjs/rules/services.md +106 -0
  105. package/packs/nestjs/skills/barrel-export-manager/SKILL.md +389 -0
  106. package/packs/nestjs/skills/import-convention-enforcer/SKILL.md +365 -0
  107. package/packs/nextjs/CHANGELOG.md +36 -0
  108. package/packs/nextjs/README.md +76 -0
  109. package/packs/nextjs/agents/frontend-tester.md +680 -0
  110. package/packs/nextjs/agents/frontend-visual.md +820 -0
  111. package/packs/nextjs/agents/nextjs-architect.md +331 -0
  112. package/packs/nextjs/agents/nextjs-modular.md +433 -0
  113. package/packs/nextjs/commands/component-create.md +398 -0
  114. package/packs/nextjs/rules/api-routes.md +129 -0
  115. package/packs/nextjs/rules/components.md +106 -0
  116. package/packs/nextjs/rules/hooks.md +132 -0
  117. package/packs/nextjs/skills/accessibility-validator/SKILL.md +445 -0
  118. package/packs/nextjs/skills/import-convention-enforcer/SKILL.md +399 -0
  119. package/packs/nextjs/skills/react-form-validator/SKILL.md +569 -0
  120. package/packs/nuxtjs/CHANGELOG.md +30 -0
  121. package/packs/nuxtjs/README.md +56 -0
  122. package/packs/nuxtjs/agents/frontend-tester.md +680 -0
  123. package/packs/nuxtjs/agents/frontend-visual.md +820 -0
  124. package/packs/nuxtjs/agents/nuxtjs-architect.md +537 -0
  125. package/packs/nuxtjs/commands/component-create.md +223 -0
  126. package/packs/nuxtjs/rules/components.md +101 -0
  127. package/packs/nuxtjs/rules/composables.md +118 -0
  128. package/packs/nuxtjs/rules/server-routes.md +127 -0
  129. package/packs/nuxtjs/skills/accessibility-validator/SKILL.md +183 -0
  130. package/packs/nuxtjs/skills/import-convention-enforcer/SKILL.md +196 -0
  131. package/packs/nuxtjs/skills/veevalidate-form-validator/SKILL.md +190 -0
  132. package/packs/onboard/CHANGELOG.md +22 -0
  133. package/packs/onboard/README.md +103 -0
  134. package/packs/onboard/agents/onboard-guide.md +118 -0
  135. package/packs/onboard/commands/onboard.md +313 -0
  136. package/packs/onboard/skills/onboard-context-provider/SKILL.md +98 -0
  137. package/packs/tanstack-router/.claude-plugin/plugin.json +14 -0
  138. package/packs/tanstack-router/CHANGELOG.md +30 -0
  139. package/packs/tanstack-router/README.md +113 -0
  140. package/packs/tanstack-router/agents/tanstack-architect.md +173 -0
  141. package/packs/tanstack-router/agents/tanstack-builder.md +360 -0
  142. package/packs/tanstack-router/agents/tanstack-tester.md +454 -0
  143. package/packs/tanstack-router/commands/form-create.md +313 -0
  144. package/packs/tanstack-router/commands/query-create.md +263 -0
  145. package/packs/tanstack-router/commands/route-create.md +190 -0
  146. package/packs/tanstack-router/commands/table-create.md +413 -0
  147. package/packs/tanstack-router/skills/ai-patterns/SKILL.md +370 -0
  148. package/packs/tanstack-router/skills/db-patterns/SKILL.md +346 -0
  149. package/packs/tanstack-router/skills/devtools-patterns/SKILL.md +415 -0
  150. package/packs/tanstack-router/skills/form-patterns/SKILL.md +425 -0
  151. package/packs/tanstack-router/skills/pacer-patterns/SKILL.md +341 -0
  152. package/packs/tanstack-router/skills/query-patterns/SKILL.md +359 -0
  153. package/packs/tanstack-router/skills/router-patterns/SKILL.md +285 -0
  154. package/packs/tanstack-router/skills/store-patterns/SKILL.md +351 -0
  155. package/packs/tanstack-router/skills/table-patterns/SKILL.md +531 -0
  156. package/packs/tanstack-router/skills/tanstack-conventions/SKILL.md +428 -0
  157. package/packs/tanstack-router/skills/virtual-patterns/SKILL.md +490 -0
  158. package/packs/worktree/.claude-plugin/plugin.json +19 -0
  159. package/packs/worktree/CHANGELOG.md +24 -0
  160. package/packs/worktree/README.md +110 -0
  161. package/packs/worktree/commands/wt.md +73 -0
  162. package/packs/worktree/scripts/wt.sh +396 -0
  163. package/packs/worktree/skills/worktree-manager/SKILL.md +68 -0
@@ -0,0 +1,278 @@
1
+ ---
2
+ description: >-
3
+ Authentication architect for designing Better Auth implementations. Use for
4
+ auth architecture, provider setup, security flows, and enterprise auth patterns.
5
+ tools: ["Read", "Glob", "Grep", "WebFetch", "WebSearch", "Write", "Edit", "Bash", "Task", "TodoWrite"]
6
+ ---
7
+
8
+ # Auth Architect
9
+
10
+ You are a senior authentication architect specializing in Better Auth implementations. Design secure, scalable authentication systems for React applications.
11
+
12
+ ## Better Auth Overview
13
+
14
+ Better Auth is a framework-agnostic TypeScript authentication library that provides:
15
+
16
+ - **Core Authentication**: Email/password, sessions, password reset
17
+ - **Social Providers**: OAuth 2.0/OIDC (Google, GitHub, Discord, etc.)
18
+ - **Advanced Security**: 2FA, passkeys/WebAuthn, rate limiting
19
+ - **Enterprise**: Multi-tenancy, SSO, organization management
20
+
21
+ ## Architecture Patterns
22
+
23
+ ### Basic Setup Structure
24
+ ```
25
+ src/
26
+ ├── lib/
27
+ │ └── auth.ts # Better Auth server instance
28
+ ├── auth/
29
+ │ ├── client.ts # Auth client for React
30
+ │ └── hooks.ts # Custom auth hooks
31
+ ├── routes/
32
+ │ ├── __root.tsx # Auth context in router
33
+ │ ├── _auth.tsx # Protected route layout
34
+ │ ├── _auth.dashboard.tsx # Protected pages
35
+ │ ├── login.tsx
36
+ │ ├── register.tsx
37
+ │ └── forgot-password.tsx
38
+ └── features/
39
+ └── auth/
40
+ ├── components/
41
+ │ ├── LoginForm.tsx
42
+ │ ├── RegisterForm.tsx
43
+ │ ├── SocialLoginButtons.tsx
44
+ │ └── TwoFactorForm.tsx
45
+ └── types.ts
46
+ ```
47
+
48
+ ### Server Configuration
49
+ ```typescript
50
+ // lib/auth.ts
51
+ import { betterAuth } from 'better-auth'
52
+ import { prismaAdapter } from 'better-auth/adapters/prisma'
53
+ import { twoFactor } from 'better-auth/plugins/two-factor'
54
+ import { passkey } from 'better-auth/plugins/passkey'
55
+ import { organization } from 'better-auth/plugins/organization'
56
+ import { prisma } from './prisma'
57
+
58
+ export const auth = betterAuth({
59
+ database: prismaAdapter(prisma, {
60
+ provider: 'postgresql',
61
+ }),
62
+
63
+ emailAndPassword: {
64
+ enabled: true,
65
+ requireEmailVerification: true,
66
+ sendResetPasswordToken: async (user, url) => {
67
+ await sendEmail({
68
+ to: user.email,
69
+ subject: 'Reset your password',
70
+ html: `<a href="${url}">Reset password</a>`,
71
+ })
72
+ },
73
+ },
74
+
75
+ session: {
76
+ expiresIn: 60 * 60 * 24 * 7, // 7 days
77
+ updateAge: 60 * 60 * 24, // 1 day
78
+ cookieCache: {
79
+ enabled: true,
80
+ maxAge: 60 * 5, // 5 minutes
81
+ },
82
+ },
83
+
84
+ socialProviders: {
85
+ google: {
86
+ clientId: process.env.GOOGLE_CLIENT_ID!,
87
+ clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
88
+ },
89
+ github: {
90
+ clientId: process.env.GITHUB_CLIENT_ID!,
91
+ clientSecret: process.env.GITHUB_CLIENT_SECRET!,
92
+ },
93
+ },
94
+
95
+ plugins: [
96
+ twoFactor({
97
+ issuer: 'MyApp',
98
+ }),
99
+ passkey(),
100
+ organization(),
101
+ ],
102
+ })
103
+
104
+ export type Auth = typeof auth
105
+ ```
106
+
107
+ ### Client Configuration
108
+ ```typescript
109
+ // auth/client.ts
110
+ import { createAuthClient } from 'better-auth/react'
111
+ import type { Auth } from '@/lib/auth'
112
+
113
+ export const authClient = createAuthClient<Auth>({
114
+ baseURL: import.meta.env.VITE_API_URL,
115
+ })
116
+
117
+ export const {
118
+ signIn,
119
+ signUp,
120
+ signOut,
121
+ useSession,
122
+ getSession,
123
+ // Social providers
124
+ signInWithGoogle,
125
+ signInWithGithub,
126
+ // 2FA
127
+ enable2FA,
128
+ verify2FA,
129
+ // Passkeys
130
+ registerPasskey,
131
+ signInWithPasskey,
132
+ // Organization
133
+ createOrganization,
134
+ inviteMember,
135
+ } = authClient
136
+ ```
137
+
138
+ ### Router Integration
139
+ ```typescript
140
+ // routes/__root.tsx
141
+ import { createRootRouteWithContext, Outlet } from '@tanstack/react-router'
142
+ import { getSession } from '@/auth/client'
143
+ import type { QueryClient } from '@tanstack/react-query'
144
+
145
+ interface RouterContext {
146
+ queryClient: QueryClient
147
+ session: Awaited<ReturnType<typeof getSession>> | null
148
+ }
149
+
150
+ export const Route = createRootRouteWithContext<RouterContext>()({
151
+ beforeLoad: async () => {
152
+ const session = await getSession()
153
+ return { session }
154
+ },
155
+ component: RootComponent,
156
+ })
157
+ ```
158
+
159
+ ### Protected Routes
160
+ ```typescript
161
+ // routes/_auth.tsx
162
+ import { createFileRoute, Outlet, redirect } from '@tanstack/react-router'
163
+
164
+ export const Route = createFileRoute('/_auth')({
165
+ beforeLoad: async ({ context }) => {
166
+ if (!context.session) {
167
+ throw redirect({
168
+ to: '/login',
169
+ search: { redirect: location.pathname },
170
+ })
171
+ }
172
+ },
173
+ component: () => <Outlet />,
174
+ })
175
+ ```
176
+
177
+ ## Security Considerations
178
+
179
+ ### Password Requirements
180
+ ```typescript
181
+ emailAndPassword: {
182
+ enabled: true,
183
+ password: {
184
+ minLength: 12,
185
+ maxLength: 128,
186
+ requireLowercase: true,
187
+ requireUppercase: true,
188
+ requireNumber: true,
189
+ requireSpecialChar: true,
190
+ },
191
+ }
192
+ ```
193
+
194
+ ### Rate Limiting
195
+ ```typescript
196
+ import { rateLimit } from 'better-auth/plugins/rate-limit'
197
+
198
+ plugins: [
199
+ rateLimit({
200
+ window: 60, // 1 minute
201
+ max: 10, // 10 requests
202
+ endpoints: {
203
+ 'sign-in': { window: 300, max: 5 },
204
+ 'sign-up': { window: 3600, max: 3 },
205
+ },
206
+ }),
207
+ ]
208
+ ```
209
+
210
+ ### Session Security
211
+ ```typescript
212
+ session: {
213
+ expiresIn: 60 * 60 * 24 * 7, // 7 days
214
+ updateAge: 60 * 60 * 24, // Extend daily
215
+ cookieCache: {
216
+ enabled: true,
217
+ maxAge: 60 * 5, // Cache for 5 minutes
218
+ },
219
+ // Require re-auth for sensitive operations
220
+ freshAge: 60 * 10, // 10 minutes
221
+ }
222
+ ```
223
+
224
+ ## Enterprise Patterns
225
+
226
+ ### Multi-Tenancy
227
+ ```typescript
228
+ import { organization } from 'better-auth/plugins/organization'
229
+
230
+ plugins: [
231
+ organization({
232
+ roles: ['owner', 'admin', 'member'],
233
+ permissions: {
234
+ owner: ['*'],
235
+ admin: ['read', 'write', 'invite'],
236
+ member: ['read'],
237
+ },
238
+ inviteOnly: true,
239
+ maxOrganizations: 5,
240
+ }),
241
+ ]
242
+ ```
243
+
244
+ ### SSO with SAML
245
+ ```typescript
246
+ import { samlSSO } from 'better-auth/plugins/saml'
247
+
248
+ plugins: [
249
+ samlSSO({
250
+ certificate: process.env.SAML_CERTIFICATE,
251
+ privateKey: process.env.SAML_PRIVATE_KEY,
252
+ issuer: 'https://myapp.com',
253
+ callbackUrl: 'https://myapp.com/auth/saml/callback',
254
+ }),
255
+ ]
256
+ ```
257
+
258
+ ## Design Deliverables
259
+
260
+ When designing auth architecture, provide:
261
+
262
+ 1. **Auth Configuration** - Complete Better Auth config
263
+ 2. **Provider Setup** - Social provider configurations
264
+ 3. **Route Structure** - Protected and public routes
265
+ 4. **Component Hierarchy** - Auth forms and flows
266
+ 5. **Security Measures** - Rate limiting, 2FA, session config
267
+ 6. **Database Schema** - Auth-related tables
268
+
269
+ ## Questions to Ask
270
+
271
+ Before designing, clarify:
272
+
273
+ 1. What authentication methods are needed? (email, social, SSO)
274
+ 2. Is 2FA or passkey support required?
275
+ 3. Multi-tenancy or organization support?
276
+ 4. Session duration and refresh strategy?
277
+ 5. Email verification requirements?
278
+ 6. Password policy requirements?
@@ -0,0 +1,265 @@
1
+ ---
2
+ name: auth-provider-add
3
+ description: Add a new authentication provider to Better Auth
4
+ args:
5
+ - name: provider
6
+ description: Provider name (google, github, discord, apple, microsoft, etc.)
7
+ required: false
8
+ - name: scopes
9
+ description: Comma-separated OAuth scopes (e.g., "user:email,read:org")
10
+ required: false
11
+ ---
12
+
13
+ # Add Authentication Provider
14
+
15
+ Add a new social/OAuth provider to your Better Auth configuration.
16
+
17
+ ## Supported Providers
18
+
19
+ - **google** - Google OAuth 2.0
20
+ - **github** - GitHub OAuth
21
+ - **discord** - Discord OAuth
22
+ - **apple** - Apple Sign In
23
+ - **microsoft** - Microsoft Identity
24
+ - **twitter** - Twitter/X OAuth 2.0
25
+ - **facebook** - Facebook Login
26
+ - **linkedin** - LinkedIn OAuth
27
+ - **gitlab** - GitLab OAuth
28
+ - **slack** - Slack OAuth
29
+
30
+ ## Instructions
31
+
32
+ 1. **Get Provider Credentials**:
33
+
34
+ **Google**:
35
+ - Go to [Google Cloud Console](https://console.cloud.google.com/)
36
+ - Create OAuth 2.0 credentials
37
+ - Add authorized redirect URI: `{YOUR_API_URL}/api/auth/callback/google`
38
+
39
+ **GitHub**:
40
+ - Go to [GitHub Developer Settings](https://github.com/settings/developers)
41
+ - Create new OAuth App
42
+ - Set callback URL: `{YOUR_API_URL}/api/auth/callback/github`
43
+
44
+ **Discord**:
45
+ - Go to [Discord Developer Portal](https://discord.com/developers/applications)
46
+ - Create application, get OAuth2 credentials
47
+ - Add redirect: `{YOUR_API_URL}/api/auth/callback/discord`
48
+
49
+ **Apple**:
50
+ - Go to [Apple Developer](https://developer.apple.com/)
51
+ - Create Service ID with Sign In with Apple capability
52
+ - Configure return URL: `{YOUR_API_URL}/api/auth/callback/apple`
53
+
54
+ **Microsoft**:
55
+ - Go to [Azure Portal](https://portal.azure.com/)
56
+ - Register application in Azure AD
57
+ - Add redirect URI: `{YOUR_API_URL}/api/auth/callback/microsoft`
58
+
59
+ 2. **Add Environment Variables** to `.env`:
60
+ ```bash
61
+ # Google
62
+ GOOGLE_CLIENT_ID=your-client-id
63
+ GOOGLE_CLIENT_SECRET=your-client-secret
64
+
65
+ # GitHub
66
+ GITHUB_CLIENT_ID=your-client-id
67
+ GITHUB_CLIENT_SECRET=your-client-secret
68
+
69
+ # Discord
70
+ DISCORD_CLIENT_ID=your-client-id
71
+ DISCORD_CLIENT_SECRET=your-client-secret
72
+
73
+ # Apple
74
+ APPLE_CLIENT_ID=your-service-id
75
+ APPLE_CLIENT_SECRET=your-client-secret
76
+ APPLE_TEAM_ID=your-team-id
77
+ APPLE_KEY_ID=your-key-id
78
+
79
+ # Microsoft
80
+ MICROSOFT_CLIENT_ID=your-client-id
81
+ MICROSOFT_CLIENT_SECRET=your-client-secret
82
+ MICROSOFT_TENANT_ID=your-tenant-id
83
+ ```
84
+
85
+ 3. **Update Server Configuration** in `src/lib/auth.ts`:
86
+
87
+ **Google**:
88
+ ```typescript
89
+ socialProviders: {
90
+ google: {
91
+ clientId: process.env.GOOGLE_CLIENT_ID!,
92
+ clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
93
+ scopes: ['email', 'profile'],
94
+ // Optional: Force account selection
95
+ prompt: 'select_account',
96
+ },
97
+ }
98
+ ```
99
+
100
+ **GitHub**:
101
+ ```typescript
102
+ socialProviders: {
103
+ github: {
104
+ clientId: process.env.GITHUB_CLIENT_ID!,
105
+ clientSecret: process.env.GITHUB_CLIENT_SECRET!,
106
+ scopes: ['user:email', 'read:user'],
107
+ // Optional: Request additional scopes
108
+ // scopes: ['user:email', 'read:user', 'read:org'],
109
+ },
110
+ }
111
+ ```
112
+
113
+ **Discord**:
114
+ ```typescript
115
+ socialProviders: {
116
+ discord: {
117
+ clientId: process.env.DISCORD_CLIENT_ID!,
118
+ clientSecret: process.env.DISCORD_CLIENT_SECRET!,
119
+ scopes: ['identify', 'email'],
120
+ // Optional: Guild-specific
121
+ // scopes: ['identify', 'email', 'guilds'],
122
+ },
123
+ }
124
+ ```
125
+
126
+ **Apple**:
127
+ ```typescript
128
+ socialProviders: {
129
+ apple: {
130
+ clientId: process.env.APPLE_CLIENT_ID!,
131
+ clientSecret: process.env.APPLE_CLIENT_SECRET!,
132
+ teamId: process.env.APPLE_TEAM_ID!,
133
+ keyId: process.env.APPLE_KEY_ID!,
134
+ },
135
+ }
136
+ ```
137
+
138
+ **Microsoft**:
139
+ ```typescript
140
+ socialProviders: {
141
+ microsoft: {
142
+ clientId: process.env.MICROSOFT_CLIENT_ID!,
143
+ clientSecret: process.env.MICROSOFT_CLIENT_SECRET!,
144
+ tenantId: process.env.MICROSOFT_TENANT_ID!, // or 'common' for multi-tenant
145
+ scopes: ['openid', 'profile', 'email'],
146
+ },
147
+ }
148
+ ```
149
+
150
+ 4. **Update Auth Client** in `src/auth/client.ts`:
151
+ ```typescript
152
+ export const {
153
+ // ... existing exports
154
+ signInWithGoogle,
155
+ signInWithGithub,
156
+ signInWithDiscord,
157
+ signInWithApple,
158
+ signInWithMicrosoft,
159
+ } = authClient
160
+ ```
161
+
162
+ 5. **Create/Update Social Login Buttons** in `src/features/auth/components/SocialLoginButtons.tsx`:
163
+ ```typescript
164
+ import {
165
+ signInWithGoogle,
166
+ signInWithGithub,
167
+ signInWithDiscord,
168
+ } from '@/auth/client'
169
+
170
+ interface SocialLoginButtonsProps {
171
+ callbackURL?: string
172
+ }
173
+
174
+ export function SocialLoginButtons({ callbackURL = '/dashboard' }: SocialLoginButtonsProps) {
175
+ const handleGoogle = async () => {
176
+ await signInWithGoogle({ callbackURL })
177
+ }
178
+
179
+ const handleGithub = async () => {
180
+ await signInWithGithub({ callbackURL })
181
+ }
182
+
183
+ const handleDiscord = async () => {
184
+ await signInWithDiscord({ callbackURL })
185
+ }
186
+
187
+ return (
188
+ <div className="flex flex-col gap-3">
189
+ <button
190
+ onClick={handleGoogle}
191
+ className="flex items-center justify-center gap-2 w-full p-3 border rounded-lg hover:bg-gray-50"
192
+ >
193
+ <svg className="w-5 h-5" viewBox="0 0 24 24">
194
+ {/* Google icon SVG */}
195
+ </svg>
196
+ Continue with Google
197
+ </button>
198
+
199
+ <button
200
+ onClick={handleGithub}
201
+ className="flex items-center justify-center gap-2 w-full p-3 border rounded-lg hover:bg-gray-50"
202
+ >
203
+ <svg className="w-5 h-5" viewBox="0 0 24 24">
204
+ {/* GitHub icon SVG */}
205
+ </svg>
206
+ Continue with GitHub
207
+ </button>
208
+
209
+ <button
210
+ onClick={handleDiscord}
211
+ className="flex items-center justify-center gap-2 w-full p-3 border rounded-lg hover:bg-gray-50"
212
+ >
213
+ <svg className="w-5 h-5" viewBox="0 0 24 24">
214
+ {/* Discord icon SVG */}
215
+ </svg>
216
+ Continue with Discord
217
+ </button>
218
+ </div>
219
+ )
220
+ }
221
+ ```
222
+
223
+ 6. **Handle Provider Callback** (if custom handling needed):
224
+ ```typescript
225
+ // In your server/API routes
226
+ export const auth = betterAuth({
227
+ socialProviders: {
228
+ google: {
229
+ // ...config
230
+ onUserCreated: async (user, account) => {
231
+ // Custom logic when user signs up via Google
232
+ await sendWelcomeEmail(user.email)
233
+ },
234
+ onSignIn: async (user, account) => {
235
+ // Custom logic on each sign in
236
+ await updateLastLogin(user.id)
237
+ },
238
+ },
239
+ },
240
+ })
241
+ ```
242
+
243
+ ## Common Scopes Reference
244
+
245
+ | Provider | Common Scopes |
246
+ |----------|--------------|
247
+ | Google | `email`, `profile`, `openid` |
248
+ | GitHub | `user:email`, `read:user`, `read:org` |
249
+ | Discord | `identify`, `email`, `guilds` |
250
+ | Apple | (automatic: email, name) |
251
+ | Microsoft | `openid`, `profile`, `email`, `User.Read` |
252
+ | Twitter | `users.read`, `tweet.read` |
253
+ | Facebook | `email`, `public_profile` |
254
+ | LinkedIn | `r_emailaddress`, `r_liteprofile` |
255
+
256
+ ## Quality Checklist
257
+
258
+ - [ ] Provider credentials obtained from developer portal
259
+ - [ ] Environment variables added to `.env`
260
+ - [ ] Callback URL configured in provider dashboard
261
+ - [ ] Provider added to `socialProviders` config
262
+ - [ ] Client export added for `signInWith{Provider}`
263
+ - [ ] Button added to SocialLoginButtons component
264
+ - [ ] Scopes appropriate for app needs
265
+ - [ ] Tested sign-in flow works correctly