[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M783E7KD396NQ28Y6R8CABJK":3,"skill-same:01M783E7KD396NQ28Y6R8CABJK":49},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"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":13,"repositoryHtmlUrl":26,"repositoryHomepageUrl":6,"ownerHtmlUrl":27,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":28,"install":29,"resources":42},"01M783E7KD396NQ28Y6R8CABJK","api-error-handling",null,"Implements standardized API error responses with proper status codes, logging, and user-friendly messages. Use when building production APIs, implementing error recovery patterns, or integrating error monitoring services.","aibizmod\u002Faibizmod-service-web","aibizmod","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F295315630?v=4","01M7836CB8EQY701YQ7N88M591","01M7836CBVPZGNSJ8BRP2BT398",0,"MIT","https:\u002F\u002Fgithub.com\u002Faibizmod\u002Faibizmod-service-web\u002Fblob\u002Fmain\u002F.opencode\u002Fskill\u002Fclaude-skills\u002Fplugins\u002Fapi-error-handling\u002Fskills\u002Fapi-error-handling\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: api-error-handling\ndescription: Implements standardized API error responses with proper status codes, logging, and user-friendly messages. Use when building production APIs, implementing error recovery patterns, or integrating error monitoring services.\nlicense: MIT\n---\n\n# API Error Handling\n\nImplement robust error handling with standardized responses and proper logging.\n\n## Standard Error Response Format\n\n```json\n{\n  \"error\": {\n    \"code\": \"VALIDATION_ERROR\",\n    \"message\": \"Invalid request parameters\",\n    \"status\": 400,\n    \"requestId\": \"req_abc123\",\n    \"timestamp\": \"2025-01-15T10:30:00Z\",\n    \"details\": [\n      { \"field\": \"email\", \"message\": \"Invalid email format\" }\n    ]\n  }\n}\n```\n\n## Error Class (Node.js)\n\n```javascript\nclass ApiError extends Error {\n  constructor(code, message, status = 500, details = null) {\n    super(message);\n    this.code = code;\n    this.status = status;\n    this.details = details;\n  }\n\n  static badRequest(message, details) {\n    return new ApiError('BAD_REQUEST', message, 400, details);\n  }\n\n  static notFound(resource) {\n    return new ApiError('NOT_FOUND', `${resource} not found`, 404);\n  }\n\n  static unauthorized() {\n    return new ApiError('UNAUTHORIZED', 'Authentication required', 401);\n  }\n}\n\n\u002F\u002F Global error handler\napp.use((err, req, res, next) => {\n  const status = err.status || 500;\n  const response = {\n    error: {\n      code: err.code || 'INTERNAL_ERROR',\n      message: status === 500 ? 'Internal server error' : err.message,\n      status,\n      requestId: req.id\n    }\n  };\n\n  if (err.details) response.error.details = err.details;\n  if (status >= 500) logger.error(err);\n\n  res.status(status).json(response);\n});\n```\n\n## Circuit Breaker Pattern\n\n```javascript\nclass CircuitBreaker {\n  constructor(threshold = 5, timeout = 30000) {\n    this.failures = 0;\n    this.threshold = threshold;\n    this.timeout = timeout;\n    this.state = 'CLOSED';\n  }\n\n  async call(fn) {\n    if (this.state === 'OPEN') throw new Error('Circuit open');\n    try {\n      const result = await fn();\n      this.failures = 0;\n      return result;\n    } catch (err) {\n      this.failures++;\n      if (this.failures >= this.threshold) {\n        this.state = 'OPEN';\n        setTimeout(() => this.state = 'HALF_OPEN', this.timeout);\n      }\n      throw err;\n    }\n  }\n}\n```\n\n## Additional Implementations\n\nSee [references\u002Fpython-flask.md](references\u002Fpython-flask.md) for:\n- Python Flask error handling with custom exceptions\n- Circuit breaker with automatic recovery\n- Retry with exponential backoff\n- Sentry integration\n\n## Best Practices\n\n- Use consistent error format across all endpoints\n- Include request IDs for traceability\n- Log errors at appropriate severity levels\n- Never expose stack traces to clients\n- Distinguish client errors (4xx) from server errors (5xx)\n- Provide actionable error messages\n","# API Error Handling\n\nImplement robust error handling with standardized responses and proper logging.\n\n## Standard Error Response Format\n\n```json\n{\n  \"error\": {\n    \"code\": \"VALIDATION_ERROR\",\n    \"message\": \"Invalid request parameters\",\n    \"status\": 400,\n    \"requestId\": \"req_abc123\",\n    \"timestamp\": \"2025-01-15T10:30:00Z\",\n    \"details\": [\n      { \"field\": \"email\", \"message\": \"Invalid email format\" }\n    ]\n  }\n}\n```\n\n## Error Class (Node.js)\n\n```javascript\nclass ApiError extends Error {\n  constructor(code, message, status = 500, details = null) {\n    super(message);\n    this.code = code;\n    this.status = status;\n    this.details = details;\n  }\n\n  static badRequest(message, details) {\n    return new ApiError('BAD_REQUEST', message, 400, details);\n  }\n\n  static notFound(resource) {\n    return new ApiError('NOT_FOUND', `${resource} not found`, 404);\n  }\n\n  static unauthorized() {\n    return new ApiError('UNAUTHORIZED', 'Authentication required', 401);\n  }\n}\n\n\u002F\u002F Global error handler\napp.use((err, req, res, next) => {\n  const status = err.status || 500;\n  const response = {\n    error: {\n      code: err.code || 'INTERNAL_ERROR',\n      message: status === 500 ? 'Internal server error' : err.message,\n      status,\n      requestId: req.id\n    }\n  };\n\n  if (err.details) response.error.details = err.details;\n  if (status >= 500) logger.error(err);\n\n  res.status(status).json(response);\n});\n```\n\n## Circuit Breaker Pattern\n\n```javascript\nclass CircuitBreaker {\n  constructor(threshold = 5, timeout = 30000) {\n    this.failures = 0;\n    this.threshold = threshold;\n    this.timeout = timeout;\n    this.state = 'CLOSED';\n  }\n\n  async call(fn) {\n    if (this.state === 'OPEN') throw new Error('Circuit open');\n    try {\n      const result = await fn();\n      this.failures = 0;\n      return result;\n    } catch (err) {\n      this.failures++;\n      if (this.failures >= this.threshold) {\n        this.state = 'OPEN';\n        setTimeout(() => this.state = 'HALF_OPEN', this.timeout);\n      }\n      throw err;\n    }\n  }\n}\n```\n\n## Additional Implementations\n\nSee [references\u002Fpython-flask.md](references\u002Fpython-flask.md) for:\n- Python Flask error handling with custom exceptions\n- Circuit breaker with automatic recovery\n- Retry with exponential backoff\n- Sentry integration\n\n## Best Practices\n\n- Use consistent error format across all endpoints\n- Include request IDs for traceability\n- Log errors at appropriate severity levels\n- Never expose stack traces to clients\n- Distinguish client errors (4xx) from server errors (5xx)\n- Provide actionable error messages\n",{"name":5,"license":14,"description":7},"main","9f54582c8b485462d402d7e70feaef34801746b9",".opencode\u002Fskill\u002Fclaude-skills\u002Fplugins\u002Fapi-error-handling\u002Fskills\u002Fapi-error-handling","https:\u002F\u002Fgithub.com\u002Faibizmod\u002Faibizmod-service-web","https:\u002F\u002Fgithub.com\u002Faibizmod","2026-09-24 00:48:11",{"source":8,"skillName":5,"commands":30,"prompt":40,"zipAvailable":41},[31,34,37],{"tool":32,"command":33},"npx","npx skills add aibizmod\u002Faibizmod-service-web --skill api-error-handling",{"tool":35,"command":36},"bunx","bunx skills add aibizmod\u002Faibizmod-service-web --skill api-error-handling",{"tool":38,"command":39},"pnpm","pnpm dlx skills add aibizmod\u002Faibizmod-service-web --skill api-error-handling","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Faibizmod\u002Faibizmod-service-web\u002Fblob\u002Fmain\u002F.opencode\u002Fskill\u002Fclaude-skills\u002Fplugins\u002Fapi-error-handling\u002Fskills\u002Fapi-error-handling\u002FSKILL.md",true,[43],{"path":44,"resourceType":45,"resourceTypeDesc":46,"sizeBytes":47,"sourceHtmlUrl":48},"references\u002Fpython-flask.md","REFERENCE","参考文档",6866,"https:\u002F\u002Fgithub.com\u002Faibizmod\u002Faibizmod-service-web\u002Fblob\u002Fmain\u002F.opencode\u002Fskill\u002Fclaude-skills\u002Fplugins\u002Fapi-error-handling\u002Fskills\u002Fapi-error-handling\u002Freferences\u002Fpython-flask.md",[50,57,64,71,78,85],{"skillNo":51,"name":52,"nameZh":6,"description":53,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":54,"categories":55,"keywords":56,"publishedAt":18},"01M7846EAPZWCQ8C6G3AAMMR57","{TODO=lowercase-hyphen-case-name}","[TODO: Write comprehensive description in third-person. Start with \"This skill provides...\" or \"This skill should be used when...\"]\n\n[TODO: Add \"Use when\" scenarios - specific situations where Claude should use this skill]\n\n[TODO: Add keywords - technologies, use cases, error messages that should trigger this skill]","https:\u002F\u002Fgithub.com\u002Faibizmod\u002Faibizmod-service-web\u002Fblob\u002Fmain\u002F.opencode\u002Fskill\u002Fclaude-skills\u002Ftemplates\u002Fskill-skeleton\u002Fskills\u002Fskill-name\u002FSKILL.md",[],[],{"skillNo":58,"name":59,"nameZh":6,"description":60,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":18},"01M7846A0WGDKJTDPD5QMHQVFV","zustand-state-management","Zustand state management for React with TypeScript. Use for global state, Redux\u002FContext API migration, localStorage persistence, slices pattern, devtools, Next.js SSR, or encountering hydration errors, TypeScript inference issues, persist middleware problems, infinite render loops.","https:\u002F\u002Fgithub.com\u002Faibizmod\u002Faibizmod-service-web\u002Fblob\u002Fmain\u002F.opencode\u002Fskill\u002Fclaude-skills\u002Fplugins\u002Fzustand-state-management\u002Fskills\u002Fzustand-state-management\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":18},"01M78463GGSP9B3JSF146B2MG0","zod","TypeScript-first schema validation and type inference. Use for validating API requests\u002Fresponses, form data, env vars, configs, defining type-safe schemas with runtime validation, transforming data, generating JSON Schema for OpenAPI\u002FAI, or encountering missing validation errors, type inference issues, validation error handling problems. Zero dependencies (2kb gzipped).","https:\u002F\u002Fgithub.com\u002Faibizmod\u002Faibizmod-service-web\u002Fblob\u002Fmain\u002F.opencode\u002Fskill\u002Fclaude-skills\u002Fplugins\u002Fzod\u002Fskills\u002Fzod\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":18},"01M7845ZX17SVNNY7EDGPJHSBT","xss-prevention","XSS attack prevention with input sanitization, output encoding, Content Security Policy. Use for user-generated content, rich text editors, web application security, or encountering stored XSS, reflected XSS, DOM manipulation, script injection errors.","https:\u002F\u002Fgithub.com\u002Faibizmod\u002Faibizmod-service-web\u002Fblob\u002Fmain\u002F.opencode\u002Fskill\u002Fclaude-skills\u002Fplugins\u002Fxss-prevention\u002Fskills\u002Fxss-prevention\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":18},"01M7845ST1H37YHSXWWQ9N0V0S","wordpress-plugin-core","WordPress plugin development with hooks, security, REST API, custom post types. Use for plugin creation, $wpdb queries, Settings API, or encountering SQL injection, XSS, CSRF, nonce errors.","https:\u002F\u002Fgithub.com\u002Faibizmod\u002Faibizmod-service-web\u002Fblob\u002Fmain\u002F.opencode\u002Fskill\u002Fclaude-skills\u002Fplugins\u002Fwordpress-plugin-core\u002Fskills\u002Fwordpress-plugin-core\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":18},"01M7845PTWD5HWSTGP35Q8TFNY","woocommerce-dev-cycle","Run tests, linting, and quality checks for WooCommerce development. Use when running tests, fixing code style, or following the development workflow in WooCommerce projects.","https:\u002F\u002Fgithub.com\u002Faibizmod\u002Faibizmod-service-web\u002Fblob\u002Fmain\u002F.opencode\u002Fskill\u002Fclaude-skills\u002Fplugins\u002Fwoocommerce-dev-cycle\u002Fskills\u002Fwoocommerce-dev-cycle\u002FSKILL.md",[],[]]