{
  "schemaVersion": "1.0",
  "item": {
    "slug": "resiliant-connections",
    "name": "Resiliant Connections",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/wpank/resiliant-connections",
    "canonicalUrl": "https://clawhub.ai/wpank/resiliant-connections",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/resiliant-connections",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=resiliant-connections",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "README.md",
      "SKILL.md"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Then review README.md for any prerequisites, environment setup, or post-install checks. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Then review README.md for any prerequisites, environment setup, or post-install checks. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-07T17:22:31.273Z",
      "expiresAt": "2026-05-14T17:22:31.273Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=afrexai-annual-report",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=afrexai-annual-report",
        "contentDisposition": "attachment; filename=\"afrexai-annual-report-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/resiliant-connections"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/resiliant-connections",
    "agentPageUrl": "https://openagent3.xyz/skills/resiliant-connections/agent",
    "manifestUrl": "https://openagent3.xyz/skills/resiliant-connections/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/resiliant-connections/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Then review README.md for any prerequisites, environment setup, or post-install checks. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Then review README.md for any prerequisites, environment setup, or post-install checks. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "Resilient Connections",
        "body": "Build API clients and real-time connections that handle failures gracefully with retries, circuit breakers, and fallbacks."
      },
      {
        "title": "OpenClaw / Moltbot / Clawbot",
        "body": "npx clawhub@latest install resilient-connections"
      },
      {
        "title": "When to Use",
        "body": "Building API clients that need to handle transient failures\nReal-time connections that should reconnect automatically\nSystems that need graceful degradation\nAny production system calling external services"
      },
      {
        "title": "Pattern 1: Exponential Backoff",
        "body": "interface RetryOptions {\n  maxRetries: number;\n  baseDelay: number;\n  maxDelay: number;\n  jitter?: boolean;\n}\n\nasync function withRetry<T>(\n  fn: () => Promise<T>,\n  options: RetryOptions\n): Promise<T> {\n  const { maxRetries, baseDelay, maxDelay, jitter = true } = options;\n\n  for (let attempt = 0; attempt <= maxRetries; attempt++) {\n    try {\n      return await fn();\n    } catch (error) {\n      if (attempt === maxRetries) throw error;\n\n      // Calculate delay with exponential backoff\n      let delay = Math.min(baseDelay * 2 ** attempt, maxDelay);\n      \n      // Add jitter to prevent thundering herd\n      if (jitter) {\n        delay = delay * (0.5 + Math.random());\n      }\n\n      await sleep(delay);\n    }\n  }\n\n  throw new Error('Unreachable');\n}\n\n// Usage\nconst data = await withRetry(\n  () => fetch('/api/data').then(r => r.json()),\n  { maxRetries: 3, baseDelay: 1000, maxDelay: 30000 }\n);"
      },
      {
        "title": "Pattern 2: Circuit Breaker",
        "body": "enum CircuitState {\n  Closed,    // Normal operation\n  Open,      // Failing, reject requests\n  HalfOpen,  // Testing if recovered\n}\n\nclass CircuitBreaker {\n  private state = CircuitState.Closed;\n  private failures = 0;\n  private lastFailure = 0;\n  \n  constructor(\n    private threshold: number = 5,\n    private timeout: number = 30000\n  ) {}\n\n  async execute<T>(fn: () => Promise<T>): Promise<T> {\n    if (this.state === CircuitState.Open) {\n      if (Date.now() - this.lastFailure > this.timeout) {\n        this.state = CircuitState.HalfOpen;\n      } else {\n        throw new Error('Circuit breaker is open');\n      }\n    }\n\n    try {\n      const result = await fn();\n      this.onSuccess();\n      return result;\n    } catch (error) {\n      this.onFailure();\n      throw error;\n    }\n  }\n\n  private onSuccess() {\n    this.failures = 0;\n    this.state = CircuitState.Closed;\n  }\n\n  private onFailure() {\n    this.failures++;\n    this.lastFailure = Date.now();\n    \n    if (this.failures >= this.threshold) {\n      this.state = CircuitState.Open;\n    }\n  }\n}"
      },
      {
        "title": "Pattern 3: Resilient Fetch Wrapper",
        "body": "interface FetchOptions extends RequestInit {\n  timeout?: number;\n  retries?: number;\n}\n\nasync function resilientFetch(\n  url: string,\n  options: FetchOptions = {}\n): Promise<Response> {\n  const { timeout = 10000, retries = 3, ...fetchOptions } = options;\n\n  const controller = new AbortController();\n  const timeoutId = setTimeout(() => controller.abort(), timeout);\n\n  const fetchWithTimeout = async () => {\n    try {\n      const response = await fetch(url, {\n        ...fetchOptions,\n        signal: controller.signal,\n      });\n\n      if (!response.ok && response.status >= 500) {\n        throw new Error(`Server error: ${response.status}`);\n      }\n\n      return response;\n    } finally {\n      clearTimeout(timeoutId);\n    }\n  };\n\n  return withRetry(fetchWithTimeout, {\n    maxRetries: retries,\n    baseDelay: 1000,\n    maxDelay: 10000,\n  });\n}"
      },
      {
        "title": "Pattern 4: Reconnecting WebSocket",
        "body": "class ReconnectingWebSocket {\n  private ws: WebSocket | null = null;\n  private retries = 0;\n  private maxRetries = 10;\n\n  constructor(\n    private url: string,\n    private onMessage: (data: unknown) => void\n  ) {\n    this.connect();\n  }\n\n  private connect() {\n    this.ws = new WebSocket(this.url);\n\n    this.ws.onopen = () => {\n      this.retries = 0;\n    };\n\n    this.ws.onmessage = (event) => {\n      this.onMessage(JSON.parse(event.data));\n    };\n\n    this.ws.onclose = () => {\n      if (this.retries < this.maxRetries) {\n        const delay = Math.min(1000 * 2 ** this.retries, 30000);\n        this.retries++;\n        setTimeout(() => this.connect(), delay);\n      }\n    };\n  }\n\n  send(data: unknown) {\n    if (this.ws?.readyState === WebSocket.OPEN) {\n      this.ws.send(JSON.stringify(data));\n    }\n  }\n\n  close() {\n    this.maxRetries = 0; // Prevent reconnection\n    this.ws?.close();\n  }\n}"
      },
      {
        "title": "Pattern 5: Graceful Degradation",
        "body": "async function fetchWithFallback<T>(\n  primary: () => Promise<T>,\n  fallback: () => Promise<T>,\n  cache?: T\n): Promise<T> {\n  try {\n    return await primary();\n  } catch (primaryError) {\n    console.warn('Primary failed, trying fallback:', primaryError);\n    \n    try {\n      return await fallback();\n    } catch (fallbackError) {\n      console.warn('Fallback failed:', fallbackError);\n      \n      if (cache !== undefined) {\n        console.warn('Using cached data');\n        return cache;\n      }\n      \n      throw fallbackError;\n    }\n  }\n}\n\n// Usage\nconst data = await fetchWithFallback(\n  () => fetchFromPrimaryAPI(),\n  () => fetchFromBackupAPI(),\n  cachedData\n);"
      },
      {
        "title": "Related Skills",
        "body": "Meta-skill: ai/skills/meta/realtime-dashboard/ — Complete realtime dashboard guide\nrealtime-react-hooks — Hook usage\nwebsocket-hub-patterns — Server patterns"
      },
      {
        "title": "NEVER Do",
        "body": "NEVER retry non-idempotent requests — POST/PUT might succeed but fail to respond\nNEVER use fixed delays — Always add jitter to prevent thundering herd\nNEVER retry 4xx errors — Client errors won't resolve themselves\nNEVER keep circuit open forever — Always have a timeout to half-open\nNEVER hide connection failures — Show users the degraded state"
      },
      {
        "title": "Quick Reference",
        "body": "// Exponential backoff\nconst delay = Math.min(baseDelay * 2 ** attempt, maxDelay);\n\n// With jitter\nconst jitteredDelay = delay * (0.5 + Math.random());\n\n// Retry check\nconst shouldRetry = \n  error.status >= 500 || \n  error.code === 'ETIMEDOUT' ||\n  error.code === 'ECONNRESET';\n\n// Circuit breaker states\nClosed -> (failures >= threshold) -> Open\nOpen -> (timeout elapsed) -> HalfOpen\nHalfOpen -> (success) -> Closed\nHalfOpen -> (failure) -> Open"
      }
    ],
    "body": "Resilient Connections\n\nBuild API clients and real-time connections that handle failures gracefully with retries, circuit breakers, and fallbacks.\n\nInstallation\nOpenClaw / Moltbot / Clawbot\nnpx clawhub@latest install resilient-connections\n\nWhen to Use\nBuilding API clients that need to handle transient failures\nReal-time connections that should reconnect automatically\nSystems that need graceful degradation\nAny production system calling external services\nPattern 1: Exponential Backoff\ninterface RetryOptions {\n  maxRetries: number;\n  baseDelay: number;\n  maxDelay: number;\n  jitter?: boolean;\n}\n\nasync function withRetry<T>(\n  fn: () => Promise<T>,\n  options: RetryOptions\n): Promise<T> {\n  const { maxRetries, baseDelay, maxDelay, jitter = true } = options;\n\n  for (let attempt = 0; attempt <= maxRetries; attempt++) {\n    try {\n      return await fn();\n    } catch (error) {\n      if (attempt === maxRetries) throw error;\n\n      // Calculate delay with exponential backoff\n      let delay = Math.min(baseDelay * 2 ** attempt, maxDelay);\n      \n      // Add jitter to prevent thundering herd\n      if (jitter) {\n        delay = delay * (0.5 + Math.random());\n      }\n\n      await sleep(delay);\n    }\n  }\n\n  throw new Error('Unreachable');\n}\n\n// Usage\nconst data = await withRetry(\n  () => fetch('/api/data').then(r => r.json()),\n  { maxRetries: 3, baseDelay: 1000, maxDelay: 30000 }\n);\n\nPattern 2: Circuit Breaker\nenum CircuitState {\n  Closed,    // Normal operation\n  Open,      // Failing, reject requests\n  HalfOpen,  // Testing if recovered\n}\n\nclass CircuitBreaker {\n  private state = CircuitState.Closed;\n  private failures = 0;\n  private lastFailure = 0;\n  \n  constructor(\n    private threshold: number = 5,\n    private timeout: number = 30000\n  ) {}\n\n  async execute<T>(fn: () => Promise<T>): Promise<T> {\n    if (this.state === CircuitState.Open) {\n      if (Date.now() - this.lastFailure > this.timeout) {\n        this.state = CircuitState.HalfOpen;\n      } else {\n        throw new Error('Circuit breaker is open');\n      }\n    }\n\n    try {\n      const result = await fn();\n      this.onSuccess();\n      return result;\n    } catch (error) {\n      this.onFailure();\n      throw error;\n    }\n  }\n\n  private onSuccess() {\n    this.failures = 0;\n    this.state = CircuitState.Closed;\n  }\n\n  private onFailure() {\n    this.failures++;\n    this.lastFailure = Date.now();\n    \n    if (this.failures >= this.threshold) {\n      this.state = CircuitState.Open;\n    }\n  }\n}\n\nPattern 3: Resilient Fetch Wrapper\ninterface FetchOptions extends RequestInit {\n  timeout?: number;\n  retries?: number;\n}\n\nasync function resilientFetch(\n  url: string,\n  options: FetchOptions = {}\n): Promise<Response> {\n  const { timeout = 10000, retries = 3, ...fetchOptions } = options;\n\n  const controller = new AbortController();\n  const timeoutId = setTimeout(() => controller.abort(), timeout);\n\n  const fetchWithTimeout = async () => {\n    try {\n      const response = await fetch(url, {\n        ...fetchOptions,\n        signal: controller.signal,\n      });\n\n      if (!response.ok && response.status >= 500) {\n        throw new Error(`Server error: ${response.status}`);\n      }\n\n      return response;\n    } finally {\n      clearTimeout(timeoutId);\n    }\n  };\n\n  return withRetry(fetchWithTimeout, {\n    maxRetries: retries,\n    baseDelay: 1000,\n    maxDelay: 10000,\n  });\n}\n\nPattern 4: Reconnecting WebSocket\nclass ReconnectingWebSocket {\n  private ws: WebSocket | null = null;\n  private retries = 0;\n  private maxRetries = 10;\n\n  constructor(\n    private url: string,\n    private onMessage: (data: unknown) => void\n  ) {\n    this.connect();\n  }\n\n  private connect() {\n    this.ws = new WebSocket(this.url);\n\n    this.ws.onopen = () => {\n      this.retries = 0;\n    };\n\n    this.ws.onmessage = (event) => {\n      this.onMessage(JSON.parse(event.data));\n    };\n\n    this.ws.onclose = () => {\n      if (this.retries < this.maxRetries) {\n        const delay = Math.min(1000 * 2 ** this.retries, 30000);\n        this.retries++;\n        setTimeout(() => this.connect(), delay);\n      }\n    };\n  }\n\n  send(data: unknown) {\n    if (this.ws?.readyState === WebSocket.OPEN) {\n      this.ws.send(JSON.stringify(data));\n    }\n  }\n\n  close() {\n    this.maxRetries = 0; // Prevent reconnection\n    this.ws?.close();\n  }\n}\n\nPattern 5: Graceful Degradation\nasync function fetchWithFallback<T>(\n  primary: () => Promise<T>,\n  fallback: () => Promise<T>,\n  cache?: T\n): Promise<T> {\n  try {\n    return await primary();\n  } catch (primaryError) {\n    console.warn('Primary failed, trying fallback:', primaryError);\n    \n    try {\n      return await fallback();\n    } catch (fallbackError) {\n      console.warn('Fallback failed:', fallbackError);\n      \n      if (cache !== undefined) {\n        console.warn('Using cached data');\n        return cache;\n      }\n      \n      throw fallbackError;\n    }\n  }\n}\n\n// Usage\nconst data = await fetchWithFallback(\n  () => fetchFromPrimaryAPI(),\n  () => fetchFromBackupAPI(),\n  cachedData\n);\n\nRelated Skills\nMeta-skill: ai/skills/meta/realtime-dashboard/ — Complete realtime dashboard guide\nrealtime-react-hooks — Hook usage\nwebsocket-hub-patterns — Server patterns\nNEVER Do\nNEVER retry non-idempotent requests — POST/PUT might succeed but fail to respond\nNEVER use fixed delays — Always add jitter to prevent thundering herd\nNEVER retry 4xx errors — Client errors won't resolve themselves\nNEVER keep circuit open forever — Always have a timeout to half-open\nNEVER hide connection failures — Show users the degraded state\nQuick Reference\n// Exponential backoff\nconst delay = Math.min(baseDelay * 2 ** attempt, maxDelay);\n\n// With jitter\nconst jitteredDelay = delay * (0.5 + Math.random());\n\n// Retry check\nconst shouldRetry = \n  error.status >= 500 || \n  error.code === 'ETIMEDOUT' ||\n  error.code === 'ECONNRESET';\n\n// Circuit breaker states\nClosed -> (failures >= threshold) -> Open\nOpen -> (timeout elapsed) -> HalfOpen\nHalfOpen -> (success) -> Closed\nHalfOpen -> (failure) -> Open"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/wpank/resiliant-connections",
    "publisherUrl": "https://clawhub.ai/wpank/resiliant-connections",
    "owner": "wpank",
    "version": "1.0.0",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/resiliant-connections",
    "downloadUrl": "https://openagent3.xyz/downloads/resiliant-connections",
    "agentUrl": "https://openagent3.xyz/skills/resiliant-connections/agent",
    "manifestUrl": "https://openagent3.xyz/skills/resiliant-connections/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/resiliant-connections/agent.md"
  }
}