[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M758SZZVJG53A9NKVH4S2WW2":3,"skill-same:01M758SZZVJG53A9NKVH4S2WW2":46},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":23,"commitSha":24,"skillDirectory":25,"forksCount":26,"repositoryHtmlUrl":27,"repositoryHomepageUrl":28,"ownerHtmlUrl":29,"ownerBlogUrl":28,"ownerDescription":30,"updatedAt":31,"install":32,"resources":45},"01M758SZZVJG53A9NKVH4S2WW2","error-handling",null,"Handle errors across the three tiers — HTTP\u002FDrizzle layer rejection, service factory validation failure, and component-level try\u002Fcatch with toast notifications","CliqRelay\u002Fcliqrelay","CliqRelay","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F290753656?v=4","01M758RPDEB11FEYA2XK17DSHA","01M758RPEKP0NKH6P43GD2FBDG",41,"Apache-2.0","https:\u002F\u002Fgithub.com\u002FCliqRelay\u002Fcliqrelay\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Ffrontend\u002Ferror-handling\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: error-handling\ndescription: Handle errors across the three tiers — HTTP\u002FDrizzle layer rejection, service factory validation failure, and component-level try\u002Fcatch with toast notifications\n---\n\n# Error Handling\n\nThis project follows a **three-tier error handling pattern**, with an additional tier for `@repo\u002Fapi-client` usage:\n\n1. **Implementation layer** — rejects on errors (non-ok HTTP response or DB failure)\n2. **Service layer** — throws on Zod validation failure\n3. **Component layer** — catches errors and displays via toast\n\nNo custom error classes. No centralized error reporting. Errors propagate up from Implementation → Service → Component.\n\n---\n\n## Tier 0: api-client + Server Function Response Handling\n\nWhen using `@repo\u002Fapi-client` via server functions (web app), responses are checked after the SDK call:\n\n```typescript\n\u002F\u002F server-fns\u002Fguides.ts\nimport { createServerFn } from \"@tanstack\u002Freact-start\";\n\nimport { api } from \"@repo\u002Fapi-client\";\n\nexport const createGuide = createServerFn({ method: \"POST\" })\n  .inputValidator((input: { title: string; description?: string }) => input)\n  .handler(async ({ data }) => {\n    const response = await api.guides.createGuide({\n      title: data.title,\n      description: data.description ?? null,\n    });\n    if (response.status !== 201 || !response.data?.guide) {\n      console.error(\"Failed to create guide:\", response.data);\n      return null;\n    }\n    return response.data.guide;\n  });\n```\n\n**Rules:**\n- Check `response.status` against the expected success code\n- Check `response.data` for the expected shape\n- Log the error and return a safe value (`null`) or throw\n- The auto-generated SDK handles transport-level errors (network, 5xx)\n\n---\n\n## Tier 1: Implementation Layer Rejection\n\n### Extension (HTTP) — For non-api-client domains\n\nAll HTTP implementations use the same error pattern:\n\n```typescript\nif (!response.ok) {\n  throw new Error(`Failed: ${response.status} ${response.statusText}`);\n}\n```\n\n**Rules:**\n- Always include the HTTP status in the error message\n- Throw synchronously with `throw new Error(...)`\n- Parse the JSON error body from the API response if available\n\n### Web (Drizzle) — For non-api-client domains\n\nDrizzle operations throw on DB failure naturally. They are wrapped by the composition layer:\n\n```typescript\n\u002F\u002F Errors from Drizzle propagate up unmodified\nconst guide = await drizzleCreateGuide(db, input);\n```\n\n---\n\n## Tier 2: Service Factory Validation Failure\n\n### Extension (HTTP implementation validation) — For non-api-client domains\n\nService HTTP implementations use `getValidationResult` from `@repo\u002Fdata-commons` to validate response bodies:\n\n```typescript\nimport { getValidationResult } from \"@repo\u002Fdata-commons\";\n\u002F\u002F or import the domain-specific validator from models:\nimport { validateHttpCreateGuide } from \"@\u002Fmodels\";\n\nconst data = await response.json();\nconst validationResult = validateHttpCreateGuide(data);\nif (!validationResult.success) {\n  throw new Error(validationResult.error);\n}\n```\n\n**Rules:**\n- Import `getValidationResult` from `@repo\u002Fdata-commons` or use domain-specific validators from `models\u002F`\n- Always check `validationResult.success === false` for type narrowing\n- Throw `new Error(validationResult.error)` — the error string comes from `ValidationResult.error`\n\n---\n\n## Tier 3: Component-Level Catch and Toast\n\nEvery async operation in components\u002Fpages follows the same pattern:\n\n```typescript\ntry {\n  await someOperation();\n} catch (error: any) {\n  showToastError(\"Error\", error.message ?? \"An error occurred\");\n}\n```\n\nThe toast service exposes three methods:\n\n```typescript\nshowToastSuccess(title, message)  \u002F\u002F green\nshowToastInfo(title, message)     \u002F\u002F blue\nshowToastError(title, message)    \u002F\u002F red\n```\n\n**Rules:**\n- Always use `catch (error: any)` — caught errors are `unknown` by default\n- Always provide a fallback message: `error.message ?? \"An error occurred\"`\n- Use the error message from the service layer — it contains the Zod validation error or the implementation error message\n\n---\n\n## Try\u002FCatch with Finally\n\nWhen cleanup is needed after an operation (regardless of success\u002Ffailure), use `finally`:\n\n```typescript\ntry {\n  await operation();\n} catch (error: any) {\n  showToastError(\"Error\", error.message);\n} finally {\n  setLoading(false);\n}\n```\n\n---\n\n## Rules Summary\n\n### ✅ DO\n- Check status + data shape when using `@repo\u002Fapi-client` in server functions\n- Throw `new Error(...)` on HTTP\u002FDrizzle errors\n- Use `getValidationResult` from `@repo\u002Fdata-commons` for Zod validation in HTTP implementations\n- Wrap every async component operation in `try { ... } catch (error: any) { showToastError(...) }`\n- Use `finally` when cleanup is needed regardless of outcome\n\n### ❌ DON'T\n- Don't define custom error classes — use `new Error(message)` consistently\n- Don't catch errors silently — always show feedback via toast\n- Don't log errors to console in production paths\n- Don't use `catch (error)` without the `: any` type annotation\n","# Error Handling\n\nThis project follows a **three-tier error handling pattern**, with an additional tier for `@repo\u002Fapi-client` usage:\n\n1. **Implementation layer** — rejects on errors (non-ok HTTP response or DB failure)\n2. **Service layer** — throws on Zod validation failure\n3. **Component layer** — catches errors and displays via toast\n\nNo custom error classes. No centralized error reporting. Errors propagate up from Implementation → Service → Component.\n\n---\n\n## Tier 0: api-client + Server Function Response Handling\n\nWhen using `@repo\u002Fapi-client` via server functions (web app), responses are checked after the SDK call:\n\n```typescript\n\u002F\u002F server-fns\u002Fguides.ts\nimport { createServerFn } from \"@tanstack\u002Freact-start\";\n\nimport { api } from \"@repo\u002Fapi-client\";\n\nexport const createGuide = createServerFn({ method: \"POST\" })\n  .inputValidator((input: { title: string; description?: string }) => input)\n  .handler(async ({ data }) => {\n    const response = await api.guides.createGuide({\n      title: data.title,\n      description: data.description ?? null,\n    });\n    if (response.status !== 201 || !response.data?.guide) {\n      console.error(\"Failed to create guide:\", response.data);\n      return null;\n    }\n    return response.data.guide;\n  });\n```\n\n**Rules:**\n- Check `response.status` against the expected success code\n- Check `response.data` for the expected shape\n- Log the error and return a safe value (`null`) or throw\n- The auto-generated SDK handles transport-level errors (network, 5xx)\n\n---\n\n## Tier 1: Implementation Layer Rejection\n\n### Extension (HTTP) — For non-api-client domains\n\nAll HTTP implementations use the same error pattern:\n\n```typescript\nif (!response.ok) {\n  throw new Error(`Failed: ${response.status} ${response.statusText}`);\n}\n```\n\n**Rules:**\n- Always include the HTTP status in the error message\n- Throw synchronously with `throw new Error(...)`\n- Parse the JSON error body from the API response if available\n\n### Web (Drizzle) — For non-api-client domains\n\nDrizzle operations throw on DB failure naturally. They are wrapped by the composition layer:\n\n```typescript\n\u002F\u002F Errors from Drizzle propagate up unmodified\nconst guide = await drizzleCreateGuide(db, input);\n```\n\n---\n\n## Tier 2: Service Factory Validation Failure\n\n### Extension (HTTP implementation validation) — For non-api-client domains\n\nService HTTP implementations use `getValidationResult` from `@repo\u002Fdata-commons` to validate response bodies:\n\n```typescript\nimport { getValidationResult } from \"@repo\u002Fdata-commons\";\n\u002F\u002F or import the domain-specific validator from models:\nimport { validateHttpCreateGuide } from \"@\u002Fmodels\";\n\nconst data = await response.json();\nconst validationResult = validateHttpCreateGuide(data);\nif (!validationResult.success) {\n  throw new Error(validationResult.error);\n}\n```\n\n**Rules:**\n- Import `getValidationResult` from `@repo\u002Fdata-commons` or use domain-specific validators from `models\u002F`\n- Always check `validationResult.success === false` for type narrowing\n- Throw `new Error(validationResult.error)` — the error string comes from `ValidationResult.error`\n\n---\n\n## Tier 3: Component-Level Catch and Toast\n\nEvery async operation in components\u002Fpages follows the same pattern:\n\n```typescript\ntry {\n  await someOperation();\n} catch (error: any) {\n  showToastError(\"Error\", error.message ?? \"An error occurred\");\n}\n```\n\nThe toast service exposes three methods:\n\n```typescript\nshowToastSuccess(title, message)  \u002F\u002F green\nshowToastInfo(title, message)     \u002F\u002F blue\nshowToastError(title, message)    \u002F\u002F red\n```\n\n**Rules:**\n- Always use `catch (error: any)` — caught errors are `unknown` by default\n- Always provide a fallback message: `error.message ?? \"An error occurred\"`\n- Use the error message from the service layer — it contains the Zod validation error or the implementation error message\n\n---\n\n## Try\u002FCatch with Finally\n\nWhen cleanup is needed after an operation (regardless of success\u002Ffailure), use `finally`:\n\n```typescript\ntry {\n  await operation();\n} catch (error: any) {\n  showToastError(\"Error\", error.message);\n} finally {\n  setLoading(false);\n}\n```\n\n---\n\n## Rules Summary\n\n### ✅ DO\n- Check status + data shape when using `@repo\u002Fapi-client` in server functions\n- Throw `new Error(...)` on HTTP\u002FDrizzle errors\n- Use `getValidationResult` from `@repo\u002Fdata-commons` for Zod validation in HTTP implementations\n- Wrap every async component operation in `try { ... } catch (error: any) { showToastError(...) }`\n- Use `finally` when cleanup is needed regardless of outcome\n\n### ❌ DON'T\n- Don't define custom error classes — use `new Error(message)` consistently\n- Don't catch errors silently — always show feedback via toast\n- Don't log errors to console in production paths\n- Don't use `catch (error)` without the `: any` type annotation\n",{"name":5,"description":7},"main","f06510bcaf955afc66bbbc1606871e1a1576492e",".agents\u002Fskills\u002Ffrontend\u002Ferror-handling",0,"https:\u002F\u002Fgithub.com\u002FCliqRelay\u002Fcliqrelay","https:\u002F\u002Fcliqrelay.com","https:\u002F\u002Fgithub.com\u002FCliqRelay","Capture and refine workflows instantly to help your teams and AI agents perform at their best.","2026-11-04 22:56:05",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add CliqRelay\u002Fcliqrelay --skill error-handling",{"tool":38,"command":39},"bunx","bunx skills add CliqRelay\u002Fcliqrelay --skill error-handling",{"tool":41,"command":42},"pnpm","pnpm dlx skills add CliqRelay\u002Fcliqrelay --skill error-handling","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FCliqRelay\u002Fcliqrelay\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Ffrontend\u002Ferror-handling\u002FSKILL.md",true,[],[47,54,61,68,75,82],{"skillNo":48,"name":49,"nameZh":6,"description":50,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":51,"categories":52,"keywords":53,"publishedAt":18},"01M758WG0JG18W5MZD6ZPM6PGG","typst","Typst document creation and package development. Use when: (1) Working with .typ files, (2) User mentions typst, typst.toml, or typst-cli, (3) Creating or using Typst packages, (4) Developing document templates, (5) Converting Markdown\u002FLaTeX to Typst","https:\u002F\u002Fgithub.com\u002FCliqRelay\u002Fcliqrelay\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Ftypst\u002FSKILL.md",[],[],{"skillNo":55,"name":56,"nameZh":6,"description":57,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":18},"01M758WACKQMHG2BFF7T758J12","shadcn","Manages shadcn components and projects — adding, searching, fixing, debugging, styling, and composing UI. Provides project context, component docs, and usage examples. Applies when working with shadcn\u002Fui, component registries, presets, --preset codes, or any project with a components.json file. Also triggers for \"shadcn init\", \"create an app with --preset\", or \"switch to --preset\".","https:\u002F\u002Fgithub.com\u002FCliqRelay\u002Fcliqrelay\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fshadcn\u002FSKILL.md",[],[],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":18},"01M758W82G2QQ5Q14FKYNHRXQW","handoff","Compact the current conversation into a handoff document for another agent to pick up.","https:\u002F\u002Fgithub.com\u002FCliqRelay\u002Fcliqrelay\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fproductivity\u002Fhandoff\u002FSKILL.md",[],[],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":18},"01M758W63H60EK55A93199B6NR","grilling","Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.","https:\u002F\u002Fgithub.com\u002FCliqRelay\u002Fcliqrelay\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fproductivity\u002Fgrilling\u002FSKILL.md",[],[],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":18},"01M758W4HD4PF66929V7MDGKW8","grill-me","A relentless interview to sharpen a plan or design.","https:\u002F\u002Fgithub.com\u002FCliqRelay\u002Fcliqrelay\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fproductivity\u002Fgrill-me\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":18},"01M758VYC5CCTP7EA5VKE7YWM5","dont-waffle","Use this skill when answering questions, explaining concepts, writing technical responses, reviewing code, or helping with development tasks. Communicate in clear, simple, standard English. Keep answers concise and focused, remove unnecessary filler and repetition, explain technical ideas in plain language, and structure information so it is easy to read and understand. When showing code, present it clearly with enough context for the developer to understand what it does and where it belongs.","https:\u002F\u002Fgithub.com\u002FCliqRelay\u002Fcliqrelay\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fproductivity\u002Fdont-waffle\u002FSKILL.md",[],[]]