[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M782A0X3T72S5357Z46EMWV6":3,"skill-same:01M782A0X3T72S5357Z46EMWV6":47},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":6,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M782A0X3T72S5357Z46EMWV6","adk-frontend",null,"Guidelines for building frontend applications that integrate with Botpress ADK bots - covering authentication, type generation, client setup, and calling bot actions","Lord1Egypt\u002Fawesome-skill-forge","Lord1Egypt","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F99746359?v=4","01M7592YDNT0XK9WJ0T2MQVPDN","Mohamed Mounir Ali AL Keshita","01M75GRFNHC8VZNWEB8DKDE433",3,"MIT","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fcommunity\u002Fskills_sh\u002Fs\u002Fskills-sh_botpress_skills_adk-frontend\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: adk-frontend\ndescription: Guidelines for building frontend applications that integrate with Botpress ADK bots - covering authentication, type generation, client setup, and calling bot actions\nlicense: MIT\n---\n\n# ADK Frontend Integration\n\nUse this skill when users ask questions about building frontend applications that connect to Botpress ADK bots. This covers authentication patterns, type-safe API calls, client configuration, and integrating generated types.\n\n## What is ADK Frontend Integration?\n\nWhen you build a bot with the Botpress ADK, you often need a frontend application that interacts with it. This skill provides production-tested patterns for:\n\n- **Authentication** - Cookie-based PAT storage with OAuth flow\n- **Client Management** - Zustand store pattern for client caching and reuse\n- **Type Generation** - Using ADK-generated types for full type safety\n- **Action Calls** - Calling bot actions with proper error handling and optimistic updates\n\n### Key Technologies\n\n- **@botpress\u002Fclient** - Official TypeScript client for Botpress API\n- **Triple-slash references** - TypeScript pattern for importing generated types\n- **React Query** - For mutations and cache management (optional but recommended)\n- **Zustand** - For client state management\n\n---\n\n## When to Use This Skill\n\nActivate this skill when users ask frontend-related questions like:\n\n### Authentication Questions\n\n- \"How do I authenticate with Botpress from my frontend?\"\n- \"What are Personal Access Tokens (PATs)?\"\n- \"Should I use cookies or localStorage for tokens?\"\n- \"How do I implement OAuth login flow?\"\n- \"How do I protect routes based on authentication?\"\n- \"How do I handle token expiration?\"\n\n### Client Setup Questions\n\n- \"How do I initialize the Botpress client?\"\n- \"What's the best way to manage multiple client instances?\"\n- \"Why use a client store?\"\n- \"How do I create workspace-scoped vs bot-scoped clients?\"\n- \"What's the difference between regular client and Zai client?\"\n\n### Type Generation Questions\n\n- \"How do I get types for my bot's actions?\"\n- \"What are triple-slash references?\"\n- \"How do I import generated types?\"\n- \"Where are the .adk type files?\"\n- \"How do I keep types in sync between bot and frontend?\"\n- \"Why can't TypeScript find my action types?\"\n\n### Calling Actions Questions\n\n- \"How do I call a bot action from my frontend?\"\n- \"What's the syntax for client.callAction()?\"\n- \"How do I handle errors when calling actions?\"\n- \"How do I implement optimistic updates?\"\n- \"How do I chain multiple action calls?\"\n- \"How do I use React Query with bot actions?\"\n\n---\n\n## Available Documentation\n\nDocumentation files in `.\u002Freferences\u002F`:\n\n### Core Integration Patterns\n\n- **authentication.md** - Complete authentication system with PATs, cookies, OAuth, route protection\n- **botpress-client.md** - Client initialization, Zustand store pattern, Zai client setup\n- **calling-actions.md** - Type-safe action calls, mutations, error handling, optimistic updates\n- **type-generation.md** - Triple-slash references, generated types, maintaining type safety\n\n### Architecture & Setup\n\n- **overview.md** - Architecture overview, when to use ADK frontends, project structure\n- **project-setup.md** - Vite + React scaffolding, TypeScript config, environment setup\n- **recommended-stack.md** - Recommended tech stack with rationale\n\n### Data & State Patterns\n\n- **service-layer.md** - Service layer pattern for wrapping API calls with types\n- **data-fetching.md** - TanStack Query patterns, mutations, optimistic updates\n- **state-management.md** - Zustand vs TanStack Query, when to use each\n- **realtime-updates.md** - Polling strategies, interval tiers, performance considerations\n\n---\n\n## How to Answer Frontend Questions\n\nFrontend questions typically fall into these categories:\n\n### 1. Authentication Implementation\n\nWhen users ask about authentication, reference the complete pattern from `authentication.md`:\n\n**Key Concepts:**\n\n- PAT generation in Botpress Cloud\n- Cookie-based storage (not localStorage)\n- AuthContext with React Context API\n- OAuth callback flow via cli-login\n- Route protection with TanStack Router\n- Profile fetching from both Botpress API and bot tables\n\n**Response Pattern:**\n\n1. Explain the authentication strategy (cookies vs localStorage)\n2. Show the AuthProvider implementation\n3. Demonstrate the OAuth flow\n4. Provide route protection examples\n5. Highlight security best practices\n\n### 2. Client Setup and Management\n\nWhen users ask about client configuration, reference `botpress-client.md`:\n\n**Key Concepts:**\n\n- Client initialization with apiUrl, workspaceId, token, botId\n- Zustand store for client caching\n- Dynamic client keys for reuse\n- Workspace-scoped vs bot-scoped clients\n- Extended timeouts for Zai operations\n\n**Response Pattern:**\n\n1. Show the clientsStore.ts pattern\n2. Explain how client caching works\n3. Demonstrate getApiClient() usage\n4. Show when to use workspace vs bot-scoped clients\n5. Explain getZaiClient() for AI operations\n\n### 3. Type Generation and Import\n\nWhen users ask about types, reference `type-generation.md`:\n\n**Key Concepts:**\n\n- ADK generates types in `.adk\u002F` directory during dev\u002Fbuild\n- Triple-slash directives for referencing external types\n- Generated files: action-types.d.ts, table-types.d.ts, workflow-types.d.ts\n- Creating type aliases for cleaner code\n- Keeping types in sync with adk dev\n\n**Response Pattern:**\n\n1. Explain how ADK generates types\n2. Show triple-slash reference syntax\n3. Demonstrate importing generated types\n4. Provide examples of creating type aliases\n5. Show how types stay in sync automatically\n\n### 4. Calling Bot Actions\n\nWhen users ask about calling actions, reference `calling-actions.md`:\n\n**Key Concepts:**\n\n- client.callAction() signature\n- Type-safe input\u002Foutput with BotActionDefinitions\n- Service layer pattern for reusable action calls\n- Using useMutation for loading states and error handling\n- Optimistic updates for instant UI feedback\n- Chaining actions (sequential vs parallel)\n\n**Response Pattern:**\n\n1. Show the basic callAction() syntax\n2. Demonstrate type-safe service functions\n3. Provide useMutation examples\n4. Show error handling patterns\n5. Explain optimistic updates when relevant\n\n---\n\n## Common Patterns Reference\n\n### Authentication Flow\n\n```typescript\n\u002F\u002F 1. Cookie helpers\nfunction setCookie(name: string, value: string, days = 365);\nfunction getCookie(name: string): string | null;\nfunction deleteCookie(name: string);\n\n\u002F\u002F 2. AuthContext\ninterface AuthContextType {\n  token: string | null;\n  isAuthenticated: boolean;\n  userProfile: UserProfile | null;\n  isLoadingProfile: boolean;\n  login: (token: string) => void;\n  logout: () => void;\n}\n\n\u002F\u002F 3. OAuth Flow\n\u002F\u002F Redirect: https:\u002F\u002Fapp.botpress.cloud\u002Fcli-login?redirect=...\n\u002F\u002F Callback: \u002Fauth\u002Fcallback?pat=bp_pat_...\n\u002F\u002F Store PAT in cookie and navigate to app\n```\n\n### Client Store Pattern\n\n```typescript\n\u002F\u002F stores\u002FclientsStore.ts\nconst useClientsStore = create\u003CClientsState>()((set, get) => ({\n  APIClients: {},\n  getAPIClient: (props) => {\n    const key = props?.botId\n      ? `${props.workspaceId}-${props.botId}`\n      : (props?.workspaceId ?? DEFAULT_API_CLIENT_KEY);\n\n    const cached = get().APIClients[key];\n    if (cached) return cached;\n\n    const newClient = new APIClient({\n      apiUrl: API_BASE_URL,\n      workspaceId: props?.workspaceId,\n      token: getPat() ?? \"\",\n      botId: props?.botId,\n    });\n\n    set((state) => ({\n      APIClients: { ...state.APIClients, [key]: newClient },\n    }));\n\n    return newClient;\n  },\n}));\n\nexport const getApiClient = (props?) =>\n  useClientsStore.getState().getAPIClient(props);\n```\n\n### Type Import Pattern\n\n```typescript\n\u002F\u002F types\u002Findex.ts\n\u002F\u002F\u002F \u003Creference path=\"..\u002F..\u002F..\u002Fbot\u002F.adk\u002Faction-types.d.ts\" \u002F>\n\u002F\u002F\u002F \u003Creference path=\"..\u002F..\u002F..\u002Fbot\u002F.adk\u002Ftable-types.d.ts\" \u002F>\n\nimport type { BotActionDefinitions } from \"@botpress\u002Fruntime\u002F_types\u002Factions\";\nimport type { TableDefinitions } from \"@botpress\u002Fruntime\u002F_types\u002Ftables\";\n\n\u002F\u002F Create type aliases\nexport type SendMessageAction = BotActionDefinitions[\"sendMessage\"];\nexport type TicketTableRow = TableDefinitions[\"TicketsTable\"][\"Output\"];\n```\n\n### Action Call Pattern\n\n```typescript\n\u002F\u002F services\u002Fbot-service.ts\nexport async function sendMessage(input: SendMessageAction[\"input\"]) {\n  const client = getApiClient({ botId, workspaceId });\n  const result = await client.callAction({\n    type: \"sendMessage\",\n    input,\n  });\n  return result.output as SendMessageAction[\"output\"];\n}\n\n\u002F\u002F Component usage with useMutation\nconst { mutate: send, isPending } = useMutation({\n  mutationFn: sendMessage,\n  onSuccess: () => {\n    toast.success(\"Message sent\");\n    queryClient.invalidateQueries({ queryKey: [\"messages\"] });\n  },\n  onError: (error) => {\n    toast.error(\"Failed to send message\");\n  },\n});\n```\n\n---\n\n## Examples of Questions This Skill Answers\n\n### Beginner Questions\n\n- \"How do I connect my React app to a Botpress bot?\"\n- \"What is a Personal Access Token?\"\n- \"Where do I find my workspace ID and bot ID?\"\n- \"How do I install @botpress\u002Fclient?\"\n\n### Authentication Questions\n\n- \"How should I store authentication tokens?\"\n- \"How do I implement login\u002Flogout?\"\n- \"How do I protect authenticated routes?\"\n- \"Should I use cookies or localStorage?\"\n- \"How do I handle the OAuth callback?\"\n\n### Type Safety Questions\n\n- \"How do I get TypeScript types for my bot?\"\n- \"What are triple-slash references?\"\n- \"Why can't TypeScript find my action types?\"\n- \"How do I keep types in sync?\"\n- \"Where are the generated type files?\"\n\n### Implementation Questions\n\n- \"How do I call a bot action?\"\n- \"How do I query bot tables from my frontend?\"\n- \"How do I handle loading states?\"\n- \"How do I implement optimistic updates?\"\n- \"How do I chain multiple action calls?\"\n\n### Advanced Questions\n\n- \"How do I use Zai from my frontend?\"\n- \"What's the difference between workspace and bot-scoped clients?\"\n- \"How do I implement client caching?\"\n- \"How do I handle token expiration?\"\n- \"How do I implement retry logic?\"\n\n---\n\n## Response Format\n\nWhen answering:\n\n1. **Start with a concise explanation** (1-2 paragraphs)\n2. **Provide working code examples** from the references\n3. **Include file references** (e.g., \"From authentication.md:60-85\")\n4. **Highlight security considerations** when relevant\n5. **Show common pitfalls** and how to avoid them\n6. **Link to related topics** for deeper exploration\n\n### Example Response Structure\n\n```\nQuestion: \"How do I authenticate users in my frontend?\"\n\nAnswer:\nThe recommended pattern uses cookie-based PAT storage with OAuth flow.\nHere's the complete implementation:\n\n1. Cookie Helpers (authentication.md:89-111)\n   [code example]\n\n2. AuthContext Setup (authentication.md:64-76)\n   [code example]\n\n3. OAuth Flow (authentication.md:473-533)\n   [code example]\n\nKey Security Considerations:\n- Use SameSite=Lax for CSRF protection\n- Always use HTTPS in production\n- Never log PATs to console\n- Implement token expiration handling\n\nRelated Topics:\n- Route protection: authentication.md:369-467\n- Profile fetching: authentication.md:304-347\n- Client initialization: botpress-client.md:29-51\n```\n\n---\n\n## Critical Patterns to Always Reference\n\nWhen answering questions, always verify these patterns against the documentation:\n\n### 1. Client Management\n\n```typescript\n\u002F\u002F ✅ CORRECT - Use client store\nconst client = getApiClient({ workspaceId, botId });\n\n\u002F\u002F ❌ WRONG - Create new client every time\nconst client = new Client({ apiUrl, workspaceId, token, botId });\n```\n\n### 2. Type Imports\n\n```typescript\n\u002F\u002F ✅ CORRECT - Triple-slash at top of file\n\u002F\u002F\u002F \u003Creference path=\"..\u002F..\u002F..\u002Fbot\u002F.adk\u002Faction-types.d.ts\" \u002F>\nimport type { BotActionDefinitions } from \"@botpress\u002Fruntime\u002F_types\u002Factions\";\n\n\u002F\u002F ❌ WRONG - No triple-slash reference\nimport type { BotActionDefinitions } from \"@botpress\u002Fruntime\u002F_types\u002Factions\";\n```\n\n### 3. Action Calls\n\n```typescript\n\u002F\u002F ✅ CORRECT - Service layer with types\nexport async function sendMessage(input: SendMessageAction[\"input\"]) {\n  const client = getApiClient({ botId, workspaceId });\n  const result = await client.callAction({ type: \"sendMessage\", input });\n  return result.output as SendMessageAction[\"output\"];\n}\n\n\u002F\u002F ❌ WRONG - Direct call in component\nconst result = await client.callAction({ type: \"sendMessage\", input: data });\n```\n\n### 4. Authentication Storage\n\n```typescript\n\u002F\u002F ✅ CORRECT - Cookie with SameSite\ndocument.cookie = `token=${value};expires=${expires};path=\u002F;SameSite=Lax`;\n\n\u002F\u002F ❌ WRONG - localStorage without security\nlocalStorage.setItem(\"token\", value);\n```\n\n---\n\n## Best Practices to Emphasize\n\nWhen answering, always mention relevant best practices:\n\n### Security\n\n- Always use HTTPS in production\n- Use cookies with SameSite protection\n- Never log PATs or tokens\n- Implement token expiration handling\n- Use HttpOnly cookies when possible (SSR)\n\n### Type Safety\n\n- Always use generated types from ADK\n- Create type aliases for cleaner code\n- Use triple-slash references correctly\n- Keep types in sync with adk dev\n- Type all action inputs and outputs\n\n### Performance\n\n- Cache clients with Zustand store\n- Use workspace-scoped clients when no bot operations needed\n- Implement optimistic updates for better UX\n- Use React Query for cache management\n- Run independent actions in parallel\n\n### Error Handling\n\n- Always handle 401 (expired token) errors\n- Provide user feedback on errors\n- Implement retry logic for transient failures\n- Log errors appropriately (never log tokens)\n- Show loading states during async operations\n\n### Code Organization\n\n- Use service layer for action calls\n- Centralize types in single file\n- Keep authentication logic in context\n- Separate client configuration from usage\n- Reuse service functions across components\n\n---\n\n## Troubleshooting Common Issues\n\nBe prepared to help with these common problems:\n\n### \"Cannot find module '@botpress\u002Fruntime\u002F\\_types\u002Factions'\"\n\n- Check triple-slash reference path\n- Verify .adk\u002F directory exists\n- Restart TypeScript server\n- Ensure adk dev\u002Fbuild has run\n\n### \"Types not updating after bot changes\"\n\n- Restart adk dev\n- Delete .adk\u002F and rebuild\n- Restart TypeScript server\n- Check for bot compilation errors\n\n### \"Authentication fails after reload\"\n\n- Implement reload retry logic (authentication.md:191-220)\n- Check cookie expiration\n- Verify token is being retrieved correctly\n- Check for CORS issues\n\n### \"Client timeout on long operations\"\n\n- Use getZaiClient() with extended timeout for AI operations\n- Don't use regular client for Zai operations\n- Consider breaking into smaller operations\n\n## Summary\n\nThis skill covers the complete frontend integration story for Botpress ADK:\n\n**Core Topics:**\n\n1. Authentication with PATs and cookies\n2. Client management with Zustand\n3. Type generation and import with triple-slash references\n4. Calling bot actions with full type safety\n\n**When to Use:**\n\n- Any frontend integration question\n- Authentication and security patterns\n- Type safety and generated types\n- Client setup and configuration\n- Action calls and error handling\n\n**Key Principle:**\nAlways provide production-ready patterns that emphasize type safety, security, and maintainability.\n","# ADK Frontend Integration\n\nUse this skill when users ask questions about building frontend applications that connect to Botpress ADK bots. This covers authentication patterns, type-safe API calls, client configuration, and integrating generated types.\n\n## What is ADK Frontend Integration?\n\nWhen you build a bot with the Botpress ADK, you often need a frontend application that interacts with it. This skill provides production-tested patterns for:\n\n- **Authentication** - Cookie-based PAT storage with OAuth flow\n- **Client Management** - Zustand store pattern for client caching and reuse\n- **Type Generation** - Using ADK-generated types for full type safety\n- **Action Calls** - Calling bot actions with proper error handling and optimistic updates\n\n### Key Technologies\n\n- **@botpress\u002Fclient** - Official TypeScript client for Botpress API\n- **Triple-slash references** - TypeScript pattern for importing generated types\n- **React Query** - For mutations and cache management (optional but recommended)\n- **Zustand** - For client state management\n\n---\n\n## When to Use This Skill\n\nActivate this skill when users ask frontend-related questions like:\n\n### Authentication Questions\n\n- \"How do I authenticate with Botpress from my frontend?\"\n- \"What are Personal Access Tokens (PATs)?\"\n- \"Should I use cookies or localStorage for tokens?\"\n- \"How do I implement OAuth login flow?\"\n- \"How do I protect routes based on authentication?\"\n- \"How do I handle token expiration?\"\n\n### Client Setup Questions\n\n- \"How do I initialize the Botpress client?\"\n- \"What's the best way to manage multiple client instances?\"\n- \"Why use a client store?\"\n- \"How do I create workspace-scoped vs bot-scoped clients?\"\n- \"What's the difference between regular client and Zai client?\"\n\n### Type Generation Questions\n\n- \"How do I get types for my bot's actions?\"\n- \"What are triple-slash references?\"\n- \"How do I import generated types?\"\n- \"Where are the .adk type files?\"\n- \"How do I keep types in sync between bot and frontend?\"\n- \"Why can't TypeScript find my action types?\"\n\n### Calling Actions Questions\n\n- \"How do I call a bot action from my frontend?\"\n- \"What's the syntax for client.callAction()?\"\n- \"How do I handle errors when calling actions?\"\n- \"How do I implement optimistic updates?\"\n- \"How do I chain multiple action calls?\"\n- \"How do I use React Query with bot actions?\"\n\n---\n\n## Available Documentation\n\nDocumentation files in `.\u002Freferences\u002F`:\n\n### Core Integration Patterns\n\n- **authentication.md** - Complete authentication system with PATs, cookies, OAuth, route protection\n- **botpress-client.md** - Client initialization, Zustand store pattern, Zai client setup\n- **calling-actions.md** - Type-safe action calls, mutations, error handling, optimistic updates\n- **type-generation.md** - Triple-slash references, generated types, maintaining type safety\n\n### Architecture & Setup\n\n- **overview.md** - Architecture overview, when to use ADK frontends, project structure\n- **project-setup.md** - Vite + React scaffolding, TypeScript config, environment setup\n- **recommended-stack.md** - Recommended tech stack with rationale\n\n### Data & State Patterns\n\n- **service-layer.md** - Service layer pattern for wrapping API calls with types\n- **data-fetching.md** - TanStack Query patterns, mutations, optimistic updates\n- **state-management.md** - Zustand vs TanStack Query, when to use each\n- **realtime-updates.md** - Polling strategies, interval tiers, performance considerations\n\n---\n\n## How to Answer Frontend Questions\n\nFrontend questions typically fall into these categories:\n\n### 1. Authentication Implementation\n\nWhen users ask about authentication, reference the complete pattern from `authentication.md`:\n\n**Key Concepts:**\n\n- PAT generation in Botpress Cloud\n- Cookie-based storage (not localStorage)\n- AuthContext with React Context API\n- OAuth callback flow via cli-login\n- Route protection with TanStack Router\n- Profile fetching from both Botpress API and bot tables\n\n**Response Pattern:**\n\n1. Explain the authentication strategy (cookies vs localStorage)\n2. Show the AuthProvider implementation\n3. Demonstrate the OAuth flow\n4. Provide route protection examples\n5. Highlight security best practices\n\n### 2. Client Setup and Management\n\nWhen users ask about client configuration, reference `botpress-client.md`:\n\n**Key Concepts:**\n\n- Client initialization with apiUrl, workspaceId, token, botId\n- Zustand store for client caching\n- Dynamic client keys for reuse\n- Workspace-scoped vs bot-scoped clients\n- Extended timeouts for Zai operations\n\n**Response Pattern:**\n\n1. Show the clientsStore.ts pattern\n2. Explain how client caching works\n3. Demonstrate getApiClient() usage\n4. Show when to use workspace vs bot-scoped clients\n5. Explain getZaiClient() for AI operations\n\n### 3. Type Generation and Import\n\nWhen users ask about types, reference `type-generation.md`:\n\n**Key Concepts:**\n\n- ADK generates types in `.adk\u002F` directory during dev\u002Fbuild\n- Triple-slash directives for referencing external types\n- Generated files: action-types.d.ts, table-types.d.ts, workflow-types.d.ts\n- Creating type aliases for cleaner code\n- Keeping types in sync with adk dev\n\n**Response Pattern:**\n\n1. Explain how ADK generates types\n2. Show triple-slash reference syntax\n3. Demonstrate importing generated types\n4. Provide examples of creating type aliases\n5. Show how types stay in sync automatically\n\n### 4. Calling Bot Actions\n\nWhen users ask about calling actions, reference `calling-actions.md`:\n\n**Key Concepts:**\n\n- client.callAction() signature\n- Type-safe input\u002Foutput with BotActionDefinitions\n- Service layer pattern for reusable action calls\n- Using useMutation for loading states and error handling\n- Optimistic updates for instant UI feedback\n- Chaining actions (sequential vs parallel)\n\n**Response Pattern:**\n\n1. Show the basic callAction() syntax\n2. Demonstrate type-safe service functions\n3. Provide useMutation examples\n4. Show error handling patterns\n5. Explain optimistic updates when relevant\n\n---\n\n## Common Patterns Reference\n\n### Authentication Flow\n\n```typescript\n\u002F\u002F 1. Cookie helpers\nfunction setCookie(name: string, value: string, days = 365);\nfunction getCookie(name: string): string | null;\nfunction deleteCookie(name: string);\n\n\u002F\u002F 2. AuthContext\ninterface AuthContextType {\n  token: string | null;\n  isAuthenticated: boolean;\n  userProfile: UserProfile | null;\n  isLoadingProfile: boolean;\n  login: (token: string) => void;\n  logout: () => void;\n}\n\n\u002F\u002F 3. OAuth Flow\n\u002F\u002F Redirect: https:\u002F\u002Fapp.botpress.cloud\u002Fcli-login?redirect=...\n\u002F\u002F Callback: \u002Fauth\u002Fcallback?pat=bp_pat_...\n\u002F\u002F Store PAT in cookie and navigate to app\n```\n\n### Client Store Pattern\n\n```typescript\n\u002F\u002F stores\u002FclientsStore.ts\nconst useClientsStore = create\u003CClientsState>()((set, get) => ({\n  APIClients: {},\n  getAPIClient: (props) => {\n    const key = props?.botId\n      ? `${props.workspaceId}-${props.botId}`\n      : (props?.workspaceId ?? DEFAULT_API_CLIENT_KEY);\n\n    const cached = get().APIClients[key];\n    if (cached) return cached;\n\n    const newClient = new APIClient({\n      apiUrl: API_BASE_URL,\n      workspaceId: props?.workspaceId,\n      token: getPat() ?? \"\",\n      botId: props?.botId,\n    });\n\n    set((state) => ({\n      APIClients: { ...state.APIClients, [key]: newClient },\n    }));\n\n    return newClient;\n  },\n}));\n\nexport const getApiClient = (props?) =>\n  useClientsStore.getState().getAPIClient(props);\n```\n\n### Type Import Pattern\n\n```typescript\n\u002F\u002F types\u002Findex.ts\n\u002F\u002F\u002F \u003Creference path=\"..\u002F..\u002F..\u002Fbot\u002F.adk\u002Faction-types.d.ts\" \u002F>\n\u002F\u002F\u002F \u003Creference path=\"..\u002F..\u002F..\u002Fbot\u002F.adk\u002Ftable-types.d.ts\" \u002F>\n\nimport type { BotActionDefinitions } from \"@botpress\u002Fruntime\u002F_types\u002Factions\";\nimport type { TableDefinitions } from \"@botpress\u002Fruntime\u002F_types\u002Ftables\";\n\n\u002F\u002F Create type aliases\nexport type SendMessageAction = BotActionDefinitions[\"sendMessage\"];\nexport type TicketTableRow = TableDefinitions[\"TicketsTable\"][\"Output\"];\n```\n\n### Action Call Pattern\n\n```typescript\n\u002F\u002F services\u002Fbot-service.ts\nexport async function sendMessage(input: SendMessageAction[\"input\"]) {\n  const client = getApiClient({ botId, workspaceId });\n  const result = await client.callAction({\n    type: \"sendMessage\",\n    input,\n  });\n  return result.output as SendMessageAction[\"output\"];\n}\n\n\u002F\u002F Component usage with useMutation\nconst { mutate: send, isPending } = useMutation({\n  mutationFn: sendMessage,\n  onSuccess: () => {\n    toast.success(\"Message sent\");\n    queryClient.invalidateQueries({ queryKey: [\"messages\"] });\n  },\n  onError: (error) => {\n    toast.error(\"Failed to send message\");\n  },\n});\n```\n\n---\n\n## Examples of Questions This Skill Answers\n\n### Beginner Questions\n\n- \"How do I connect my React app to a Botpress bot?\"\n- \"What is a Personal Access Token?\"\n- \"Where do I find my workspace ID and bot ID?\"\n- \"How do I install @botpress\u002Fclient?\"\n\n### Authentication Questions\n\n- \"How should I store authentication tokens?\"\n- \"How do I implement login\u002Flogout?\"\n- \"How do I protect authenticated routes?\"\n- \"Should I use cookies or localStorage?\"\n- \"How do I handle the OAuth callback?\"\n\n### Type Safety Questions\n\n- \"How do I get TypeScript types for my bot?\"\n- \"What are triple-slash references?\"\n- \"Why can't TypeScript find my action types?\"\n- \"How do I keep types in sync?\"\n- \"Where are the generated type files?\"\n\n### Implementation Questions\n\n- \"How do I call a bot action?\"\n- \"How do I query bot tables from my frontend?\"\n- \"How do I handle loading states?\"\n- \"How do I implement optimistic updates?\"\n- \"How do I chain multiple action calls?\"\n\n### Advanced Questions\n\n- \"How do I use Zai from my frontend?\"\n- \"What's the difference between workspace and bot-scoped clients?\"\n- \"How do I implement client caching?\"\n- \"How do I handle token expiration?\"\n- \"How do I implement retry logic?\"\n\n---\n\n## Response Format\n\nWhen answering:\n\n1. **Start with a concise explanation** (1-2 paragraphs)\n2. **Provide working code examples** from the references\n3. **Include file references** (e.g., \"From authentication.md:60-85\")\n4. **Highlight security considerations** when relevant\n5. **Show common pitfalls** and how to avoid them\n6. **Link to related topics** for deeper exploration\n\n### Example Response Structure\n\n```\nQuestion: \"How do I authenticate users in my frontend?\"\n\nAnswer:\nThe recommended pattern uses cookie-based PAT storage with OAuth flow.\nHere's the complete implementation:\n\n1. Cookie Helpers (authentication.md:89-111)\n   [code example]\n\n2. AuthContext Setup (authentication.md:64-76)\n   [code example]\n\n3. OAuth Flow (authentication.md:473-533)\n   [code example]\n\nKey Security Considerations:\n- Use SameSite=Lax for CSRF protection\n- Always use HTTPS in production\n- Never log PATs to console\n- Implement token expiration handling\n\nRelated Topics:\n- Route protection: authentication.md:369-467\n- Profile fetching: authentication.md:304-347\n- Client initialization: botpress-client.md:29-51\n```\n\n---\n\n## Critical Patterns to Always Reference\n\nWhen answering questions, always verify these patterns against the documentation:\n\n### 1. Client Management\n\n```typescript\n\u002F\u002F ✅ CORRECT - Use client store\nconst client = getApiClient({ workspaceId, botId });\n\n\u002F\u002F ❌ WRONG - Create new client every time\nconst client = new Client({ apiUrl, workspaceId, token, botId });\n```\n\n### 2. Type Imports\n\n```typescript\n\u002F\u002F ✅ CORRECT - Triple-slash at top of file\n\u002F\u002F\u002F \u003Creference path=\"..\u002F..\u002F..\u002Fbot\u002F.adk\u002Faction-types.d.ts\" \u002F>\nimport type { BotActionDefinitions } from \"@botpress\u002Fruntime\u002F_types\u002Factions\";\n\n\u002F\u002F ❌ WRONG - No triple-slash reference\nimport type { BotActionDefinitions } from \"@botpress\u002Fruntime\u002F_types\u002Factions\";\n```\n\n### 3. Action Calls\n\n```typescript\n\u002F\u002F ✅ CORRECT - Service layer with types\nexport async function sendMessage(input: SendMessageAction[\"input\"]) {\n  const client = getApiClient({ botId, workspaceId });\n  const result = await client.callAction({ type: \"sendMessage\", input });\n  return result.output as SendMessageAction[\"output\"];\n}\n\n\u002F\u002F ❌ WRONG - Direct call in component\nconst result = await client.callAction({ type: \"sendMessage\", input: data });\n```\n\n### 4. Authentication Storage\n\n```typescript\n\u002F\u002F ✅ CORRECT - Cookie with SameSite\ndocument.cookie = `token=${value};expires=${expires};path=\u002F;SameSite=Lax`;\n\n\u002F\u002F ❌ WRONG - localStorage without security\nlocalStorage.setItem(\"token\", value);\n```\n\n---\n\n## Best Practices to Emphasize\n\nWhen answering, always mention relevant best practices:\n\n### Security\n\n- Always use HTTPS in production\n- Use cookies with SameSite protection\n- Never log PATs or tokens\n- Implement token expiration handling\n- Use HttpOnly cookies when possible (SSR)\n\n### Type Safety\n\n- Always use generated types from ADK\n- Create type aliases for cleaner code\n- Use triple-slash references correctly\n- Keep types in sync with adk dev\n- Type all action inputs and outputs\n\n### Performance\n\n- Cache clients with Zustand store\n- Use workspace-scoped clients when no bot operations needed\n- Implement optimistic updates for better UX\n- Use React Query for cache management\n- Run independent actions in parallel\n\n### Error Handling\n\n- Always handle 401 (expired token) errors\n- Provide user feedback on errors\n- Implement retry logic for transient failures\n- Log errors appropriately (never log tokens)\n- Show loading states during async operations\n\n### Code Organization\n\n- Use service layer for action calls\n- Centralize types in single file\n- Keep authentication logic in context\n- Separate client configuration from usage\n- Reuse service functions across components\n\n---\n\n## Troubleshooting Common Issues\n\nBe prepared to help with these common problems:\n\n### \"Cannot find module '@botpress\u002Fruntime\u002F\\_types\u002Factions'\"\n\n- Check triple-slash reference path\n- Verify .adk\u002F directory exists\n- Restart TypeScript server\n- Ensure adk dev\u002Fbuild has run\n\n### \"Types not updating after bot changes\"\n\n- Restart adk dev\n- Delete .adk\u002F and rebuild\n- Restart TypeScript server\n- Check for bot compilation errors\n\n### \"Authentication fails after reload\"\n\n- Implement reload retry logic (authentication.md:191-220)\n- Check cookie expiration\n- Verify token is being retrieved correctly\n- Check for CORS issues\n\n### \"Client timeout on long operations\"\n\n- Use getZaiClient() with extended timeout for AI operations\n- Don't use regular client for Zai operations\n- Consider breaking into smaller operations\n\n## Summary\n\nThis skill covers the complete frontend integration story for Botpress ADK:\n\n**Core Topics:**\n\n1. Authentication with PATs and cookies\n2. Client management with Zustand\n3. Type generation and import with triple-slash references\n4. Calling bot actions with full type safety\n\n**When to Use:**\n\n- Any frontend integration question\n- Authentication and security patterns\n- Type safety and generated types\n- Client setup and configuration\n- Action calls and error handling\n\n**Key Principle:**\nAlways provide production-ready patterns that emphasize type safety, security, and maintainability.\n",{"name":5,"license":15,"description":7},"master","4aa004da461d820f4ea5499e58eb8d196cf99016","community\u002Fskills_sh\u002Fs\u002Fskills-sh_botpress_skills_adk-frontend",0,"https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge","https:\u002F\u002Fskill-explorer-rho.vercel.app","https:\u002F\u002Fgithub.com\u002FLord1Egypt","Unbreakable. Unstoppable. Unmatched⚡.\r\n Speaker of machine tongues 🤖  | World-builder of decentralized dreams 🌐 | Defender of the digital realm🛡️.","2026-06-10 08:21:01",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add Lord1Egypt\u002Fawesome-skill-forge --skill adk-frontend",{"tool":39,"command":40},"bunx","bunx skills add Lord1Egypt\u002Fawesome-skill-forge --skill adk-frontend",{"tool":42,"command":43},"pnpm","pnpm dlx skills add Lord1Egypt\u002Fawesome-skill-forge --skill adk-frontend","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fcommunity\u002Fskills_sh\u002Fs\u002Fskills-sh_botpress_skills_adk-frontend\u002FSKILL.md",true,[],[48,55,62,69,76,83],{"skillNo":49,"name":50,"nameZh":6,"description":51,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":52,"categories":53,"keywords":54,"publishedAt":19},"01M785WKJB99G3STR1NF9NRTJW","youtube-content","YouTube transcripts to summaries, threads, blogs.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fyoutube-content\u002FSKILL.md",[],[],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":19},"01M785WEFHB0G2S9YA6EPR3H0E","xurl","X\u002FTwitter via xurl CLI: post, search, DM, media, v2 API.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fxurl\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M785W98EDN4EFJXJPMQEHCRC","touchdesigner-mcp","Control a running TouchDesigner instance via twozero MCP — create operators, set parameters, wire connections, execute Python, build real-time visuals. 36 native tools.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Ftouchdesigner-mcp\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M785W5S9FP3QBH2V191E025P","test-driven-development","TDD: enforce RED-GREEN-REFACTOR, tests before code.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Ftest-driven-development\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M785W2AS08NSSH9YATCV6FJB","teams-meeting-pipeline","Operate the Teams meeting summary pipeline via Hermes CLI — summarize meetings, inspect pipeline status, replay jobs, manage Microsoft Graph subscriptions.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fteams-meeting-pipeline\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M785VXKW4T34BTP1SCHW1R7F","systematic-debugging","4-phase root cause debugging: understand bugs before fixing.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fsystematic-debugging\u002FSKILL.md",[],[]]