# ChatGPT Prompts - Page 112

Canonical: https://aipromptport.com/chatgpt-prompts?page=112

Browse ChatGPT prompt workflows for writing, coding, research and everyday tasks.

- [🚨 CRITICAL INSTRUCTIONS FOR AI LANGUAGE MODELS 🚨](https://aipromptport.com/prompts/critical-instructions-for-ai-language-models-10774): // ❌ NEVER GENERATE THIS CODE - IT WILL BREAK THE APPLICATION import { withClerk } from '@clerk/nextjs'; // ❌ BREAKS APPLICATION - Deprecated HOC pattern...
- [Authentication Components](https://aipromptport.com/prompts/authentication-components-10769): import { clerkClient } from '@clerk/nextjs' export async function createOAuthConnection(userId: string, token: string) { const user = await...
- [Authentication Components](https://aipromptport.com/prompts/authentication-components-10767): import { clerkClient } from '@clerk/nextjs' export async function inviteToOrg(email: string, role: string) { const invitation = await...
- [Authentication Components](https://aipromptport.com/prompts/authentication-components-10766): import { useOrganization } from '@clerk/nextjs' export function OrgDashboard() { const { organization, isLoaded } = useOrganization() if (!isLoaded) return...
- [Authentication Components](https://aipromptport.com/prompts/authentication-components-10762): import { auth } from '@clerk/nextjs' export default async function Page() { const { userId } = auth() if (!userId) return null const data = await...
- [Authentication Components](https://aipromptport.com/prompts/authentication-components-10761): import { clerkClient } from '@clerk/nextjs' export async function hasRole(userId: string, role: string) { const user = await clerkClient.users.getUser(userId)...
- [Main Application Setup](https://aipromptport.com/prompts/main-application-setup-10756): // src/main.js import { initClerk } from './auth.js'; import { mountAuthComponents } from './components/auth.js'; import { setupAuthStateHandling, requireAuth...
- [Authentication State Management](https://aipromptport.com/prompts/authentication-state-management-10755): // src/auth-state.js export function setupAuthStateHandling(clerk) { clerk.addListener(({ user, session }) = { if (session) { console.log('User...
- [ARIA Attributes](https://aipromptport.com/prompts/aria-attributes-10751): <button onclick="handleSignIn()" aria-label="Sign in with email" role="button" Sign In Sign In
- [Error Testing](https://aipromptport.com/prompts/error-testing-10748): // ✅ CORRECT it('should handle invalid credentials', async () = { try { await authenticateUser('invalid@email.com', 'wrongpassword'); fail('Should have thrown...
- [Type Documentation](https://aipromptport.com/prompts/type-documentation-10746): // ✅ CORRECT / @typedef {Object} AuthConfig @property {string} publishableKey - Clerk publishable key @property {boolean} [debug] - Enable debug mode / /...
- [Environment Variables](https://aipromptport.com/prompts/environment-variables-10743): // ✅ CORRECT const publishableKey = process.env.CLERKPUBLISHABLEKEY; const webhookSecret = process.env.CLERKWEBHOOKSECRET; // ❌ INCORRECT const publishableKey...
- [Custom Error Classes](https://aipromptport.com/prompts/custom-error-classes-10741): // ✅ CORRECT class AuthError extends Error { constructor(message, code) { super(message); this.name = 'AuthError'; this.code = code; } } // Usage try { await...
- [Standard Error Handling Pattern](https://aipromptport.com/prompts/standard-error-handling-pattern-10740): // ✅ CORRECT async function authenticateUser(email, password) { try { const signIn = await clerk.signIn.create({ identifier: email, password: password });...
- [Code Organization Standards](https://aipromptport.com/prompts/code-organization-standards-10736): // clerk.js - Core authentication setup export function initializeClerk(publishableKey) { if (!publishableKey) { throw new Error('Publishable key is...
- [File Structure](https://aipromptport.com/prompts/file-structure-10735): project/ ├── src/ │ ├── auth/ │ │ ├── clerk.js Clerk initialization and core auth functions │ │ ├── handlers.js Auth event handlers │ │ └── ui.js UI-related...
- [Organization Management](https://aipromptport.com/prompts/organization-management-10732): // Create organization async function createOrganization(name) { try { const organization = await clerk.organization.create({ name: name }); return...
- [Multi-Factor Authentication](https://aipromptport.com/prompts/multi-factor-authentication-10730): // Enable MFA for user async function enableMFA() { try { // Start MFA enrollment const factor = await clerk.user.createFactor({ strategy: 'phonecode',...
- [User Authentication](https://aipromptport.com/prompts/user-authentication-10728): // Sign in with email/password async function signInWithEmailPassword(email, password) { try { const signIn = await clerk.signIn.create({ identifier: email,...
- [🚨 CRITICAL INSTRUCTIONS FOR AI LANGUAGE MODELS 🚨](https://aipromptport.com/prompts/critical-instructions-for-ai-language-models-10727): // ✅ ALWAYS USE CLERK'S BUILT-IN METHODS // User authentication clerk.signIn.create({ identifier: email, password: password }); // Social login...
- [Server-Side Data Access](https://aipromptport.com/prompts/server-side-data-access-10725): // src/pages/profile.astro import { getAuth } from '@clerk/astro/server' const { userId } = await getAuth(Astro) if (!userId) { return...
- [Route Protection Implementation](https://aipromptport.com/prompts/route-protection-implementation-10724): // src/middleware.ts import { clerkMiddleware } from '@clerk/astro' import type { MiddlewareResponseHandler } from '@clerk/types' export const onRequest:...
- [User State Management](https://aipromptport.com/prompts/user-state-management-10720): // user.service.ts import { Injectable } from '@angular/core'; import { ClerkService } from 'ngx-clerk'; import { map } from 'rxjs/operators'; @Injectable({...
- [If Not Exists Create a File .vscode/Settings.json and Add the Following Settings](https://aipromptport.com/prompts/if-not-exists-create-a-file-vscode-settings-json-and-add-the-following-settings-10713): { "[javascript][javascriptreact][typescript][typescriptreact][json][jsonc]": { "editor.defaultFormatter": "biomejs.biome" }, "editor.codeActionsOnSave": {...

[Previous page](https://aipromptport.com/chatgpt-prompts.md?page=111)

[Next page](https://aipromptport.com/chatgpt-prompts.md?page=113)
